Flyby SDK v1.0.2
Loading...
Searching...
No Matches
flyby::Logger Class Reference

The base logger class. More...

#include <log.h>

Public Member Functions

 Logger (const std::string &filepath)
 Constructs a logger that writes to a file.
 Logger (std::shared_ptr< Publisher > publisher)
 Constructs a logger that writes to the message bus.
 Logger (std::shared_ptr< Publisher > publisher, const std::string &filepath)
 Constructs a logger that writes to the message bus and to a file.
void set_stdout (bool allow_stdout)
 Allow/stop the logger from outputting to stdout.
void set_log_level (LogLevel level)
 Sets the current log level.
virtual void log (LogLevel level, const std::string &message)
 Logs a message at a log level.
virtual void log (LogLevel level, const std::string &tag, const std::string &message)
 Logs a message at a log level.
virtual void d (const std::string &message)
 Logs a message at the debug log level.
virtual void d (const std::string &tag, const std::string &message)
 Logs a message at the debug log level.
virtual void i (const std::string &message)
 Logs a message at the info log level.
virtual void i (const std::string &tag, const std::string &message)
 Logs a message at the info log level.
virtual void w (const std::string &message)
 Logs a message at the warning log level.
virtual void w (const std::string &tag, const std::string &message)
 Logs a message at the warning log level.
virtual void e (const std::string &message)
 Logs a message at the error log level.
virtual void e (const std::string &tag, const std::string &message)
 Logs a message at the error log level.

Protected Member Functions

 Logger ()
 Constructs an empty logger.

Detailed Description

The base logger class.

Constructor & Destructor Documentation

◆ Logger() [1/4]

flyby::Logger::Logger ( const std::string & filepath)
explicit

Constructs a logger that writes to a file.

Parameters
filepath- The path where the log should be stored

◆ Logger() [2/4]

flyby::Logger::Logger ( std::shared_ptr< Publisher > publisher)
explicit

Constructs a logger that writes to the message bus.

Parameters
publisher- The message bus publisher

◆ Logger() [3/4]

flyby::Logger::Logger ( std::shared_ptr< Publisher > publisher,
const std::string & filepath )
explicit

Constructs a logger that writes to the message bus and to a file.

Parameters
publisher- The message bus publisher
filepath- The path where the log should be stored

◆ Logger() [4/4]

flyby::Logger::Logger ( )
protected

Constructs an empty logger.

Used for mocking and testing

Member Function Documentation

◆ d() [1/2]

virtual void flyby::Logger::d ( const std::string & message)
virtual

Logs a message at the debug log level.

Parameters
message- The message to log

◆ d() [2/2]

virtual void flyby::Logger::d ( const std::string & tag,
const std::string & message )
virtual

Logs a message at the debug log level.

Parameters
tag- The tag of the log
message- The message to log

◆ e() [1/2]

virtual void flyby::Logger::e ( const std::string & message)
virtual

Logs a message at the error log level.

Parameters
message- The message to log

◆ e() [2/2]

virtual void flyby::Logger::e ( const std::string & tag,
const std::string & message )
virtual

Logs a message at the error log level.

Parameters
tag- The tag of the log
message- The message to log

◆ i() [1/2]

virtual void flyby::Logger::i ( const std::string & message)
virtual

Logs a message at the info log level.

Parameters
message- The message to log

◆ i() [2/2]

virtual void flyby::Logger::i ( const std::string & tag,
const std::string & message )
virtual

Logs a message at the info log level.

Parameters
tag- The tag of the log
message- The message to log

◆ log() [1/2]

virtual void flyby::Logger::log ( LogLevel level,
const std::string & message )
virtual

Logs a message at a log level.

Parameters
level- The log level
message- The message to log

◆ log() [2/2]

virtual void flyby::Logger::log ( LogLevel level,
const std::string & tag,
const std::string & message )
virtual

Logs a message at a log level.

Parameters
level- The log level
tag- The tag of the log
message- The message to log

◆ set_log_level()

void flyby::Logger::set_log_level ( LogLevel level)

Sets the current log level.

Parameters
level- The log level

◆ set_stdout()

void flyby::Logger::set_stdout ( bool allow_stdout)

Allow/stop the logger from outputting to stdout.

Parameters
allow_stdout- if set to true, logger will output to stdout

◆ w() [1/2]

virtual void flyby::Logger::w ( const std::string & message)
virtual

Logs a message at the warning log level.

Parameters
message- The message to log

◆ w() [2/2]

virtual void flyby::Logger::w ( const std::string & tag,
const std::string & message )
virtual

Logs a message at the warning log level.

Parameters
tag- The tag of the log
message- The message to log

The documentation for this class was generated from the following file:
  • include/flyby/util/log.h