5 LOG_ITEM_TARGET, /* channel, query, .. */
9 typedef char *(*COLORIZE_FUNC)(const char *str);
11 typedef struct _LOG_REC LOG_REC;
12 typedef struct _LOG_ITEM_REC LOG_ITEM_REC;
14 struct _LOG_ITEM_REC {
21 char *fname; /* file name, in strftime() format */
22 char *real_fname; /* the current expanded file name */
23 int handle; /* file handle */
26 int level; /* log only these levels */
27 GSList *items; /* log only on these items */
29 time_t last; /* when last message was written */
30 COLORIZE_FUNC colorizer;
32 unsigned int autoopen:1; /* automatically start logging at startup */
33 unsigned int failed:1; /* opening log failed last time */
34 unsigned int temp:1; /* don't save this to config file */
39 /* Create log record - you still need to call log_update() to actually add it
41 LOG_REC *log_create_rec(const char *fname, int level);
42 void log_update(LOG_REC *log);
43 void log_close(LOG_REC *log);
44 LOG_REC *log_find(const char *fname);
46 void log_item_add(LOG_REC *log, int type, const char *name,
47 const char *servertag);
48 void log_item_destroy(LOG_REC *log, LOG_ITEM_REC *item);
49 LOG_ITEM_REC *log_item_find(LOG_REC *log, int type, const char *item,
50 const char *servertag);
52 void log_file_write(const char *server_tag, const char *item, int level,
53 const char *str, int no_fallbacks);
54 void log_write_rec(LOG_REC *log, const char *str, int level);
56 int log_start_logging(LOG_REC *log);
57 void log_stop_logging(LOG_REC *log);
60 void log_deinit(void);