proxygen
folly::LogWriter Class Referenceabstract

#include <LogWriter.h>

Inheritance diagram for folly::LogWriter:
folly::AsyncFileWriter folly::ImmediateFileWriter folly::TestLogWriter

Public Types

enum  Flags : uint32_t { NO_FLAGS = 0x00, NEVER_DISCARD = 0x01 }
 

Public Member Functions

virtual ~LogWriter ()
 
virtual void writeMessage (folly::StringPiece buffer, uint32_t flags=0)=0
 
virtual void writeMessage (std::string &&buffer, uint32_t flags=0)
 
virtual void flush ()=0
 
virtual bool ttyOutput () const =0
 

Detailed Description

LogWriter defines the interface for processing a serialized log message.

Definition at line 25 of file LogWriter.h.

Member Enumeration Documentation

Bit flag values for use with writeMessage()

Enumerator
NO_FLAGS 
NEVER_DISCARD 

Ensure that this log message never gets discarded.

Some LogWriter implementations may discard messages when messages are being received faster than they can be written. This flag ensures that this message will never be discarded.

This flag is used to ensure that LOG(FATAL) messages never get discarded, so we always report the reason for a crash.

Definition at line 30 of file LogWriter.h.

Constructor & Destructor Documentation

virtual folly::LogWriter::~LogWriter ( )
inlinevirtual

Definition at line 45 of file LogWriter.h.

References buffer(), uint32_t, and writeMessage().

45 {}

Member Function Documentation

virtual void folly::LogWriter::flush ( )
pure virtual

Block until all messages that have already been sent to this LogWriter have been written.

Other threads may still call writeMessage() while flush() is running. writeMessage() calls that did not complete before the flush() call started will not necessarily be processed by the flush call.

Implemented in folly::AsyncFileWriter, folly::ImmediateFileWriter, and folly::TestLogWriter.

Referenced by writeMessage().

virtual bool folly::LogWriter::ttyOutput ( ) const
pure virtual

Is the log writer writing to a tty or not.

Implemented in folly::AsyncFileWriter, folly::ImmediateFileWriter, and folly::TestLogWriter.

Referenced by writeMessage().

virtual void folly::LogWriter::writeMessage ( folly::StringPiece  buffer,
uint32_t  flags = 0 
)
pure virtual

Write a serialized log message.

The flags parameter is a bitwise-ORed set of Flag values defined above.

Implemented in folly::AsyncFileWriter, folly::ImmediateFileWriter, and folly::TestLogWriter.

Referenced by writeMessage(), and ~LogWriter().

virtual void folly::LogWriter::writeMessage ( std::string &&  buffer,
uint32_t  flags = 0 
)
inlinevirtual

Write a serialized message.

This version of writeMessage() accepts a std::string&&. The default implementation calls the StringPiece version of writeMessage(), but subclasses may override this implementation if desired.

Reimplemented in folly::AsyncFileWriter.

Definition at line 62 of file LogWriter.h.

References flush(), ttyOutput(), and writeMessage().

62  {
64  }
std::vector< uint8_t > buffer(kBufferSize+16)
flags
Definition: http_parser.h:127
virtual void writeMessage(folly::StringPiece buffer, uint32_t flags=0)=0

The documentation for this class was generated from the following file: