4 #define LOG_DIR_CREATE_MODE 0700
7 LOG_ITEM_TARGET, /* channel, query, .. */
11 typedef char *(*COLORIZE_FUNC)(const char *str);
13 typedef struct _LOG_REC LOG_REC;
14 typedef struct _LOG_ITEM_REC LOG_ITEM_REC;
16 struct _LOG_ITEM_REC {
23 char *fname; /* file name, in strftime() format */
24 char *real_fname; /* the current expanded file name */
25 int handle; /* file handle */
28 int level; /* log only these levels */
29 GSList *items; /* log only on these items */
31 time_t last; /* when last message was written */
32 COLORIZE_FUNC colorizer;
34 unsigned int autoopen:1; /* automatically start logging at startup */
35 unsigned int failed:1; /* opening log failed last time */
36 unsigned int temp:1; /* don't save this to config file */
41 /* Create log record - you still need to call log_update() to actually add it
43 LOG_REC *log_create_rec(const char *fname, int level);
44 void log_update(LOG_REC *log);
45 void log_close(LOG_REC *log);
46 LOG_REC *log_find(const char *fname);
48 void log_item_add(LOG_REC *log, int type, const char *name,
49 const char *servertag);
50 void log_item_destroy(LOG_REC *log, LOG_ITEM_REC *item);
51 LOG_ITEM_REC *log_item_find(LOG_REC *log, int type, const char *item,
52 const char *servertag);
54 void log_file_write(const char *server_tag, const char *item, int level,
55 const char *str, int no_fallbacks);
56 void log_write_rec(LOG_REC *log, const char *str, int level);
58 int log_start_logging(LOG_REC *log);
59 void log_stop_logging(LOG_REC *log);
62 void log_deinit(void);