/* Set TRUE/FALSE to enable/disable debugging */
extern int silc_debug;
+extern char *silc_debug_string;
/* SILC Log types */
typedef enum {
/* Debug hexdump function callback. */
typedef void (*SilcDebugHexdumpCb)(char *file, char *function,
int line, unsigned char *data,
- unsigned int data_len, char *message);
+ uint32 data_len, char *message);
/* Default log filenames */
#define SILC_LOG_FILE_INFO "silcd.log"
extern char *log_warning_file;
extern char *log_error_file;
extern char *log_fatal_file;
-extern unsigned int log_info_size;
-extern unsigned int log_warning_size;
-extern unsigned int log_error_size;
-extern unsigned int log_fatal_size;
+extern uint32 log_info_size;
+extern uint32 log_warning_size;
+extern uint32 log_error_size;
+extern uint32 log_fatal_size;
+
+#ifdef WIN32
+#define __FUNCTION__ ""
+#endif
/* Log macros. */
#define SILC_LOG_INFO(fmt) (silc_log_output(log_info_file, \
log_info_size, \
SILC_LOG_INFO, \
- silc_log_format fmt))
+ silc_format fmt))
#define SILC_LOG_WARNING(fmt) (silc_log_output(log_warning_file, \
log_warning_size, \
SILC_LOG_WARNING, \
- silc_log_format fmt))
+ silc_format fmt))
#define SILC_LOG_ERROR(fmt) (silc_log_output(log_error_file, \
log_error_size, \
SILC_LOG_ERROR, \
- silc_log_format fmt))
+ silc_format fmt))
#define SILC_LOG_FATAL(fmt) (silc_log_output(log_fatal_file, \
log_fatal_size, \
SILC_LOG_FATAL, \
- silc_log_format fmt))
+ silc_format fmt))
/* Debug macro is a bit different from other logging macros and it
is compiled in only if debugging is enabled. */
#define SILC_LOG_DEBUG(fmt) (silc_log_output_debug(__FILE__, \
__FUNCTION__, \
__LINE__, \
- silc_log_format fmt))
+ silc_format fmt))
#define SILC_LOG_HEXDUMP(fmt, data, len) \
(silc_log_output_hexdump(__FILE__, \
__FUNCTION__, \
__LINE__, \
(data), (len), \
- silc_log_format fmt))
+ silc_format fmt))
#else
#define SILC_LOG_DEBUG(fmt)
#define SILC_LOG_HEXDUMP(fmt, data, len)
#endif
/* Prototypes */
-char *silc_log_format(char *fmt, ...);
void silc_log_output_debug(char *file, char *function,
int line, char *string);
-void silc_log_output(const char *filename, unsigned int maxsize,
+void silc_log_output(const char *filename, uint32 maxsize,
SilcLogType type, char *string);
void silc_log_output_hexdump(char *file, char *function,
int line, void *data_in,
- unsigned int len, char *string);
-void silc_log_set_files(char *info, unsigned int info_size,
- char *warning, unsigned int warning_size,
- char *error, unsigned int error_size,
- char *fatal, unsigned int fatal_size);
+ uint32 len, char *string);
+void silc_log_set_files(char *info, uint32 info_size,
+ char *warning, uint32 warning_size,
+ char *error, uint32 error_size,
+ char *fatal, uint32 fatal_size);
void silc_log_set_callbacks(SilcLogCb info, SilcLogCb warning,
SilcLogCb error, SilcLogCb fatal);
void silc_log_reset_callbacks();
void silc_log_set_debug_callbacks(SilcDebugCb debug,
SilcDebugHexdumpCb debug_hexdump);
void silc_log_reset_debug_callbacks();
+void silc_log_set_debug_string(const char *debug_string);
#endif