A LogFormatter implementation that produces messages in a format specified using a config.

Synopsis

Declared in <folly/logging/CustomLogFormatter.h>

class CustomLogFormatter
    : public LogFormatter

Description

The glog message format is:

{L}{m:02d}{D:02d} {H:2d}:{M:02d}:{S:02d}.{USECS:06d} {THREAD:5d} {FILE}:{LINE}]

L: A 1‐character code describing the log level (e.g., E, W, I, V) m: month D: day H: hour, 24‐hour format M: minute S: second USECS: microseconds THREAD: Thread ID FILE: Filename (just the last component) FIL: Filename (just the last component) without extension FUN: The function that logged the message LINE: Line number

TODO: enable support for the following 2:

  • THREADNAME: the thread name.

  • THREADCTX: thread‐local log context data, if it has been set. (This is a Facebook‐specific modification)

Base Classes

Name

Description

LogFormatter

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

Member Functions

Name

Description

CustomLogFormatter [constructor]

Construct a formatter from a format string.

formatMessage [virtual]

Format a log message according to the configured format.

Created with MrDocs