pvAccessCPP
utils/pv/logger.h
00001 
00007 #ifndef LOGGER_H_
00008 #define LOGGER_H_
00009 
00010 #include <string>
00011 
00012 #include <compilerDependencies.h>
00013 #include <shareLib.h>
00014 
00015 namespace epics {
00016 namespace pvAccess {
00017 
00018 typedef enum { logLevelAll = 0, logLevelTrace, logLevelDebug, logLevelInfo,
00019                logLevelWarn, logLevelError, logLevelFatal, logLevelOff
00020              } pvAccessLogLevel;
00021 /*
00022 ALL
00023     The ALL has the lowest possible rank and is intended to turn on all logging.
00024 TRACE
00025     The TRACE Level designates finer-grained informational events than the DEBUG
00026 DEBUG
00027     The DEBUG Level designates fine-grained informational events that are most useful to debug an application.
00028 INFO
00029     The INFO level designates informational messages that highlight the progress of the application at coarse-grained level.
00030 WARN
00031     The WARN level designates potentially harmful situations.
00032 ERROR
00033     The ERROR level designates error events that might still allow the application to continue running.
00034 FATAL
00035     The FATAL level designates very severe error events that will presumably lead the application to abort.
00036 OFF
00037     The OFF has the highest possible rank and is intended to turn off logging.
00038 */
00039 
00040 
00041 epicsShareFunc void pvAccessLog(pvAccessLogLevel level, const char* format, ...) EPICS_PRINTF_STYLE(2, 3);
00042 epicsShareFunc void pvAccessSetLogLevel(pvAccessLogLevel level);
00043 epicsShareFunc bool pvAccessIsLoggable(pvAccessLogLevel level);
00044 
00045 #if defined (__GNUC__) && __GNUC__ < 3
00046 #define LOG(level, format, ARGS...) pvAccessLog(level, format, ##ARGS)
00047 #else
00048 #define LOG(level, format, ...) pvAccessLog(level, format, ##__VA_ARGS__)
00049 #endif
00050 #define SET_LOG_LEVEL(level) pvAccessSetLogLevel(level)
00051 #define IS_LOGGABLE(level) pvAccessIsLoggable(level)
00052 
00053 // EPICS errlog
00054 //#define LOG errlogSevPrintf
00055 //#define SET_LOG_LEVEL(level) errlogSetSevToLog(level)
00056 
00057 // none
00058 //#define LOG(level, fmt, ...)
00059 //#define SET_LOG_LEVEL(level)
00060 
00069 epicsShareFunc void createFileLogger( std::string const & fname );
00070 
00071 }
00072 }
00073 
00074 #endif /* LOGGER_H_ */
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator