5 Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
7 Copyright (C) 1997 - 2000 Pekka Riikonen
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
32 /* Log type name structure. */
38 /* Default log filenames */
39 #define SILC_LOG_FILE_INFO "silcd.log"
40 #define SILC_LOG_FILE_WARNING "silcd_error.log"
41 #define SILC_LOG_FILE_ERROR SILC_LOG_FILE_WARNING
42 #define SILC_LOG_FILE_FATAL SILC_LOG_FILE_WARNING
44 /* Log files. Set by silc_log_set_logfiles. */
45 extern char *log_info_file;
46 extern char *log_warning_file;
47 extern char *log_error_file;
48 extern char *log_fatal_file;
49 extern unsigned int log_info_size;
50 extern unsigned int log_warning_size;
51 extern unsigned int log_error_size;
52 extern unsigned int log_fatal_size;
55 #define SILC_LOG_INFO(fmt) silc_log_output(log_info_file, \
59 #define SILC_LOG_WARNING(fmt) (silc_log_output(log_warning_file, \
63 #define SILC_LOG_ERROR(fmt) (silc_log_output(log_error_file, \
67 #define SILC_LOG_FATAL(fmt) (silc_log_output(log_fatal_file, \
72 /* Debug macro is a bit different from other logging macros and it
73 is compiled in only if debugging is enabled. */
75 #define SILC_LOG_DEBUG(fmt) (silc_log_output_debug(__FILE__, \
79 #define SILC_LOG_HEXDUMP(fmt, data, len) \
80 (silc_log_output_hexdump(__FILE__, \
86 #define SILC_LOG_DEBUG(fmt)
87 #define SILC_LOG_HEXDUMP(fmt, data, len)
91 char *silc_log_format(char *fmt, ...);
92 void silc_log_output_debug(char *file, char *function,
93 int line, char *string);
94 void silc_log_output(const char *filename, unsigned int maxsize,
95 SilcLogType type, char *string);
96 void silc_log_output_hexdump(char *file, char *function,
97 int line, void *data_in,
98 unsigned int len, char *string);
99 void silc_log_set_files(char *info, unsigned int info_size,
100 char *warning, unsigned int warning_size,
101 char *error, unsigned int error_size,
102 char *fatal, unsigned int fatal_size);