logging: add AsyncFileWriter
Summary: Add an AsyncFileWriter class that implements the LogWriter interface using a separate I/O thread to write the log messages to a file descriptor. This LogWriter implementation ensures that normal process threads will never block due to logging I/O. By default it will buffer up to 1MB of data. If log messages are generated faster than they can be written to the file, log messages will be discarded once the buffer limit is exceeded. The LogWriter will emit a message into the file recording how many messages were discarded where the dropped messages should have been. The downside of this class is that unwritten log messages still in the buffer will be lost when the program crashes. Reviewed By: wez Differential Revision: D5083107 fbshipit-source-id: c67226f4d0726675d480b03eae83a29c5c3431b2
Showing
Please register or sign in to comment