Added functions skygw_log_enable(logfile_id_t) and skygw_log_disable(logfile_id_t) to Log manager API. By calling them log writing to any of predefined log files can be switched on or off.

Added simple test to testlog.c
This commit is contained in:
vraatikka
2013-08-08 23:38:00 +03:00
parent 1ab8420e91
commit 0ad25ba3ab
4 changed files with 247 additions and 20 deletions

View File

@ -23,16 +23,15 @@ typedef struct fnames_conf_st fnames_conf_t;
typedef struct logmanager_st logmanager_t;
typedef enum {
LOGFILE_TRACE = 0,
LOGFILE_TRACE = 1,
LOGFILE_FIRST = LOGFILE_TRACE,
LOGFILE_MESSAGE,
LOGFILE_ERROR,
LOGFILE_MESSAGE = 2,
LOGFILE_ERROR = 4,
LOGFILE_LAST = LOGFILE_ERROR
} logfile_id_t;
typedef enum { FILEWRITER_INIT, FILEWRITER_RUN, FILEWRITER_DONE }
filewriter_state_t;
typedef enum { LOGFILE_INIT, LOGFILE_OPENED, LOGFILE_DONE } logfile_state_t;
/**
* UNINIT means zeroed memory buffer allocated for the struct.
@ -56,7 +55,8 @@ void skygw_log_done(void);
int skygw_log_write(logfile_id_t id, char* format, ...);
int skygw_log_flush(logfile_id_t id);
int skygw_log_write_flush(logfile_id_t id, char* format, ...);
int skygw_log_enable(logfile_id_t id);
int skygw_log_disable(logfile_id_t id);
EXTERN_C_BLOCK_END