EX-Display
EX-Display
Loading...
Searching...
No Matches
Logger Class Reference

Class to enable simple logging to a Stream object with different log levels This enables embedding permanent error, warn, info, and debug messages in the software, with the user defining the log level at compile time if more diagnostics are required. More...

#include <Logger.h>

Collaboration diagram for Logger:
[legend]

Public Member Functions

 Logger (Stream *outputStream)
 Constructor for the logger.
 
void setLogLevel (LogLevel logLevel)
 Set the log level.
 
LogLevel getLogLevel ()
 Get the current log level.
 
void log (LogLevel logLevel, const char *format,...)
 Log a message for the specified log level.
 

Private Attributes

Stream_outputStream
 
LogLevel _currentLevel
 

Detailed Description

Class to enable simple logging to a Stream object with different log levels This enables embedding permanent error, warn, info, and debug messages in the software, with the user defining the log level at compile time if more diagnostics are required.

Constructor & Destructor Documentation

◆ Logger()

Logger::Logger ( Stream outputStream)

Constructor for the logger.

Parameters
outputStreamPointer to a Stream instance to output log messages to (eg. Logger(&Serial);)

Member Function Documentation

◆ getLogLevel()

LogLevel Logger::getLogLevel ( )

Get the current log level.

Returns
LogLevel
Here is the caller graph for this function:

◆ log()

void Logger::log ( LogLevel  logLevel,
const char *  format,
  ... 
)

Log a message for the specified log level.

Parameters
logLevelValid LogLevel
formatFormat to apply to the message
Here is the call graph for this function:

◆ setLogLevel()

void Logger::setLogLevel ( LogLevel  logLevel)

Set the log level.

Parameters
logLevelValid LogLevel
Here is the caller graph for this function:

Member Data Documentation

◆ _currentLevel

LogLevel Logger::_currentLevel
private

◆ _outputStream

Stream* Logger::_outputStream
private

The documentation for this class was generated from the following files: