Namespace Acts::Logging¶
-
namespace Acts::Logging
debug output related helper classes and functions
Enums
-
enum Level
constants steering the debug output
All messages with a debug level equal or higher than the currently set debug output level will be printed.
Values:
-
enumerator VERBOSE
VERBOSE level.
-
enumerator DEBUG
DEBUG level.
-
enumerator INFO
INFO level.
-
enumerator WARNING
WARNING level.
-
enumerator ERROR
ERROR level.
-
enumerator FATAL
FATAL level.
-
enumerator MAX
Must be kept above the maximum supported debug level.
-
enumerator VERBOSE
Functions
-
inline Level getFailureThreshold()
Function which returns the failure threshold for log messages.
This can either be from a compilation option or from an environment variable.
- Returns
The log level failure threshold
Variables
-
constexpr Level FAILURE_THRESHOLD = Level::MAX
debug level above which an exception will be thrown after logging
All messages with a debug level equal or higher than FAILURE_THRESHOLD will cause an exception to be thrown after log emission. This behavior, which is controlled via the ACTS_LOG_FAILURE_THRESHOLD preprocessor define, enables reliably catching non-fatal errors in automated Acts tests.
-
class DefaultFilterPolicy : public Acts::Logging::OutputFilterPolicy
- #include <Acts/Utilities/Logger.hpp>
default filter policy for debug messages
All debug messages with a debug level equal or larger to the specified threshold level are processed.
Public Functions
-
inline explicit DefaultFilterPolicy(const Level &lvl)
constructor
- Parameters
lvl – [in] threshold debug level
-
~DefaultFilterPolicy() override = default
virtual default destructor
-
inline virtual bool doPrint(const Level &lvl) const override
decide whether a debug message should be processed
- Parameters
lvl – [in] debug level of debug message
- Returns
true
iflvl
>= m_level, otherwisefalse
-
inline explicit DefaultFilterPolicy(const Level &lvl)
-
class DefaultPrintPolicy : public Acts::Logging::OutputPrintPolicy
- #include <Acts/Utilities/Logger.hpp>
default print policy for debug messages
This class allows to print debug messages without further modifications to a specified output stream.
Public Functions
-
inline explicit DefaultPrintPolicy(std::ostream *out = &std::cout)
constructor
- Parameters
out – [in] pointer to output stream object
- Pre
out
is non-zero
-
inline virtual void flush(const Level &lvl, const std::string &input) final
flush the debug message to the destination stream
- Parameters
lvl – [in] debug level of debug message
input – [in] text of debug message
-
inline explicit DefaultPrintPolicy(std::ostream *out = &std::cout)
-
class LevelOutputDecorator : public Acts::Logging::OutputDecorator
- #include <Acts/Utilities/Logger.hpp>
decorate debug message with its debug level
The debug message is complemented with its debug level.
Public Functions
-
inline explicit LevelOutputDecorator(std::unique_ptr<OutputPrintPolicy> wrappee)
constructor
- Parameters
wrappee – [in] output print policy object to be wrapped
-
inline virtual void flush(const Level &lvl, const std::string &input) override
flush the debug message to the destination stream
This function prepends the debug level to the debug message and then delegates the flushing of the whole message to its wrapped object.
- Parameters
lvl – [in] debug level of debug message
input – [in] text of debug message
-
inline explicit LevelOutputDecorator(std::unique_ptr<OutputPrintPolicy> wrappee)
-
class NamedOutputDecorator : public Acts::Logging::OutputDecorator
- #include <Acts/Utilities/Logger.hpp>
decorate debug message with a name
The debug message is complemented with a name.
Public Functions
-
inline NamedOutputDecorator(std::unique_ptr<OutputPrintPolicy> wrappee, const std::string &name, unsigned int maxWidth = 15)
constructor
- Parameters
wrappee – [in] output print policy object to be wrapped
name – [in] name to be added to debug message
maxWidth – [in] maximum width of field used for name
-
inline virtual void flush(const Level &lvl, const std::string &input) override
flush the debug message to the destination stream
This function prepends the given name to the debug message and then delegates the flushing of the whole message to its wrapped object.
- Parameters
lvl – [in] debug level of debug message
input – [in] text of debug message
-
inline NamedOutputDecorator(std::unique_ptr<OutputPrintPolicy> wrappee, const std::string &name, unsigned int maxWidth = 15)
-
class OutputDecorator : public Acts::Logging::OutputPrintPolicy
- #include <Acts/Utilities/Logger.hpp>
base class for decorating the debug output
Derived classes may augment the debug message with additional information. Chaining different decorators is possible to customize the output to your needs.
Subclassed by Acts::Logging::LevelOutputDecorator, Acts::Logging::NamedOutputDecorator, Acts::Logging::ThreadOutputDecorator, Acts::Logging::TimedOutputDecorator
Public Functions
-
inline explicit OutputDecorator(std::unique_ptr<OutputPrintPolicy> wrappee)
constructor wrapping actual output print policy
- Parameters
wrappee – [in] output print policy object which is wrapped by this decorator object
-
inline virtual void flush(const Level &lvl, const std::string &input) override
flush the debug message to the destination stream
This function delegates the flushing of the debug message to its wrapped object.
- Parameters
lvl – [in] debug level of debug message
input – [in] text of debug message
-
inline explicit OutputDecorator(std::unique_ptr<OutputPrintPolicy> wrappee)
-
class OutputFilterPolicy
- #include <Acts/Utilities/Logger.hpp>
abstract base class for filtering debug output
Implementations of this interface need to define whether a debug message with a certain debug level is processed or filtered out.
Subclassed by Acts::Logging::DefaultFilterPolicy
Public Functions
-
virtual ~OutputFilterPolicy() = default
virtual default destructor
-
virtual bool doPrint(const Level &lvl) const = 0
decide whether a debug message should be processed
- Parameters
lvl – [in] debug level of debug message
- Returns
true
of debug message should be processed,false
if debug message should be skipped
-
virtual ~OutputFilterPolicy() = default
-
class OutputPrintPolicy
- #include <Acts/Utilities/Logger.hpp>
abstract base class for printing debug output
Implementations of this interface need to define how and where to print debug messages (e.g. to a file, to a stream into a database etc).
Subclassed by Acts::Logging::DefaultPrintPolicy, Acts::Logging::OutputDecorator
Public Functions
-
virtual ~OutputPrintPolicy() = default
virtual default destructor
-
virtual void flush(const Level &lvl, const std::string &input) = 0
handle output of debug message
- Parameters
lvl – [in] debug output level of message
input – [in] text of debug message
-
virtual ~OutputPrintPolicy() = default
-
class ThreadOutputDecorator : public Acts::Logging::OutputDecorator
- #include <Acts/Utilities/Logger.hpp>
decorate debug message with a thread ID
The debug message is complemented with a thread ID.
Public Functions
-
inline explicit ThreadOutputDecorator(std::unique_ptr<OutputPrintPolicy> wrappee)
constructor
- Parameters
wrappee – [in] output print policy object to be wrapped
-
inline virtual void flush(const Level &lvl, const std::string &input) override
flush the debug message to the destination stream
This function prepends the thread ID to the debug message and then delegates the flushing of the whole message to its wrapped object.
- Parameters
lvl – [in] debug level of debug message
input – [in] text of debug message
-
inline explicit ThreadOutputDecorator(std::unique_ptr<OutputPrintPolicy> wrappee)
-
class TimedOutputDecorator : public Acts::Logging::OutputDecorator
- #include <Acts/Utilities/Logger.hpp>
decorate debug message with a time stamp
The debug message is complemented with a time stamp.
Public Functions
-
inline TimedOutputDecorator(std::unique_ptr<OutputPrintPolicy> wrappee, const std::string &format = "%X")
constructor
- Parameters
wrappee – [in] output print policy object to be wrapped
format – [in] format of time stamp (see std::strftime)
-
inline virtual void flush(const Level &lvl, const std::string &input) override
flush the debug message to the destination stream
This function prepends a time stamp to the debug message and then delegates the flushing of the whole message to its wrapped object.
- Parameters
lvl – [in] debug level of debug message
input – [in] text of debug message
-
inline TimedOutputDecorator(std::unique_ptr<OutputPrintPolicy> wrappee, const std::string &format = "%X")
-
enum Level