44 #ifndef INCLUDE_OLA_LOGGING_H_
45 #define INCLUDE_OLA_LOGGING_H_
57 #define OLA_LOG(level) (level <= ola::LogLevel()) && \
58 ola::LogLine(__FILE__, __LINE__, level).stream()
65 #define OLA_FATAL OLA_LOG(ola::OLA_LOG_FATAL)
73 #define OLA_WARN OLA_LOG(ola::OLA_LOG_WARN)
81 #define OLA_INFO OLA_LOG(ola::OLA_LOG_INFO)
89 #define OLA_DEBUG OLA_LOG(ola::OLA_LOG_DEBUG)
138 virtual void Write(
log_level level,
const std::string &log_line) = 0;
165 virtual bool Init() = 0;
171 virtual void Write(
log_level level,
const std::string &log_line) = 0;
178 class WindowsSyslogDestination :
public SyslogDestination {
188 void Write(
log_level level,
const std::string &log_line);
190 typedef void* WindowsLogHandle;
191 WindowsLogHandle m_eventlog;
220 LogLine(
const char *file,
int line,
log_level level);
224 std::ostream &stream() {
return m_stream; }
227 std::ostringstream m_stream;
228 unsigned int m_prefix_length;
278 #endif // INCLUDE_OLA_LOGGING_H_
log_output
The destination to write log messages to.
Definition: Logging.h:116
log_level
The OLA log levels. This controls the verbosity of logging. Each level also includes those below it...
Definition: Logging.h:98
Definition: Logging.h:103
void Write(log_level level, const std::string &log_line)
Write a line to syslog.
Definition: Logging.cpp:236
Definition: Logging.h:102
virtual void Write(log_level level, const std::string &log_line)=0
Write a line to the system logger.
void SetLogLevel(log_level level)
Set the logging level.
Definition: Logging.cpp:70
log_level LogLevel()
Fetch the current level of logging.
Definition: Logging.h:247
void IncrementLogLevel()
Increment the log level by one. The log level wraps to OLA_LOG_NONE.
Definition: Logging.cpp:75
A SyslogDestination that writes to Unix syslog.
Definition: Logging.h:197
Definition: Logging.h:117
An abstract base of LogDestination that writes to syslog.
Definition: Logging.h:155
virtual void Write(log_level level, const std::string &log_line)=0
An abstract function for writing to your log destination.
virtual ~SyslogDestination()
Destructor.
Definition: Logging.h:160
Definition: Logging.h:100
virtual ~LogDestination()
Destructor.
Definition: Logging.h:131
bool InitLogging(log_level level, log_output output)
Initialize the OLA logging system.
Definition: Logging.cpp:117
Definition: Logging.h:101
A LogDestination that writes to stderr.
Definition: Logging.h:144
virtual bool Init()=0
Initialize the SyslogDestination.
log_level logging_level
Application global logging level.
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
bool InitLoggingFromFlags()
Initialize the OLA logging system from flags.
Definition: Logging.cpp:82
Definition: Logging.h:118
bool Init()
Initialize the UnixSyslogDestination.
Definition: Logging.cpp:232
The base class for log destinations.
Definition: Logging.h:126
void Write(log_level level, const std::string &log_line)
Writes a messages out to stderr.
Definition: Logging.cpp:184