1 /* 2 * binkleyforce -- unix FTN mailer project 3 * 4 * Copyright (c) 1998-2000 Alexander Belkin, 2:5020/1398.11 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * $Id: logger.h,v 1.1.1.1 2004/09/09 09:52:40 kstepanenkov Exp $ 12 */ 13 14 #ifndef _LOGGER_H_ 15 #define _LOGGER_H_ 16 17 enum { LOG_MODE_FILE, LOG_MODE_SYSLOG, LOG_MODE_MIXED }; 18 19 enum { LOG_FILE_DAEMON, LOG_FILE_SESSION, LOG_FILE_DEBUG, LOG_FILE_HISTORY }; 20 21 enum { 22 LOG_EMERG = 0, /* system is unusable */ 23 LOG_ALERT = 1, /* action must be taken immediately */ 24 LOG_CRIT = 2, /* critical conditions */ 25 LOG_ERR = 3, /* error conditions */ 26 LOG_WARNING = 4, /* warning conditions */ 27 LOG_NOTICE = 5, /* normal but significant condition */ 28 LOG_INFO = 6, /* informational */ 29 LOG_DEBUG = 7 /* debug-level messages */ 30 }; 31 32 #ifdef DEBUG 33 # define D_CONFIG 0x0000001L 34 # define D_OVERRIDE 0x0000002L 35 # define D_EVENT 0x0000004L 36 # define D_NODELIST 0x0000008L 37 # define D_OUTBOUND 0x0000010L 38 # define D_INFO 0x0000020L 39 # define D_HSHAKE 0x0000040L 40 # define D_TTYIO 0x0000080L 41 # define D_MODEM 0x0000100L 42 # define D_PROT 0x0000200L 43 # define D_FREQ 0x0000400L 44 # define D_STATEM 0x0000800L 45 # define D_DAEMON 0x0001000L 46 # define D_FULL 0xfffffffL 47 #endif 48 49 #ifdef DEBUG 50 # define DEB(what) debug what 51 #else 52 # define DEB(what) 53 #endif 54 55 const char *log_getfilename(int whatfor); 56 bool log_isopened(void); 57 void log_setident(const char *ident); 58 int log_open(const char *logname, const char *ext, const char *tty); 59 int log_close(void); 60 int log_reopen(const char *logname, const char *ext, const char *tty); 61 int bf_log(const char *s, ...); 62 int logerr(const char *s, ...); 63 64 #ifdef DEBUG 65 void debug_setlevel(long newlevel, bool logit); 66 bool debug_isopened(void); 67 void debug_setfilename(const char *debugname); 68 int debug_parsestring(char *str, unsigned long *deblevel); 69 int debug_open(const char *debugname); 70 int debug_close(void); 71 int debug(unsigned long what, const char *str, ...); 72 #endif 73 74 #endif 75