Merged from silc_1_0_branch (second merge).
[silc.git] / lib / silcutil / silclog.h
index b91ab5cb00e2fbcc4b799efcb51ac792cd4fe436..337c882e252fe3067b2ed61a00edb17f198455b4 100644 (file)
@@ -2,7 +2,7 @@
 
   silclog.h
 
-  Author: Johnny Mnemonic <johnny@themnemonic.org>
+  Author: Giovanni Giacobbi <giovanni@giacobbi.net>
 
   Copyright (C) 1997 - 2002 Pekka Riikonen
 
@@ -142,6 +142,22 @@ typedef bool (*SilcLogHexdumpCb)(char *file, char *function, int line,
 
 /* 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,38 @@ extern DLLAPI bool silc_debug_hexdump;
 
 /* Macros */
 
-#ifdef SILC_WIN32
+#if defined(WIN32)
+#ifndef __FUNCTION__
 #define __FUNCTION__ ""
 #endif
+#endif
+
+/****d* silcutil/SilcLogAPI/SILC_ENABLE_DEBUG
+ *
+ * NAME
+ *
+ *    #define SILC_ENABLE_DEBUG
+ *
+ * DESCRIPTION
+ *
+ *    Use this macro to enable the debugging in your application.  If
+ *    SILC was compiled with debugging enabled, this macro enables it.
+ *    Use this macro in your application's main header, or in place where
+ *    you need to enable the debugging.
+ *
+ * NOTES
+ *
+ *    You still can control the debugging with silc_debug variable, on
+ *    whether to actually print the debugging or not.  This macro is
+ *    used to enable debugging, not to say it is printed or not.
+ *
+ * SOURCE
+ */
+#define SILC_ENABLE_DEBUG      \
+  #ifndef SILC_DEBUG           \
+  #define SILC_DEBUG 1         \
+  #endif
+/***/
 
 /****d* silcutil/SilcLogAPI/SILC_LOG_INFO
  *
@@ -325,13 +370,16 @@ extern DLLAPI bool silc_debug_hexdump;
  *
  * SOURCE
  */
-#ifdef SILC_DEBUG
+#if defined(SILC_DEBUG)
 #define SILC_LOG_DEBUG(fmt) silc_log_output_debug(__FILE__, \
                                __FUNCTION__, \
                                __LINE__, \
                                silc_format fmt)
+#define SILC_NOT_IMPLEMENTED(string) \
+  SILC_LOG_INFO(("*********** %s: NOT IMPLEMENTED YET", string));
 #else
 #define SILC_LOG_DEBUG(fmt)
+#define SILC_NOT_IMPLEMENTED(string)
 #endif /* SILC_DEBUG */
 /***/
 
@@ -362,7 +410,7 @@ extern DLLAPI bool silc_debug_hexdump;
  *
  * SOURCE
  */
-#ifdef SILC_DEBUG
+#if defined(SILC_DEBUG)
 #define SILC_LOG_HEXDUMP(fmt, data, len) silc_log_output_hexdump(__FILE__, \
                                __FUNCTION__, \
                                __LINE__, \