mavtables  0.2.1
MAVLink router and firewall.
Static Public Member Functions | List of all members
Logger Class Reference

#include <Logger.hpp>

Collaboration diagram for Logger:
Collaboration graph

Static Public Member Functions

static void log (std::string message)
 
static void log (unsigned int level, std::string message)
 
static void level (unsigned int level)
 
static unsigned int level ()
 

Detailed Description

A global static logger for use by all of mavtables.

Note
Only supports writing to stdout.

Definition at line 30 of file Logger.hpp.

Member Function Documentation

◆ level() [1/2]

void Logger::level ( unsigned int  level)
static

Set the logging level.

A higher level indicates a higher verbosity of logging. A level of 0 will completely disable logging.

Parameters
levelThe new logging level, valid values are 0 to 65535.

Definition at line 83 of file Logger.cpp.

References level().

Here is the call graph for this function:

◆ level() [2/2]

unsigned int Logger::level ( )
static

Get the logging level.

Note
It is recommended to check the level before constructing a log message if the message is expensive to construct.
Returns
The current logging level.

Definition at line 96 of file Logger.cpp.

Here is the caller graph for this function:

◆ log() [1/2]

void Logger::log ( std::string  message)
static

Log a message with timestamp (at level 1).

This will log a message with the current date and time as the timestamp if the loglevel is set to at least 1.

Note
This is the only method (along with log(unsigned int, std::string)) that is threadsafe.
Parameters
messageThe message to log.

Definition at line 37 of file Logger.cpp.

Here is the caller graph for this function:

◆ log() [2/2]

void Logger::log ( unsigned int  level,
std::string  message 
)
static

Log a message with timestamp at the given level.

This will log a message with the current date and time as the timestamp if the loglevel is at least level.

Note
This is the only method (along with log(std::string)) that is threadsafe.
Parameters
levelThe level to log the message at. If the logger's level is lower than this, the message will be discarded. The valid range is 1 to 65535, a value of 0 will be corrected to 1.
messageThe message to log.
Remarks
Threadsafe (locking).

Definition at line 58 of file Logger.cpp.

References level().

Here is the call graph for this function:

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