Added CustomLogFormatter
Summary:
A `CustomLogFormatter` can be enabled by setting the `formatter` option to `custom`. This formatter reads an option named `log_format` which specifies the format of the logs. The format string is similar to what `folly::vformat(format,...)` expects. Check out the following example format:
{L}{m:02d}{D:02d} {H:02d}:{M:02d}:{S:02d}.{USECS:06d} {THREAD:5d} {FILE}:{LINE}]
The format above prints logs in the same format as GLOGs.
Another option `colored` takes in one of the following values: `never`, `auto`, and `always`. When enabled, the output will be colored in the following way:
{F135233848}
The config used for the image above is:
FOLLY_INIT_LOGGING_CONFIG(".=DBG; default:formatter=custom,log_format={L} {FILE}::{FUN}():{LINE}],colored=true");
As you can see, we have also included the function name using `{FUN}`. This can be particularly helpful when debugging errors.
Reviewed By: simpkins
Differential Revision: D8974950
fbshipit-source-id: 87d624f53dd67c0630fb222093c46fe79ff44ee1
Showing
This diff is collapsed.
Please register or sign in to comment