logging: implement FATAL and DFATAL log levels
authorAdam Simpkins <simpkins@fb.com>
Tue, 20 Jun 2017 21:01:59 +0000 (14:01 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 20 Jun 2017 21:09:59 +0000 (14:09 -0700)
commit61fbd6698139d3f797401da6350371c7afc4030c
treefb9f44879ea223f3916bce8276c3465a2dd4ff15
parenteeae0d907cda9598457c53cef761634c19fe7fe1
logging: implement FATAL and DFATAL log levels

Summary:
Add new `FATAL` and `DFATAL` log levels.

Any log message with a level of `FATAL` always crashes the program.  Log
messages with a level of `DFATAL` crash the program in debug build modes.

Before crashing, the code makes sure to flush all LogHandlers, so that the
fatal message is not lost if some of the LogHandlers process messages
asynchronously.  If no LogHandlers were configured, the message is printed to
stderr.

Reviewed By: wez

Differential Revision: D5189497

fbshipit-source-id: c45dbd582fb1c3a962d00effb2967737ef97cc8b
13 files changed:
folly/experimental/logging/LogCategory.cpp
folly/experimental/logging/LogCategory.h
folly/experimental/logging/LogLevel.cpp
folly/experimental/logging/LogLevel.h
folly/experimental/logging/LogStreamProcessor.cpp
folly/experimental/logging/LogStreamProcessor.h
folly/experimental/logging/Logger.h
folly/experimental/logging/LoggerDB.cpp
folly/experimental/logging/LoggerDB.h
folly/experimental/logging/test/FatalHelper.cpp [new file with mode: 0644]
folly/experimental/logging/test/LogLevelTest.cpp
folly/experimental/logging/test/fatal_test.py [new file with mode: 0644]
folly/experimental/logging/xlog.h