* Added global variable silc_log_timestamp that tells silclog
[silc.git] / lib / silcutil / silclog.h
index 46db324914fa995737d8c07e6ad52b7fe9eb459c..0819ace625d2f821c45e9383068b757ad9783440 100644 (file)
@@ -18,7 +18,7 @@
 
 */
 
-/****h* silcutil/SilcLogAPI
+/****h* silcutil/SILC Logging Interface
  *
  * DESCRIPTION
  *
@@ -53,7 +53,7 @@ typedef enum {
   /* This should be used for warnings and non critical failures */
   SILC_LOG_WARNING,
 
-  /* Generic error and critical failures messages */
+  /* Generic error and critical failure messages */
   SILC_LOG_ERROR,
 
   /* Fatal messages (usually situations that will lead to a program crash */
@@ -116,7 +116,7 @@ typedef bool (*SilcLogDebugCb)(char *file, char *function, int line,
  * SYNOPSIS
  *
  *    typedef bool (*SilcDebugHexdumpCb)(char *file, char *function, int line,
- *                                       unsigned char *data, uint32 data_len,
+ *                                       unsigned char *data, SilcUInt32 data_len,
  *                                       char *message, void *context;
  *
  * DESCRIPTION
@@ -137,11 +137,27 @@ typedef bool (*SilcLogDebugCb)(char *file, char *function, int line,
  *
  ***/
 typedef bool (*SilcLogHexdumpCb)(char *file, char *function, int line,
-                                unsigned char *data, uint32 data_len,
+                                unsigned char *data, SilcUInt32 data_len,
                                 char *message, void *context);
 
 /* Global Variables */
 
+/****v* silcutil/SilcLogAPI/silc_log_timestamp
+ *
+ * NAME
+ *
+ *    bool silc_log_timestamp -- enable/disable fast logging timestamp
+ *
+ * DESCRIPTION
+ *
+ *    Causes SilcLog to add a timestamp as returned by silc_get_time().
+ *    This may be useful for example if you run your application under a
+ *    daemon helper like watchdog that adds its own timestamp.  Defaults to
+ *    true.
+ *
+ ***/
+extern DLLAPI bool silc_log_timestamp;
+
 /****v* silcutil/SilcLogAPI/silc_log_quick
  *
  * NAME
@@ -220,9 +236,11 @@ extern DLLAPI bool silc_debug_hexdump;
 
 /* Macros */
 
-#ifdef WIN32
+#ifdef SILC_WIN32
+#ifndef __FUNCTION__
 #define __FUNCTION__ ""
 #endif
+#endif
 
 /****d* silcutil/SilcLogAPI/SILC_LOG_INFO
  *
@@ -330,8 +348,11 @@ extern DLLAPI bool silc_debug_hexdump;
                                __FUNCTION__, \
                                __LINE__, \
                                silc_format fmt)
+#define SILC_NOT_IMPLEMENTED(string) \
+  SILC_LOG_DEBUG(("*********** %s: NOT IMPLEMENTED YET", string));
 #else
 #define SILC_LOG_DEBUG(fmt)
+#define SILC_NOT_IMPLEMENTED(string)
 #endif /* SILC_DEBUG */
 /***/
 
@@ -421,7 +442,8 @@ char *silc_log_get_file(SilcLogType type);
  *
  * SYNOPSIS
  *
- *    bool silc_log_set_file(SilcLogType type, char *filename, uint32 maxsize,
+ *    bool silc_log_set_file(SilcLogType type, char *filename, 
+ *                           SilcUInt32 maxsize,
  *                           SilcSchedule scheduler);
  *
  * DESCRIPTION
@@ -436,7 +458,7 @@ char *silc_log_get_file(SilcLogType type);
  *    buffered output and thus to save HD activity.
  *
  ***/
-bool silc_log_set_file(SilcLogType type, char *filename, uint32 maxsize,
+bool silc_log_set_file(SilcLogType type, char *filename, SilcUInt32 maxsize,
                       SilcSchedule scheduler);
 
 /****f* silcutil/SilcLogAPI/silc_log_set_callback
@@ -506,8 +528,8 @@ void silc_log_flush_all();
  *
  *    Forces all logging channels to close and reopen their streams.  Useful
  *    for example after a SIGHUP signal.
- *    Please note that this function could cause some warning messages if
- *    some logging channel points to an illegal filename.
+ *    Please note that this function could generate some warning messages if
+ *    one or more logging channels point to an illegal filename.
  *
  ***/
 void silc_log_reset_all();
@@ -537,7 +559,7 @@ void silc_log_output_debug(char *file, char *function,
  *
  *    void silc_log_output_hexdump(char *file, char *function,
  *                                 int line, void *data_in,
- *                                 uint32 len, char *string);
+ *                                 SilcUInt32 len, char *string);
  *
  * DESCRIPTION
  *
@@ -551,7 +573,7 @@ void silc_log_output_debug(char *file, char *function,
  ***/
 void silc_log_output_hexdump(char *file, char *function,
                             int line, void *data_in,
-                            uint32 len, char *string);
+                            SilcUInt32 len, char *string);
 
 /****f* silcutil/SilcLogAPI/silc_log_set_debug_callbacks
  *