BloombergLP::bsls::Log

This class serves as a namespace containing a suite of utility functions that allow low-level code to write log messages to a configurable, globally controlled destination.

Synopsis

Declared in <bsls_log.h>

class Log;

Type Aliases

NameDescription
LogMessageHandler The LogMessageHandler typedef represents a type of function that handles log messages in an unspecified way (e.g., by writing the log message to an output stream or to a file). Because they can be called concurrently from multiple threads, log message handlers must be thread-safe. While installed, handlers must exhibit only defined behavior if the specified file is a null-terminated string, the specified line is not negative, and the specified message is a null-terminated string.

Static Member Functions

NameDescription
logFormattedMessage If the specified severity is at least as severe as severityThrehold, invoke the currently installed log message handler with severity and the specified file and line, as well as a message string created by calling sprintf on the specified format with the specified variadic arguments; otherwise (if severity is less severe), this operation has no effect. The behavior is undefined unless 0 <= line, and format is a valid sprintf format specification for the supplied variadic arguments.
logMessage If the specified severity is at least as severe as severityThreshold, invoke the currently installed log message handler with severity, as well as the specified file, line, and message; otherwise (if severity is less severe), this operation has no effect. The behavior is undefined unless 0 <= line.
logMessageHandler Return the address of the currently installed log message handler.
platformDefaultMessageHandler Write, to a platform-specific destination, a string composed of the specified severity, file name, line number, and message. On non-Windows systems, write the log record to the stderr output stream. On Windows systems: If the current process is running in console mode, write the log record to the stderr output stream. If the current process is running in non-console mode, write the log record to the Windows process debugger. The behavior is undefined unless 0 <= line. Note that this function is used as the default log message handler. Also note that this function will write the message irrespective of the current severityThreshold.
setLogMessageHandler Install the specified handler as the current log message handler.
setSeverityThreshold Set the severity threshold at which log records are written by logMessage and logFormattedMessage to the specified severity.
severityThreshold Return the currently configured severity threshold at or above which records are written by logMessage and logFormattedMessage.
stderrMessageHandler Write, to the stderr output stream, a string composed of the specified severity, file name, line number, and the message. The behavior is undefined unless 0 <= line. Note that this function provides an implementation of the LogMessageHandler function prototype, and will write the message irrespective of the current severityThreshold.
stdoutMessageHandler Write, to the stdout output stream, a string composed of the specified severity, file name, line number, and the message. The behavior is undefined unless 0 <= line. Note that this function provides an implementation of the LogMessageHandler function prototype, and will write the message irrespective of the current severityThreshold.