Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
bitpit::Logger Class Reference

Message logger. More...

Inheritance diagram for bitpit::Logger:
Inheritance graph
[legend]
Collaboration diagram for bitpit::Logger:
Collaboration graph
[legend]

Public Member Functions

void disable (log::Level=log::Level::LEVEL_CRITICAL)
 
void disableConsole (log::Level=log::Level::LEVEL_CRITICAL)
 
void disableFile (log::Level=log::Level::LEVEL_CRITICAL)
 
log::Level getConsoleVerbosity ()
 
std::string getContext ()
 
log::Level getDefaultSeverity ()
 
log::Visibility getDefaultVisibility ()
 
log::Level getFileVerbosity ()
 
int getIndentation ()
 
std::string getName () const
 
log::Priority getPriority ()
 
log::Visibility getVisibility ()
 
bool isConsoleTimestampEnabled () const
 
bool isFileTimestampEnabled () const
 
void print (const std::string &message)
 
void print (const std::string &message, log::Level severity)
 
void print (const std::string &message, log::Level severity, log::Visibility visibility)
 
void print (const std::string &message, log::Visibility visibility)
 
template<typename T >
void print (const T &value, log::Level severity, log::Visibility visibility)
 
void println (const std::string &message)
 
void println (const std::string &message, const log::Level severity, log::Visibility visibility)
 
void println (const std::string &message, log::Level severity)
 
void println (const std::string &message, log::Visibility visibility)
 
void setConsoleTimestampEnabled (bool enabled)
 
void setConsoleVerbosity (log::Level threshold)
 
void setContext (const std::string &context)
 
void setDefaultSeverity (log::Level severity)
 
void setDefaultVisibility (log::Visibility visibility)
 
void setFileTimestampEnabled (bool enabled)
 
void setFileVerbosity (log::Level threshold)
 
void setIndentation (int delta)
 
void setPriority (log::Priority priority)
 
void setTimestampEnabled (bool enabled)
 
void setVerbosities (log::Level threshold)
 
void setVisibility (log::Visibility visibility)
 

Friends

class LoggerManager
 

Detailed Description

Message logger.

This class implements a message logger. The logger allows to write log messages both on the console and on a log file. The verbosity of the logger can be set for the console and the file independently.

Definition at line 142 of file logger.hpp.

Member Function Documentation

◆ disable()

void bitpit::Logger::disable ( log::Level level = log::Level::LEVEL_CRITICAL)

Provides an overriding verbosity level which takes precedence over the logger’s own level.

When the need arises to temporarily throttle logging output down across the whole application, this function can be useful. Its effect is to disable all logging calls of severity level and below, so that if you call it with a value of INFO, then all INFO and DEBUG events would be discarded, whereas those of severity WARNING and above would be processed according to the logger’s effective level.

If the a NOTSET level is specified, it effectively removes this overriding level, so that logging output again depends on the effective verbosity level of the logger.

Parameters
levelis the overriding verbosity level

Definition at line 482 of file logger.cpp.

◆ disableConsole()

void bitpit::Logger::disableConsole ( log::Level level = log::Level::LEVEL_CRITICAL)

Provides an overriding console verbosity level which takes precedence over the logger’s own level.

When the need arises to temporarily throttle logging output down across the whole application, this function can be useful. Its effect is to disable all logging calls of severity level and below, so that if you call it with a value of INFO, then all INFO and DEBUG events would be discarded, whereas those of severity WARNING and above would be processed according to the logger’s effective level.

If the NOTSET level is specified, it effectively removes this overriding level, so that logging output again depends on the effective verbosity level of the logger.

Parameters
levelis the overriding verbosity level

Definition at line 505 of file logger.cpp.

◆ disableFile()

void bitpit::Logger::disableFile ( log::Level level = log::Level::LEVEL_CRITICAL)

Provides an overriding file verbosity level which takes precedence over the logger’s own level.

When the need arises to temporarily throttle logging output down across the whole application, this function can be useful. Its effect is to disable all logging calls of severity level and below, so that if you call it with a value of INFO, then all INFO and DEBUG events would be discarded, whereas those of severity WARNING and above would be processed according to the logger’s effective level.

If the NOTSET level is specified, it effectively removes this overriding level, so that logging output again depends on the effective verbosity level of the logger.

