Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 1997 - 2005 Pekka Riikonen
+ Copyright (C) 1997 - 2008 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
*/
-/****h* silcutil/SILC Logging Interface
+/****h* silcutil/Logging Interface
*
* DESCRIPTION
*
#ifndef SILCLOG_H
#define SILCLOG_H
-/****d* silcutil/SilcLogAPI/SilcLogType
+/****d* silcutil/SilcLogType
*
* NAME
*
#include "silclog_i.h"
-/****f* silcutil/SilcLogAPI/SilcLogCb
+/****f* silcutil/SilcLogCb
*
* SYNOPSIS
*
- * typedef bool (*SilcLogCb)(SilcLogType type, char *message,
- * void *context);
+ * typedef SilcBool (*SilcLogCb)(SilcLogType type, char *message,
+ * void *context);
*
* DESCRIPTION
*
* The `message' parameter points to a null-terminated buffer containing
* the received message, while `context' is the caller-specified context.
* The message must not be modified or freed by the callback function.
+ * If the function returns TRUE, SilcLog will assume the message was
+ * handled and won't run its default handler.
*
* SEE ALSO
* silc_log_set_callback
*
***/
-typedef bool (*SilcLogCb)(SilcLogType type, char *message, void *context);
+typedef SilcBool (*SilcLogCb)(SilcLogType type, char *message, void *context);
-/****f* silcutil/SilcLogAPI/SilcLogDebugCb
+/****f* silcutil/SilcLogDebugCb
*
* SYNOPSIS
*
- * typedef bool (*SilcLogDebugCb)(char *file, char *function, int line,
- * char *message, void *context);
+ * typedef SilcBool (*SilcLogDebugCb)(char *file, char *function, int line,
+ * char *message, void *context);
*
* DESCRIPTION
*
* silc_debug, silc_log_set_debug_callbacks
*
***/
-typedef bool (*SilcLogDebugCb)(char *file, char *function, int line,
- char *message, void *context);
+typedef SilcBool (*SilcLogDebugCb)(char *file, char *function, int line,
+ char *message, void *context);
-/****f* silcutil/SilcLogAPI/SilcLogHexdumpCb
+/****f* silcutil/SilcLogHexdumpCb
*
* SYNOPSIS
*
- * typedef bool (*SilcDebugHexdumpCb)(char *file, char *function, int line,
- * unsigned char *data,
- * SilcUInt32 data_len,
- * char *message, void *context;
+ * typedef SilcBool
+ * (*SilcDebugHexdumpCb)(char *file, char *function, int line,
+ * unsigned char *data,
+ * SilcUInt32 data_len,
+ * char *message, void *context;
*
* DESCRIPTION
*
* silc_debug_hexdump, silc_log_set_debug_callbacks
*
***/
-typedef bool (*SilcLogHexdumpCb)(char *file, char *function, int line,
- unsigned char *data, SilcUInt32 data_len,
- char *message, void *context);
+typedef SilcBool (*SilcLogHexdumpCb)(char *file, char *function, int line,
+ unsigned char *data, SilcUInt32 data_len,
+ char *message, void *context);
/* Macros */
-/****d* silcutil/SilcLogAPI/SILC_LOG_INFO
+/****d* silcutil/SILC_LOG_INFO
*
* NAME
*
#define SILC_LOG_INFO(fmt) silc_log_output(SILC_LOG_INFO, silc_format fmt)
/***/
-/****d* silcutil/SilcLogAPI/SILC_LOG_WARNING
+/****d* silcutil/SILC_LOG_WARNING
*
* NAME
*
#define SILC_LOG_WARNING(fmt) silc_log_output(SILC_LOG_WARNING, silc_format fmt)
/***/
-/****d* silcutil/SilcLogAPI/SILC_LOG_ERROR
+/****d* silcutil/SILC_LOG_ERROR
*
* NAME
*
#define SILC_LOG_ERROR(fmt) silc_log_output(SILC_LOG_ERROR, silc_format fmt)
/***/
-/****d* silcutil/SilcLogAPI/SILC_LOG_FATAL
+/****d* silcutil/SILC_LOG_FATAL
*
* NAME
*
#define SILC_LOG_FATAL(fmt) silc_log_output(SILC_LOG_FATAL, silc_format fmt)
/***/
-/****d* silcutil/SilcLogAPI/SILC_LOG_DEBUG
+/****d* silcutil/SILC_LOG_DEBUG
*
* NAME
*
#endif /* SILC_DEBUG */
/***/
-/****d* silcutil/SilcLogAPI/SILC_LOG_HEXDUMP
+/****d* silcutil/SILC_LOG_HEXDUMP
*
* NAME
*
/* Prototypes */
-/****f* silcutil/SilcLogAPI/silc_log_set_file
+/****f* silcutil/silc_log_set_file
*
* SYNOPSIS
*
- * bool silc_log_set_file(SilcLogType type, char *filename,
- * SilcUInt32 maxsize,
- * SilcSchedule scheduler);
+ * SilcBool silc_log_set_file(SilcLogType type, char *filename,
+ * SilcUInt32 maxsize,
+ * SilcSchedule scheduler);
*
* DESCRIPTION
*
* You can disable logging for a channel by specifying NULL filename, the
* maxsize in this case is not important. The `scheduler' parameter is
* needed by the internal logging to allow buffered output and thus to
- * save HD activity.
+ * save HD activity. If `scheduler' is NULL this will call
+ * silc_schedule_get_global to try to get global scheduler.
*
***/
-bool silc_log_set_file(SilcLogType type, char *filename, SilcUInt32 maxsize,
- SilcSchedule scheduler);
+SilcBool silc_log_set_file(SilcLogType type, char *filename,
+ SilcUInt32 maxsize, SilcSchedule scheduler);
-/****f* silcutil/SilcLogAPI/silc_log_get_file
+/****f* silcutil/silc_log_get_file
*
* SYNOPSIS
*
***/
char *silc_log_get_file(SilcLogType type);
-/****f* silcutil/SilcLogAPI/silc_log_set_callback
+/****f* silcutil/silc_log_set_callback
*
* SYNOPSIS
*
***/
void silc_log_set_callback(SilcLogType type, SilcLogCb cb, void *context);
-/****f* silcutil/SilcLogAPI/silc_log_reset_callbacks
+/****f* silcutil/silc_log_reset_callbacks
*
* SYNOPSIS
*
***/
void silc_log_reset_callbacks(void);
-/****f* silcutil/SilcLogAPI/silc_log_flush_all
+/****f* silcutil/silc_log_flush_all
*
* SYNOPSIS
*
***/
void silc_log_flush_all(void);
-/****f* silcutil/SilcLogAPI/silc_log_reset_all
+/****f* silcutil/silc_log_reset_all
*
* SYNOPSIS
*
***/
void silc_log_reset_all(void);
-/****f* silcutil/SilcLogAPI/silc_log_set_debug_callbacks
+/****f* silcutil/silc_log_set_debug_callbacks
*
* SYNOPSIS
*
SilcLogHexdumpCb hexdump_cb,
void *hexdump_context);
-/****f* silcutil/SilcLogAPI/silc_log_reset_debug_callbacks
+/****f* silcutil/silc_log_reset_debug_callbacks
*
* SYNOPSIS
*
***/
void silc_log_reset_debug_callbacks(void);
-/****f* silcutil/SilcLogAPI/silc_log_set_debug_string
+/****f* silcutil/silc_log_set_debug_string
*
* SYNOPSIS
*
***/
void silc_log_set_debug_string(const char *debug_string);
-/****f* silcutil/SilcLogAPI/silc_log_timestamp
+/****f* silcutil/silc_log_timestamp
*
* NAME
*
- * void silc_log_timestamp(bool enable);
+ * void silc_log_timestamp(SilcBool enable);
*
* DESCRIPTION
*
* timestamp and to FALSE to disable it. Default is TRUE.
*
***/
-void silc_log_timestamp(bool enable);
+void silc_log_timestamp(SilcBool enable);
-/****f* silcutil/SilcLogAPI/silc_log_flushdelay
+/****f* silcutil/silc_log_flushdelay
*
* NAME
*
***/
void silc_log_flushdelay(SilcUInt32 flushdelay);
-/****f* silcutil/SilcLogAPI/silc_log_quick
+/****f* silcutil/silc_log_quick
*
* NAME
*
- * void silc_log_quick(bool enable);
+ * void silc_log_quick(SilcBool enable);
*
* DESCRIPTION
*
* Default is FALSE.
*
***/
-void silc_log_quick(bool enable);
+void silc_log_quick(SilcBool enable);
-/****v* silcutil/SilcLogAPI/silc_log_debug
+/****v* silcutil/silc_log_debug
*
* NAME
*
- * void silc_log_debug(bool enable);
+ * void silc_log_debug(SilcBool enable);
*
* DESCRIPTION
*
* SILC_LOG_DEBUG
*
***/
-void silc_log_debug(bool enable);
+void silc_log_debug(SilcBool enable);
-/****v* silcutil/SilcLogAPI/silc_log_debug_hexdump
+/****v* silcutil/silc_log_debug_hexdump
*
* NAME
*
- * void silc_log_debug_hexdump(bool enable);
+ * void silc_log_debug_hexdump(SilcBool enable);
*
* DESCRIPTION
*
* SILC_LOG_HEXDUMP
*
***/
-void silc_log_debug_hexdump(bool enable);
+void silc_log_debug_hexdump(SilcBool enable);
#endif /* !SILCLOG_H */