folly::GlogStyleFormatter

A LogFormatter implementation that produces messages in a format similar to that produced by the Google logging library.

Synopsis

Declared in <folly/logging/GlogStyleFormatter.h>

class GlogStyleFormatter
    : public LogFormatter

Description

The glog message format is:

LmmDD HH:MM:SS.USECS THREAD THREADNAME FILE:LINE] MSG

L: A 1-character code describing the log level (e.g., E, W, I, V) mm: 2-digit month DD: 2-digit day HH: 2-digit hour, 24-hour format MM: 2-digit minute SS: 2-digit second USECS: 6-digit microseconds THREAD: Thread ID FILE: Filename (just the last component) LINE: Line number MSG: The actual log message

[THREADNAME]is the thread name, and is only included if --logthreadnames was enabled on the command line.

(THREADCTX) is thread-local log context data, if it has been set. (This is a Facebook-specific modification, and is disabled unless --logthreadcontext was enabled on the command line.)

Exception information and a custom log prefix may also appear after the file name and line number, before the ']' character.

Base Classes

NameDescription
LogFormatterLogFormatter defines the interface for serializing a LogMessage object into a buffer to be given to a LogWriter.

Member Functions

NameDescription
GlogStyleFormatter [constructor]Construct a GlogStyleFormatter.
formatMessage [virtual]Format a log message in the glog-style format.