Namespace Acts::Logging

namespace 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.

Functions

constexpr Level getFailureThreshold()

Get 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.

Note

Depending on preprocessor settings ACTS_ENABLE_LOG_FAILURE_THRESHOLD and ACTS_LOG_FAILURE_THRESHOLD, this operations is either constexpr or a runtime operation.

inline std::string_view levelName(Level level)
void setFailureThreshold(Level level)

Set 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.

Note

This sets a global static runtime value, which is not thread-safe! This function should not be called during a job.

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 if lvl >= m_level, otherwise false

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

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

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

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

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

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

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

class ThresholdFailure : public std::runtime_error
#include <Acts/Utilities/Logger.hpp>

Custom exception class so threshold failures can be caught.

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