iceoryx2
C++ Language Bindings
Loading...
Searching...
No Matches
iox2::legacy::log::internal::Logger< BaseLogger > Class Template Reference

This class acts as common interface for the Logger. It provides the common functionality and inherits from the BaseLogger which is provided as template parameter. Please have a look at the design document for more details. More...

#include <logger.hpp>

Inheritance diagram for iox2::legacy::log::internal::Logger< BaseLogger >:

Public Member Functions

 Logger ()=default
 
 Logger (const Logger &)=delete
 
 Logger (Logger &&)=delete
 
Loggeroperator= (const Logger &)=delete
 
Loggeroperator= (Logger &&)=delete
 
 ~Logger ()=default
 

Static Public Member Functions

static Loggerget () noexcept
 Access to the logger singleton instance.
 
static void init (const LogLevel logLevel=logLevelFromEnvOr(LogLevel::Info)) noexcept
 Initializes the logger.
 
static void setActiveLogger (Logger &newLogger) noexcept
 Replaces the default logger with the specified one.
 

Friends

class log::LogStream
 

Detailed Description

template<typename BaseLogger>
class iox2::legacy::log::internal::Logger< BaseLogger >

This class acts as common interface for the Logger. It provides the common functionality and inherits from the BaseLogger which is provided as template parameter. Please have a look at the design document for more details.

Template Parameters

in] BaseLogger is the actual implementation

Definition at line 71 of file logger.hpp.

Constructor & Destructor Documentation

◆ Logger() [1/3]

template<typename BaseLogger >
iox2::legacy::log::internal::Logger< BaseLogger >::Logger ( )
default

◆ Logger() [2/3]

template<typename BaseLogger >
iox2::legacy::log::internal::Logger< BaseLogger >::Logger ( const Logger< BaseLogger > &  )
delete

◆ Logger() [3/3]

template<typename BaseLogger >
iox2::legacy::log::internal::Logger< BaseLogger >::Logger ( Logger< BaseLogger > &&  )
delete

◆ ~Logger()

template<typename BaseLogger >
iox2::legacy::log::internal::Logger< BaseLogger >::~Logger ( )
default

Member Function Documentation

◆ get()

template<typename BaseLogger >
static Logger & iox2::legacy::log::internal::Logger< BaseLogger >::get ( )
staticnoexcept

Access to the logger singleton instance.

Returns
a reference to the active logger

◆ init()

template<typename BaseLogger >
static void iox2::legacy::log::internal::Logger< BaseLogger >::init ( const LogLevel  logLevel = logLevelFromEnvOr(LogLevel::Info))
staticnoexcept

Initializes the logger.

Parameters
[in]logLevelthe log level which will be used to determine which messages will be logged. By default it is everything with a log level higher than specified by the 'IOX2_LOG_LEVEL' environment variable or equal to 'INFO' if the environment variable is not set.
Note
The function uses 'getenv' which is not thread safe and can result in undefined behavior when it is called from multiple threads or the env variable is changed while the function holds a pointer to the data. For this reason the function should only be used in the startup phase of the application and only in the main thread.

◆ operator=() [1/2]

template<typename BaseLogger >
Logger & iox2::legacy::log::internal::Logger< BaseLogger >::operator= ( const Logger< BaseLogger > &  )
delete

◆ operator=() [2/2]

template<typename BaseLogger >
Logger & iox2::legacy::log::internal::Logger< BaseLogger >::operator= ( Logger< BaseLogger > &&  )
delete

◆ setActiveLogger()

template<typename BaseLogger >
static void iox2::legacy::log::internal::Logger< BaseLogger >::setActiveLogger ( Logger< BaseLogger > &  newLogger)
staticnoexcept

Replaces the default logger with the specified one.

Parameters
[in]newLoggeris the logger which shall be used after the call
Note
this must be called before 'init'. If this is called after 'init' or called multiple times, the current logger will not be replaced and an error message will be logged in the current and the provided new logger.

Friends And Related Symbol Documentation

◆ log::LogStream

template<typename BaseLogger >
friend class log::LogStream
friend

Definition at line 73 of file logger.hpp.


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