SILC Runtime Toolkit 1.2 Beta 1
[runtime.git] / lib / silcutil / silclog.h
index 60949270eb1b8587f51f251a326ff0a36ad65a44..59bcac6ee000987e740b2d4263cf136da290dfed 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2006 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
@@ -17,7 +17,7 @@
 
 */
 
-/****h* silcutil/SILC Logging Interface
+/****h* silcutil/Logging Interface
  *
  * DESCRIPTION
  *
@@ -29,7 +29,7 @@
 #ifndef SILCLOG_H
 #define SILCLOG_H
 
-/****d* silcutil/SilcLogAPI/SilcLogType
+/****d* silcutil/SilcLogType
  *
  * NAME
  *
@@ -51,7 +51,7 @@ typedef enum {
 
 #include "silclog_i.h"
 
-/****f* silcutil/SilcLogAPI/SilcLogCb
+/****f* silcutil/SilcLogCb
  *
  * SYNOPSIS
  *
@@ -67,6 +67,8 @@ typedef enum {
  *    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
@@ -74,7 +76,7 @@ typedef enum {
  ***/
 typedef SilcBool (*SilcLogCb)(SilcLogType type, char *message, void *context);
 
-/****f* silcutil/SilcLogAPI/SilcLogDebugCb
+/****f* silcutil/SilcLogDebugCb
  *
  * SYNOPSIS
  *
@@ -100,7 +102,7 @@ typedef SilcBool (*SilcLogCb)(SilcLogType type, 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
  *
@@ -134,7 +136,7 @@ typedef SilcBool (*SilcLogHexdumpCb)(char *file, char *function, int line,
 
 /* Macros */
 
-/****d* silcutil/SilcLogAPI/SILC_LOG_INFO
+/****d* silcutil/SILC_LOG_INFO
  *
  * NAME
  *
@@ -160,7 +162,7 @@ typedef SilcBool (*SilcLogHexdumpCb)(char *file, char *function, int line,
 #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
  *
@@ -179,7 +181,7 @@ typedef SilcBool (*SilcLogHexdumpCb)(char *file, char *function, int line,
 #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
  *
@@ -198,7 +200,7 @@ typedef SilcBool (*SilcLogHexdumpCb)(char *file, char *function, int line,
 #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
  *
@@ -217,7 +219,7 @@ typedef SilcBool (*SilcLogHexdumpCb)(char *file, char *function, int line,
 #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
  *
@@ -248,7 +250,7 @@ typedef SilcBool (*SilcLogHexdumpCb)(char *file, char *function, int line,
 #endif /* SILC_DEBUG */
 /***/
 
-/****d* silcutil/SilcLogAPI/SILC_LOG_HEXDUMP
+/****d* silcutil/SILC_LOG_HEXDUMP
  *
  * NAME
  *
@@ -286,36 +288,15 @@ typedef SilcBool (*SilcLogHexdumpCb)(char *file, char *function, int line,
 #endif /* SILC_DEBUG */
 /***/
 
-/****d* silcutil/SilcLogAPI/SILC_ASSERT
- *
- * NAME
- *
- *    #define SILC_ASSERT(experssion)
- *
- * DESCRIPTION
- *
- *    Assert macro that prints error message to stderr and calls abort()
- *    if the `expression' is false (ie. compares equal to zero).  If
- *    SILC_DEBUG is not defined this macro has no effect.
- *
- * SOURCE
- */
-#if defined(SILC_DEBUG)
-#define SILC_ASSERT(expr) assert((expr));
-#else
-#define SILC_ASSERT(expr) do { } while(0)
-#endif /* SILC_DEBUG */
-/***/
-
 /* Prototypes */
 
-/****f* silcutil/SilcLogAPI/silc_log_set_file
+/****f* silcutil/silc_log_set_file
  *
  * SYNOPSIS
  *
  *    SilcBool silc_log_set_file(SilcLogType type, char *filename,
- *                           SilcUInt32 maxsize,
- *                           SilcSchedule scheduler);
+ *                               SilcUInt32 maxsize,
+ *                               SilcSchedule scheduler);
  *
  * DESCRIPTION
  *
@@ -327,13 +308,14 @@ typedef SilcBool (*SilcLogHexdumpCb)(char *file, char *function, int line,
  *    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.
  *
  ***/
 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
  *
