logging: add LogFormatter and LogWriter interfaces
authorAdam Simpkins <simpkins@fb.com>
Thu, 15 Jun 2017 18:03:48 +0000 (11:03 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 15 Jun 2017 18:06:06 +0000 (11:06 -0700)
commit9578ff20cf9e4b30e6f2d8ffb082ed8ec9791042
treef7ed8b47b08d99458d6d6da92b7034f3b7b3da25
parent9e55caa86b1d838d9962442255363f37a2ee49fc
logging: add LogFormatter and LogWriter interfaces

Summary:
This simplifies the LogHandler interface to a single generic `handleMessage()`,
and adds a `StandardLogHandler` implementation that defers to separate
`LogFormatter` and `LogWriter` objects.

The `LogFormatter` class is responsible for serializing the `LogMessage` object
into a string, and `LogWriter` is responsible for then doing something with
the serialized string.

This will make it possible in the future to have separate `LogWriter`
implementations that all share the same log formatting code.  For example, this
will allow separate `LogWriter` implementations for performing file I/O
immediately versus performing I/O asynchronously in a separate thread.

Reviewed By: yfeldblum

Differential Revision: D5083103

fbshipit-source-id: e3f5ece25e260c825d49a5eb30e942973d6b68bf
12 files changed:
CMakeLists.txt
folly/Makefile.am
folly/experimental/logging/LogCategory.cpp
folly/experimental/logging/LogFormatter.h [new file with mode: 0644]
folly/experimental/logging/LogHandler.cpp [deleted file]
folly/experimental/logging/LogHandler.h
folly/experimental/logging/LogWriter.h [new file with mode: 0644]
folly/experimental/logging/Makefile.am
folly/experimental/logging/StandardLogHandler.cpp [new file with mode: 0644]
folly/experimental/logging/StandardLogHandler.h [new file with mode: 0644]
folly/experimental/logging/test/StandardLogHandlerTest.cpp [new file with mode: 0644]
folly/experimental/logging/test/TestLogHandler.h