1 /* 2 ** Logging framework. 3 ** 4 ** This program is distributed under the GNU General Public License, version 2. 5 ** A copy of this license is included with this source. 6 */ 7 8 #ifndef __LOG_H__ 9 #define __LOG_H__ 10 11 #include <stdio.h> 12 13 #define LOG_EINSANE -1 14 #define LOG_ENOMORELOGS -2 15 #define LOG_ECANTOPEN -3 16 #define LOG_ENOTOPEN -4 17 #define LOG_ENOTIMPL -5 18 19 #ifdef _WIN32 20 #define IO_BUFFER_TYPE _IONBF 21 #else 22 #define IO_BUFFER_TYPE _IOLBF 23 #endif 24 25 void log_initialize(void); 26 int log_open_file(FILE *file); 27 int log_open(const char *filename); 28 int log_open_with_buffer(const char *filename, int size); 29 void log_set_level(int log_id, unsigned level); 30 void log_set_trigger(int id, unsigned trigger); 31 int log_set_filename(int id, const char *filename); 32 void log_set_lines_kept (int log_id, unsigned int count); 33 void log_contents (int log_id, char **_contents, unsigned int *_len); 34 int log_set_archive_timestamp(int id, int value); 35 void log_flush(int log_id); 36 void log_reopen(int log_id); 37 void log_close(int log_id); 38 void log_shutdown(void); 39 40 void log_write(int log_id, unsigned priority, const char *cat, const char *func, 41 const char *fmt, ...); 42 void log_write_direct(int log_id, const char *fmt, ...); 43 44 #endif /* __LOG_H__ */ 45