@@ -352,7 +334,7 @@ SilcBool silc_log_set_file(SilcLogType type, char *filename,
  ***/
 char *silc_log_get_file(SilcLogType type);
 
-/****f* silcutil/SilcLogAPI/silc_log_set_callback
+/****f* silcutil/silc_log_set_callback
  *
  * SYNOPSIS
  *
@@ -377,7 +359,7 @@ char *silc_log_get_file(SilcLogType type);
  ***/
 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
  *
@@ -392,7 +374,7 @@ void silc_log_set_callback(SilcLogType type, SilcLogCb cb, void *context);
  ***/
 void silc_log_reset_callbacks(void);
 
-/****f* silcutil/SilcLogAPI/silc_log_flush_all
+/****f* silcutil/silc_log_flush_all
  *
  * SYNOPSIS
  *
@@ -409,7 +391,7 @@ void silc_log_reset_callbacks(void);
  ***/
 void silc_log_flush_all(void);
 
-/****f* silcutil/SilcLogAPI/silc_log_reset_all
+/****f* silcutil/silc_log_reset_all
  *
  * SYNOPSIS
  *
@@ -426,7 +408,7 @@ void silc_log_flush_all(void);
  ***/
 void silc_log_reset_all(void);
 
-/****f* silcutil/SilcLogAPI/silc_log_set_debug_callbacks
+/****f* silcutil/silc_log_set_debug_callbacks
  *
  * SYNOPSIS
  *
@@ -455,7 +437,7 @@ void silc_log_set_debug_callbacks(SilcLogDebugCb debug_cb,
                                  SilcLogHexdumpCb hexdump_cb,
                                  void *hexdump_context);
 
-/****f* silcutil/SilcLogAPI/silc_log_reset_debug_callbacks
+/****f* silcutil/silc_log_reset_debug_callbacks
  *
  * SYNOPSIS
  *
@@ -468,7 +450,7 @@ void silc_log_set_debug_callbacks(SilcLogDebugCb debug_cb,
  ***/
 void silc_log_reset_debug_callbacks(void);
 
-/****f* silcutil/SilcLogAPI/silc_log_set_debug_string
+/****f* silcutil/silc_log_set_debug_string
  *
  * SYNOPSIS
  *
@@ -483,7 +465,7 @@ void silc_log_reset_debug_callbacks(void);
  ***/
 void silc_log_set_debug_string(const char *debug_string);
 
-/****f* silcutil/SilcLogAPI/silc_log_timestamp
+/****f* silcutil/silc_log_timestamp
  *
  * NAME
  *
@@ -497,7 +479,7 @@ void silc_log_set_debug_string(const char *debug_string);
  ***/
 void silc_log_timestamp(SilcBool enable);
 
-/****f* silcutil/SilcLogAPI/silc_log_flushdelay
+/****f* silcutil/silc_log_flushdelay
  *
  * NAME
  *
@@ -510,7 +492,7 @@ void silc_log_timestamp(SilcBool enable);
  ***/
 void silc_log_flushdelay(SilcUInt32 flushdelay);
 
-/****f* silcutil/SilcLogAPI/silc_log_quick
+/****f* silcutil/silc_log_quick
  *
  * NAME
  *
@@ -534,7 +516,7 @@ void silc_log_flushdelay(SilcUInt32 flushdelay);
  ***/
 void silc_log_quick(SilcBool enable);
 
-/****v* silcutil/SilcLogAPI/silc_log_debug
+/****v* silcutil/silc_log_debug
  *
  * NAME
  *
@@ -552,7 +534,7 @@ void silc_log_quick(SilcBool enable);
  ***/
 void silc_log_debug(SilcBool enable);
 
-/****v* silcutil/SilcLogAPI/silc_log_debug_hexdump
+/****v* silcutil/silc_log_debug_hexdump
  *
  * NAME
  *