Made all sub systems for logging lower case

Log filtering is now based on an array of severitys per subsystem
Added a LogIS call which takes an integer for the subsystem
Added a LogTS call which allows to specify a user supplied time stamp
This commit is contained in:
2016-03-08 11:36:29 +01:00
parent 40382b2b8c
commit 5a388ab741
6 changed files with 347 additions and 152 deletions

42
logv2.h
View File

@ -12,6 +12,9 @@
#define __LOGV2
#include <stdarg.h>
/*
severity codes
*/
#define FATAL 1
#define ERROR 2
#define WARN 3
@ -20,6 +23,23 @@
#define DEBUG 6
#define INVALID 7 /* internal olny, do not use, means invalid severity passed */
/*
subsystem codes
*/
#define SSYS 0
#define SCOM 1
#define SASQIO 2
#define SIO 3
#define SDEV 4
#define SPAR 5
#define SNOTIFY 6
#define SHISTORY 7
#define SINVALID 8
#define MAXSUB 7
/* write a log message
* \param severity The message severity. Must be one of the defines given above
* \param subsystem The subsystem reporting the log messages
@ -28,6 +48,24 @@
*/
void Log(unsigned int severity, const char *subsystem,const char *format,...);
/* write a log message, but with the subsystem specified by an integer
* \param severity The message severity. Must be one of the defines given above
* \param subsystem The subsystem reporting the log messages
* \param format The format string for the message
* \param ... The data to format
*/
void LogIS(unsigned int severity, unsigned int subsystem,const char *format,...);
/* write a log message, but with the subsystem specified by an integer and user supplied timestamp
* \param timeStamp A user supplied timestamp
* \param severity The message severity. Must be one of the defines given above
* \param subsystem The subsystem reporting the log messages
* \param format The format string for the message
* \param ... The data to format
*/
void LogTS(const char *timeStamp, unsigned int severity, unsigned int subsystem,const char *format,...);
/* The callback functio which is called by the logging system on log events
* \param severity The message severity
* \param timeStamp The time stamp of the log message
@ -82,4 +120,8 @@ void LogClose(void *data);
void formatSeverity(unsigned int severity,
char *buffer, unsigned int bufferLength);
extern unsigned int logEnabledArray[];
#define logEnabled(subsystem,severity) (severity <= logEnabledArray[subsystem])
#endif