esp::logging::LoggingContext class

Logging context that tracks which logging statements are enabled.

The logging system in habitat-sim can be configured in a variety of ways to determine which logging statements should be printed.

Due to the use of ESP_LOG_IF, logging statements that are not printed are as close to free as reasonably possible.

Public static variables

static const char* LOGGING_ENV_VAR_NAME constexpr
static LoggingLevel DEFAULT_LEVEL constexpr

Public static functions

static auto hasCurrent() -> bool
Whether or not there is a current context or not. Whichever context class was most recently constructed is the current one.
static auto current() -> const LoggingContext&
Retrieves the current logging context. Throws an error if there isn't one.

Constructors, destructors, conversion operators

LoggingContext()
Convenience constructor that grabs the configuration string from the environment variable and calls LoggingContext(Corrade::Containers::StringView)
LoggingContext(Corrade::Containers::StringView envString) explicit
Constructor.
~LoggingContext()
LoggingContext(LoggingContext&&) deleted
LoggingContext(LoggingContext&) deleted

Public functions

auto operator=(LoggingContext&) -> LoggingContext& deleted
auto operator=(LoggingContext&&) -> LoggingContext& deleted
auto levelFor(Subsystem subsystem) const -> LoggingLevel
Retrieves the logging level for the given subsystem.

Function documentation

esp::logging::LoggingContext::LoggingContext(Corrade::Containers::StringView envString) explicit

Constructor.

Parameters
envString in Configuration string. See processEnvString for details

Processes the environment variable string that configures the habitat-sim logging levels for various subsystems

This environment string has a fairly simple grammar that is as follows

FilterString: SetLevelCommand (COLON SetLevelCommand)*
SetLevelCommand: (SUBSYSTEM (COMMA SUBSYSTEM)* EQUALS)? LOGGING_LEVEL

where SUBSYSTEM is a known logging subsystem and LOGGING_LEVEL is one of the logging levels. If a SetLevelCommand does not contain a list of subsystems, that level is applied to all subsystems.

A logging statement is printed if it's logging level has a higher or equal priority to the current logging level for it's subsystem. verbose is the lowest level. quiet disables debug and warnings.