aboutsummaryrefslogtreecommitdiffstats
path: root/Source/charon/logger.h
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2005-11-10 08:48:10 +0000
committerMartin Willi <martin@strongswan.org>2005-11-10 08:48:10 +0000
commit69dd95811f261a7d636f6d1f9b52081c94a2872f (patch)
treee32ea998bea5d90ba0122c4f71f4d1b85a155473 /Source/charon/logger.h
parent1061c878a9e342424e8204aba71eb3b532850fd7 (diff)
downloadstrongswan-69dd95811f261a7d636f6d1f9b52081c94a2872f.tar.bz2
strongswan-69dd95811f261a7d636f6d1f9b52081c94a2872f.tar.xz
- added log_bytes and log_chunk
- fixed logger - uses now syslog only - comments
Diffstat (limited to 'Source/charon/logger.h')
-rw-r--r--Source/charon/logger.h96
1 files changed, 67 insertions, 29 deletions
diff --git a/Source/charon/logger.h b/Source/charon/logger.h
index 8656edfff..076944b8e 100644
--- a/Source/charon/logger.h
+++ b/Source/charon/logger.h
@@ -23,13 +23,17 @@
#ifndef LOGGER_H_
#define LOGGER_H_
+
+#include <freeswan.h>
+#include <pluto/constants.h>
+#include <pluto/defs.h>
+
#include "types.h"
/**
* Log Levels supported by the logger object
*/
typedef enum logger_level_e logger_level_t;
-
enum logger_level_e {
/**
* basic control messages
@@ -53,58 +57,92 @@ enum logger_level_e {
* @brief The logger object
*/
typedef struct logger_s logger_t;
-struct logger_s {
+struct logger_s {
/**
- * loggs an entry
+ * @brief Log an entry, using printf()-like params.
*
- * function is used like printf
+ * The specefied loglevels must ALL be activated that
+ * the log is done.
*
- * @param this logger_t-object
- * @param loglevel loglevel of specific log entry
- * @param format printf like format string
- * @param ... printf like parameters
- * @return SUCCESS
+ * @param this logger_t-object
+ * @param loglevel or'ed set of loglevels
+ * @param format printf like format string
+ * @param ... printf like parameters
+ * @return
+ * - SUCCESS in any case
*/
status_t (*log) (logger_t *this, logger_level_t log_level, char *format, ...);
+
+ /**
+ * @brief Log some bytes, useful for debugging.
+ *
+ * The specefied loglevels must ALL be activated that
+ * the log is done.
+ *
+ * @param this logger_t-object
+ * @param loglevel or'ed set of loglevels
+ * @param label a labeling name, logged with the bytes
+ * @param bytes pointer to the bytes to dump
+ * @param len number of bytes to dump
+ * @return
+ * - SUCCESS in any case
+ */
+ status_t (*log_bytes) (logger_t *this, logger_level_t loglevel, char *label, char *bytes, size_t len);
+
+ /**
+ * @brief Log a chunk, useful for debugging.
+ *
+ * The specefied loglevels must ALL be activated that
+ * the log is done.
+ *
+ * @param this logger_t-object
+ * @param loglevel or'ed set of loglevels
+ * @param label a labeling name, logged with the bytes
+ * @param chunk pointer to a chunk to log
+ * @return
+ * - SUCCESS in any case
+ */
+ status_t (*log_chunk) (logger_t *this, logger_level_t loglevel, char *label, chunk_t *chunk);
/**
- * enables a loglevel for the current logger_t-object
+ * @brief Enables a loglevel for the current logger_t-object.
*
- * @param this logger_t-object
- * @param log_level loglevel to enable
- * @return SUCCESS
+ * @param this logger_t-object
+ * @param log_level loglevel to enable
+ * @return
+ * - SUCCESS in any case
*/
status_t (*enable_level) (logger_t *this, logger_level_t log_level);
/**
- * disables a loglevel for the current logger_t-object
+ * @brief Disables a loglevel for the current logger_t-object.
*
- * @param this logger_t-object
- * @param log_level loglevel to disable
- * @return SUCCESS
- */
+ * @param this logger_t-object
+ * @param log_level loglevel to enable
+ * @return
+ * - SUCCESS in any case
+ */
status_t (*disable_level) (logger_t *this, logger_level_t log_level);
/**
- * @brief destroys a logger_t object
+ * @brief destroys a logger_t object.
*
- * @param this logger_t object
- * @return SUCCESS if succeeded, FAILED otherwise
+ * @param this logger_t object
+ * @return
+ * - SUCCESS in any case
*/
status_t (*destroy) (logger_t *this);
};
/**
- * Constructor to create a logger_t-object
+ * @brief Constructor to create a logger_t-object.
*
- * @param logger_name Name for the logger_t-object
- * @param file FILE pointer to write the log-messages to. If NULL
- * syslogger is used.
- * @param log_level to assign to the new logger_t-object
- * @return logger_t-object or NULL if failed
+ * @param logger_name Name for the logger_t-object
+ * @param log_level or'ed set of log_levels to assign to the new logger_t-object
+ * @return logger_t-object or NULL if failed
*/
-logger_t *logger_create(char *logger_name, char *file, logger_level_t log_level);
+logger_t *logger_create(char *logger_name, logger_level_t log_level);
-#endif /*LOGGER_H_*/
+#endif /*LOGGER_H_*/