AclLog

AclLog

A namespace for logging utilities.

Classes

Name
classAclLog::CommandLogFormatter
This class is used to format log entries for Rendering Engine commands.
classAclLog::ThreadNameFormatterFlag
classAclLog::FileLocationFormatterFlag
A custom flag formatter which logs the source file location between a par of “[]”, in case the location is provided with the log call.

Types

Name
enum classLevel { kTrace, kDebug, kInfo, kWarning, kError, kCritical, kOff}
Log levels.

Functions

Name
voidinit(const std::string & name)
Initialize logging.
voidinitCommandLog(const std::string & name)
Init the Rendering Engine command log.
voidsetLevel(Level level)
Set global logging level.
voidlogCommand(const std::string & command)
Log a command to the command log.
AclLog::LevelgetLogLevel()
Internal helper function for getting the setting for the log level.
size_tgetMaxFileSize()
Internal helper function for getting the setting for the maximum size for a log file.
size_tgetMaxLogRotations()
Internal helper function for getting the setting for the maximum number of rotated log files.
std::filesystem::pathgetLogFileFullPath(const std::string & name)
Internal helper function for constructing the full path name for the log file.
std::stringgetThreadName()

Types Documentation

enum Level

EnumeratorValueDescription
kTrace
kDebug
kInfo
kWarning
kError
kCritical
kOff

Log levels.

Functions Documentation

function init

void init(
    const std::string & name
)

Initialize logging.

Parameters:

  • name The name of the component (used for log prefix and filename)

By default two sinks are created. The first sink writes messages to the console. The second sink attempts to create a log file in the path set by the environment variable ACL_LOG_PATH (’/tmp’ if unset). The name of the log file is ’name-.log’. The default logging level is ‘info’ (‘debug’ for debug builds) and can be changed by setting the ACL_LOG_LEVEL environment variable.

function initCommandLog

void initCommandLog(
    const std::string & name
)

Init the Rendering Engine command log.

Parameters:

  • name The name of the Rendering Engine (used for filename)

function setLevel

void setLevel(
    Level level
)

Set global logging level.

Parameters:

  • level Logging level to set

function logCommand

void logCommand(
    const std::string & command
)

Log a command to the command log.

Parameters:

  • command The command to log

function getLogLevel

AclLog::Level getLogLevel()

Internal helper function for getting the setting for the log level.

Return: The wanted log level fetched from an environment variable if set, or else a default value

function getMaxFileSize

size_t getMaxFileSize()

Internal helper function for getting the setting for the maximum size for a log file.

Return: The wanted maximum size of the log file fetched from an environment variable if set, or else a default value

function getMaxLogRotations

size_t getMaxLogRotations()

Internal helper function for getting the setting for the maximum number of rotated log files.

Return: The wanted number of log files to rotate fetched from an environment variable if set, or else a default value

function getLogFileFullPath

std::filesystem::path getLogFileFullPath(
    const std::string & name
)

Internal helper function for constructing the full path name for the log file.

Parameters:

  • name The name of the component

Return: The full path to the log file

function getThreadName

inline std::string getThreadName()

Updated on 2023-10-03 at 14:32:11 +0200