proxygen
|
#include <CustomLogFormatter.h>
Public Member Functions | |
CustomLogFormatter (StringPiece format, bool colored) | |
std::string | formatMessage (const LogMessage &message, const LogCategory *handlerCategory) override |
Public Member Functions inherited from folly::LogFormatter | |
virtual | ~LogFormatter () |
Private Member Functions | |
void | parseFormatString (StringPiece format) |
Private Attributes | |
std::string | logFormat_ |
std::string | singleLineLogFormat_ |
std::size_t | staticEstimatedWidth_ {0} |
std::size_t | fileNameCount_ {0} |
std::size_t | functionNameCount_ {0} |
const bool | colored_ |
A LogFormatter implementation that produces messages in a format specified using a config.
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) FUN: The function that logged the message LINE: Line number
TODO: enable support for the following 2:
Definition at line 50 of file CustomLogFormatter.h.
|
explicit |
Definition at line 104 of file CustomLogFormatter.cpp.
References parseFormatString().
|
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 231 of file CustomLogFormatter.cpp.
References buffer(), colored_, folly::LogMessage::containsNewlines(), folly::test::end(), fileNameCount_, folly::format(), functionNameCount_, folly::LogMessage::getFileBaseName(), folly::LogMessage::getFunctionName(), folly::LogMessage::getLevel(), folly::LogMessage::getLineNumber(), folly::LogMessage::getMessage(), folly::LogMessage::getThreadID(), folly::LogMessage::getTimestamp(), logFormat_, folly::Range< const char * >::npos, folly::sformat(), singleLineLogFormat_, folly::Range< Iter >::size(), staticEstimatedWidth_, string, and fizz::toString().
|
private |
Definition at line 109 of file CustomLogFormatter.cpp.
References a, b, folly::Range< Iter >::begin(), colored_, folly::Range< Iter >::end(), fileNameCount_, functionNameCount_, proxygen::HPACK::LITERAL, logFormat_, gmock_output_test::output, singleLineLogFormat_, folly::Range< Iter >::size(), staticEstimatedWidth_, string, and UNLIKELY.
Referenced by CustomLogFormatter().
|
private |
Definition at line 65 of file CustomLogFormatter.h.
Referenced by formatMessage(), and parseFormatString().
|
private |
Definition at line 63 of file CustomLogFormatter.h.
Referenced by formatMessage(), and parseFormatString().
|
private |
Definition at line 64 of file CustomLogFormatter.h.
Referenced by formatMessage(), and parseFormatString().
|
private |
Definition at line 60 of file CustomLogFormatter.h.
Referenced by formatMessage(), and parseFormatString().
|
private |
Definition at line 61 of file CustomLogFormatter.h.
Referenced by formatMessage(), and parseFormatString().
|
private |
Definition at line 62 of file CustomLogFormatter.h.
Referenced by formatMessage(), and parseFormatString().