2018-08-02 12:59:06 +00:00
|
|
|
|
#include "../list/list_expand.h"
|
|
|
|
|
#include <string.h>
|
2018-02-18 06:32:58 +00:00
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
|
|
#ifndef ERROR_H
|
|
|
|
|
#define ERROR_H
|
|
|
|
|
|
|
|
|
|
#define HIGH 0x3
|
|
|
|
|
#define STANDARD 0x2
|
2018-08-02 12:59:06 +00:00
|
|
|
|
#define LOW 0x1
|
2018-02-18 06:32:58 +00:00
|
|
|
|
|
|
|
|
|
typedef struct Info{
|
|
|
|
|
char *head;
|
|
|
|
|
char *body;
|
|
|
|
|
}Info;
|
|
|
|
|
|
|
|
|
|
typedef struct Error{
|
|
|
|
|
unsigned int type;
|
2018-08-02 12:59:06 +00:00
|
|
|
|
int priority;
|
|
|
|
|
Info *p_info;
|
2018-02-18 06:32:58 +00:00
|
|
|
|
time_t time;
|
|
|
|
|
}Error;
|
|
|
|
|
|
|
|
|
|
typedef struct Notice{
|
|
|
|
|
unsigned int type;
|
2018-08-02 12:59:06 +00:00
|
|
|
|
Info *p_info;
|
2018-02-18 06:32:58 +00:00
|
|
|
|
time_t time;
|
|
|
|
|
}Notice;
|
|
|
|
|
|
|
|
|
|
typedef struct Log{
|
|
|
|
|
FILE *fp;
|
|
|
|
|
int if_enable;
|
|
|
|
|
unsigned long int id;
|
|
|
|
|
}Log;
|
|
|
|
|
|
2018-08-02 12:59:06 +00:00
|
|
|
|
Log logfile;
|
2018-02-18 11:22:12 +00:00
|
|
|
|
List *error_list = NULL;
|
2018-08-02 12:59:06 +00:00
|
|
|
|
List *notice_list = NULL;
|
2018-02-18 11:22:12 +00:00
|
|
|
|
int if_error = 0;
|
|
|
|
|
|
2018-08-02 12:59:06 +00:00
|
|
|
|
int initErrorSystem(void);
|
|
|
|
|
|
|
|
|
|
int setLogDirectory(const char *path);
|
|
|
|
|
int closeLogDirectory(void);
|
|
|
|
|
int loadFromFile(FILE *fp,char* number);
|
|
|
|
|
|
|
|
|
|
int pushInfo(Info *p_info, const char *head,const char *body);
|
|
|
|
|
int pushError(unsigned int type, int pri, Info *p_info);
|
|
|
|
|
int pushNotice(unsigned int type, Info *p_info);
|
|
|
|
|
|
|
|
|
|
//Ϊ<><CEAA>֤<EFBFBD><D6A4><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD><D0BA><EFBFBD>
|
|
|
|
|
static int saveError(Error *p_error);
|
|
|
|
|
static int saveNotice(Notice *p_notice);
|
|
|
|
|
|
|
|
|
|
#endif
|