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
*/
-/****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
*
* 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 SilcBool (*SilcLogCb)(SilcLogType type, char *message, void *context);
-/****f* silcutil/SilcLogAPI/SilcLogDebugCb
+/****f* silcutil/SilcLogDebugCb
*
* SYNOPSIS
*
typedef SilcBool (*SilcLogDebugCb)(char *file, char *function, int line,
char *message, void *context);
-/****f* silcutil/SilcLogAPI/SilcLogHexdumpCb
+/****f* silcutil/SilcLogHexdumpCb
*
* SYNOPSIS
*
/* 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
*
#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
*
* 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
*
***/
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(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(SilcBool enable);
-/****v* silcutil/SilcLogAPI/silc_log_debug
+/****v* silcutil/silc_log_debug
*
* NAME
*
***/
void silc_log_debug(SilcBool enable);
-/****v* silcutil/SilcLogAPI/silc_log_debug_hexdump
+/****v* silcutil/silc_log_debug_hexdump
*
* NAME
*