proxygen
|
#include <GlogStyleFormatter.h>
Public Member Functions | |
std::string | formatMessage (const LogMessage &message, const LogCategory *handlerCategory) override |
Public Member Functions inherited from folly::LogFormatter | |
virtual | ~LogFormatter () |
A LogFormatter implementation that produces messages in a format similar to that produced by the Google logging library.
The glog message format is:
LmmDD HH:MM:SS.USECS THREAD [THREADNAME] (THREADCTX) 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.
Definition at line 53 of file GlogStyleFormatter.h.
|
overridevirtual |
Serialze a LogMessage object.
message | The LogMessage object to serialze. |
handlerCategory | The LogCategory that is currently handling this message. Note that this is likely different from the LogCategory where the message was originally logged, which can be accessed as message->getCategory() |
Implements folly::LogFormatter.
Definition at line 45 of file GlogStyleFormatter.cpp.
References buffer(), folly::LogMessage::containsNewlines(), folly::test::end(), folly::format(), folly::LogMessage::getFileBaseName(), folly::LogMessage::getLevel(), folly::LogMessage::getLineNumber(), folly::LogMessage::getMessage(), folly::LogMessage::getThreadID(), folly::LogMessage::getTimestamp(), folly::Range< const char * >::npos, and string.