pvAccessCPP  7.1.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
logger.h
1 
7 #ifndef LOGGER_H_
8 #define LOGGER_H_
9 
10 #include <string>
11 
12 #include <compilerDependencies.h>
13 #include <shareLib.h>
14 
15 namespace epics {
16 namespace pvAccess {
17 
18 typedef enum { logLevelAll = 0, logLevelTrace, logLevelDebug, logLevelInfo,
19  logLevelWarn, logLevelError, logLevelFatal, logLevelOff
20  } pvAccessLogLevel;
21 /*
22 ALL
23  The ALL has the lowest possible rank and is intended to turn on all logging.
24 TRACE
25  The TRACE Level designates finer-grained informational events than the DEBUG
26 DEBUG
27  The DEBUG Level designates fine-grained informational events that are most useful to debug an application.
28 INFO
29  The INFO level designates informational messages that highlight the progress of the application at coarse-grained level.
30 WARN
31  The WARN level designates potentially harmful situations.
32 ERROR
33  The ERROR level designates error events that might still allow the application to continue running.
34 FATAL
35  The FATAL level designates very severe error events that will presumably lead the application to abort.
36 OFF
37  The OFF has the highest possible rank and is intended to turn off logging.
38 */
39 
40 
41 epicsShareFunc void pvAccessLog(pvAccessLogLevel level, const char* format, ...) EPICS_PRINTF_STYLE(2, 3);
42 epicsShareFunc void pvAccessSetLogLevel(pvAccessLogLevel level);
43 epicsShareFunc bool pvAccessIsLoggable(pvAccessLogLevel level);
44 
45 #if defined (__GNUC__) && __GNUC__ < 3
46 #define LOG(level, format, ARGS...) pvAccessLog(level, format, ##ARGS)
47 #else
48 #define LOG(level, format, ...) pvAccessLog(level, format, ##__VA_ARGS__)
49 #endif
50 #define SET_LOG_LEVEL(level) pvAccessSetLogLevel(level)
51 #define IS_LOGGABLE(level) pvAccessIsLoggable(level)
52 
53 // EPICS errlog
54 //#define LOG errlogSevPrintf
55 //#define SET_LOG_LEVEL(level) errlogSetSevToLog(level)
56 
57 // none
58 //#define LOG(level, fmt, ...)
59 //#define SET_LOG_LEVEL(level)
60 
61 }
62 }
63 
64 #endif /* LOGGER_H_ */