Parameters
levelis the overriding verbosity level

Definition at line 527 of file logger.cpp.

◆ getConsoleVerbosity()

log::Level bitpit::Logger::getConsoleVerbosity ( )

Gets the verbosity threshold for messages printed on the console.

Logging messages which are less severe than the verbosity threshold will be ignored; logging messages which have severity equal to the verbosity threshold or higher will be printed.

Returns
The verbosity for the messages printed on the console.

Definition at line 726 of file logger.cpp.

◆ getContext()

std::string bitpit::Logger::getContext ( )

Gets the context used when printing the messages.

Returns
The the context used when printing the messages.

Definition at line 806 of file logger.cpp.

◆ getDefaultSeverity()

log::Level bitpit::Logger::getDefaultSeverity ( )

Gets the default severity of the messages.

Returns
The gets the default severity of the messages.

Definition at line 549 of file logger.cpp.

◆ getDefaultVisibility()

log::Visibility bitpit::Logger::getDefaultVisibility ( )

Gets the default visibility of the messages.

Returns
The gets the visibility of the messages.

Definition at line 591 of file logger.cpp.

◆ getFileVerbosity()

log::Level bitpit::Logger::getFileVerbosity ( )

Gets the verbosity threshold for messages printed on the log file.

Logging messages which are less severe than the verbosity threshold will be ignored; logging messages which have severity equal to the verbosity threshold or higher will be printed.

Definition at line 780 of file logger.cpp.

◆ getIndentation()

int bitpit::Logger::getIndentation ( )

Gets the indentation level used when printing the messages.

Returns
The the indentation level used when printing the messages.

Definition at line 832 of file logger.cpp.

◆ getName()

std::string bitpit::Logger::getName ( ) const

Gets the name of the logger

Returns
The name of the logger.

Definition at line 842 of file logger.cpp.

◆ getPriority()

log::Priority bitpit::Logger::getPriority ( )

Gets the current priority of the messages.

Returns
The gets the current priority of the messages.

Definition at line 569 of file logger.cpp.

◆ getVisibility()

log::Visibility bitpit::Logger::getVisibility ( )

Gets the visibility of the messages.

Returns
The gets the visibility of the messages.

Definition at line 611 of file logger.cpp.

◆ isConsoleTimestampEnabled()

bool bitpit::Logger::isConsoleTimestampEnabled ( ) const

Returns true if the timestamp is enabled on the console, false otherwise.

Returns
Returns true if the timestamp is enabled on the console, false otherwise.

Definition at line 650 of file logger.cpp.

◆ isFileTimestampEnabled()

bool bitpit::Logger::isFileTimestampEnabled ( ) const

Returns true if the timestamp is enabled on the log file, false otherwise.

Returns
Returns true if the timestamp is enabled on the log file, false otherwise.

Definition at line 737 of file logger.cpp.

◆ print() [1/5]

void bitpit::Logger::print ( const std::string & message)

Prints a message in the log.

Parameters
messageis the message to be printed

Definition at line 896 of file logger.cpp.

◆ print() [2/5]

void bitpit::Logger::print ( const std::string & message,
log::Level severity )

Prints a message in the log.

Parameters
messageis the message to be printed
severityis the severity of the line that will be printed

Definition at line 907 of file logger.cpp.

◆ print() [3/5]

void bitpit::Logger::print ( const std::string & message,
log::Level severity,
log::Visibility visibility )

Prints a message in the log.

Parameters
messageis the message to be printed
severityis the severity of the line to be printed
visibilityis the visibility of the line that will be printed

Definition at line 930 of file logger.cpp.

◆ print() [4/5]

void bitpit::Logger::print ( const std::string & message,
log::Visibility visibility )

Prints a message in the log.

Parameters
messageis the message to be printed
visibilityis the visibility of the line that will be printed

Definition at line 918 of file logger.cpp.

◆ print() [5/5]

template<typename T >
void bitpit::Logger::print ( const T & value,
log::Level severity,
log::Visibility visibility )
inline

Definition at line 196 of file logger.hpp.

◆ println() [1/4]

void bitpit::Logger::println ( const std::string & line)

Prints a line in the log.

Parameters
lineis the line to be printed

Definition at line 852 of file logger.cpp.

◆ println() [2/4]

