[#BloombergLP-bsls-Log] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bsls.adoc[bsls]::Log :relfileprefix: ../../ :mrdocs: 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>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class Log; ---- == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bsls/Log/LogMessageHandler-05.adoc[`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 [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bsls/Log/logFormattedMessage.adoc[`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. | xref:BloombergLP/bsls/Log/logMessage.adoc[`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`. | xref:BloombergLP/bsls/Log/logMessageHandler-08.adoc[`logMessageHandler`] | Return the address of the currently installed log message handler. | xref:BloombergLP/bsls/Log/platformDefaultMessageHandler.adoc[`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`. | xref:BloombergLP/bsls/Log/setLogMessageHandler.adoc[`setLogMessageHandler`] | Install the specified `handler` as the current log message handler. | xref:BloombergLP/bsls/Log/setSeverityThreshold.adoc[`setSeverityThreshold`] | Set the severity threshold at which log records are written by `logMessage` and `logFormattedMessage` to the specified `severity`. | xref:BloombergLP/bsls/Log/severityThreshold.adoc[`severityThreshold`] | Return the currently configured severity threshold at or above which records are written by `logMessage` and `logFormattedMessage`. | xref:BloombergLP/bsls/Log/stderrMessageHandler.adoc[`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`. | xref:BloombergLP/bsls/Log/stdoutMessageHandler.adoc[`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`. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#