1#ifndef _LOG_MSG_ 2#define _LOG_MSG_ 3 4#ifndef OK 5#define OK 0 6#endif 7 8#define LOG_FILE "/var/log/server.log" 9#define HDD_LOG_FILE "/share/hdd/conf/server.log" 10#define FLASH_LOG_FILE "/share/flash/conf/server.log" 11#define LOG_SEC "[LOG]" 12 13#define LOG_LEVEL_0 0 /* Log all */ 14#define LOG_LEVEL_1 1 /* Fatal error (H/W error) */ 15#define LOG_LEVEL_2 2 /* Error */ 16#define LOG_LEVEL_3 3 /* Warning */ 17#define LOG_LEVEL_4 4 /* Status report */ 18#define LOG_LEVEL_5 5 /* Debug */ 19#define LOG_LEVEL_N -1 /* Do not log */ 20int LOG_LogMsgFLASH(char *msg); 21int LOG_LogMsgHDD(char *msg); 22 23int LOG_LogMsg(char *task, int level, char *msg); 24int LOG_ClearLog(void); 25long LOG_GetLogSize(void); 26long LOG_GetLog(long start, char *buf, long size, int level); 27 28typedef struct s_notify { 29 char fmAddr[64]; /* From E-mail address */ 30 char toAddr[3][64]; /* 3 to E-mail address */ 31 char subject[64]; /* Subject string */ 32 int log_level; /* LOG_LEVEL_0~5=Enable, LOG_LEVEL_N=Disable */ 33 int not_level; /* LOG_LEVEL_0~5=Enable, LOG_LEVEL_N=Disable */ 34 /* default=LOG_LEVEL_1. Messages with the level number */ 35 /* are smaller than or equal to this value will be notified. */ 36} s_notify; 37 38int LOG_SetNotify(s_notify *conf); 39int LOG_GetNotify(s_notify *conf); 40int LOG_MailNotify(char *to_addr, char *subject, char *msg); 41 42// configuration in /etc/CGI_ds.conf 43// [LOG] 44// fm= # from e-mail address 45// 1to= # to e-mail address 1 46// 2to= # to e-mail address 2 47// 3to= # to e-mail address 3 48// sub= # subject 49// log= # log level (enable/disable) 50// not= # notify level 51 52#endif 53