void bitpit::Logger::println ( const std::string & line,
const log::Level severity,
log::Visibility visibility )

Prints a line in the log.

Parameters
lineis the line to be printed
severityis the severity of the line that will be printed
visibilityis the visibility of the line that will be printed

Definition at line 886 of file logger.cpp.

◆ println() [3/4]

void bitpit::Logger::println ( const std::string & line,
log::Level severity )

Prints a line in the log.

Parameters
lineis the line to be printed
severityis the severity of the line that will be printed

Definition at line 863 of file logger.cpp.

◆ println() [4/4]

void bitpit::Logger::println ( const std::string & line,
log::Visibility visibility )

Prints a line in the log.

Parameters
lineis the line to be printed
visibilityis the visibility of the line that will be printed

Definition at line 874 of file logger.cpp.

◆ setConsoleTimestampEnabled()

void bitpit::Logger::setConsoleTimestampEnabled ( bool enabled)

Enables the timestamp on the console.

Parameters
enabledif set to true enables the timestamp on the console.

Definition at line 660 of file logger.cpp.

◆ setConsoleVerbosity()

void bitpit::Logger::setConsoleVerbosity ( log::Level threshold)

Sets the verbosity threshold for messages printed on the console.

Logging messages which are less severe than the verbosity threshold will be ignored; logging messages which have severity equal to the verbosity threshold or higher will be printed.

Parameters
thresholdis the verbosity threshold

Definition at line 680 of file logger.cpp.

◆ setContext()

void bitpit::Logger::setContext ( const std::string & context)

Sets the context used when printing the messages.

Parameters
contextis the context used when printing the messages.

Definition at line 790 of file logger.cpp.

◆ setDefaultSeverity()

void bitpit::Logger::setDefaultSeverity ( log::Level severity)

Sets the default severity of the messages.

Parameters
severityis the default severity of the messages
Examples
POD_application_example_00001.cpp.

Definition at line 537 of file logger.cpp.

◆ setDefaultVisibility()

void bitpit::Logger::setDefaultVisibility ( log::Visibility visibility)

Sets the default visibility of the messages.

Parameters
visibilityis the default visibility of the messages

Definition at line 579 of file logger.cpp.

◆ setFileTimestampEnabled()

void bitpit::Logger::setFileTimestampEnabled ( bool enabled)

Enables the timestamp on the log file.

Parameters
enabledif set to true enables the timestamp on the log file

Definition at line 747 of file logger.cpp.

◆ setFileVerbosity()

void bitpit::Logger::setFileVerbosity ( log::Level threshold)

Sets the verbosity threshold for messages printed on the log file.

Logging messages which are less severe than the verbosity threshold will be ignored; logging messages which have severity equal to the verbosity threshold or higher will be printed.

Parameters
thresholdis the verbosity threshold

Definition at line 767 of file logger.cpp.

◆ setIndentation()

void bitpit::Logger::setIndentation ( int delta)

Sets the indentation level used when printing the messages.

Parameters
deltais the relative indentation level

Definition at line 816 of file logger.cpp.

◆ setPriority()

void bitpit::Logger::setPriority ( log::Priority priority)

Sets the default priority of the messages.

Parameters
priorityis the default priority of the messages

Definition at line 559 of file logger.cpp.

◆ setTimestampEnabled()

void bitpit::Logger::setTimestampEnabled ( bool enabled)

Enables the timestamp both on the console and on the log file.

Parameters
enabledif set to true enables the timestamp both on the console and on the log file.

Definition at line 638 of file logger.cpp.

◆ setVerbosities()

void bitpit::Logger::setVerbosities ( log::Level threshold)

Sets the verbosity threshold for messages printed on the console and on the log file.

Logging messages which are less severe than the verbosity threshold will be ignored; logging messages which have severity equal to the verbosity threshold or higher will be printed.

Parameters
thresholdis the verbosity threshold

Definition at line 626 of file logger.cpp.

◆ setVisibility()

void bitpit::Logger::setVisibility ( log::Visibility visibility)

Sets the visibility of the messages.

Parameters
visibilityis the default visibility of the messages

Definition at line 601 of file logger.cpp.

Friends And Related Symbol Documentation

◆ LoggerManager

friend class LoggerManager
friend

Definition at line 145 of file logger.hpp.


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