proxygen
folly::LogHandlerFactory Class Referenceabstract

#include <LogHandlerFactory.h>

Inheritance diagram for folly::LogHandlerFactory:
folly::FileHandlerFactory folly::StreamHandlerFactory folly::TestHandlerFactory folly::TestLogHandlerFactory

Public Types

using Options = std::unordered_map< std::string, std::string >
 

Public Member Functions

virtual ~LogHandlerFactory ()=default
 
virtual StringPiece getType () const =0
 
virtual std::shared_ptr< LogHandlercreateHandler (const Options &options)=0
 
virtual std::shared_ptr< LogHandlerupdateHandler (FOLLY_MAYBE_UNUSED const std::shared_ptr< LogHandler > &existingHandler, const Options &options)
 

Detailed Description

Definition at line 29 of file LogHandlerFactory.h.

Member Typedef Documentation

Definition at line 31 of file LogHandlerFactory.h.

Constructor & Destructor Documentation

virtual folly::LogHandlerFactory::~LogHandlerFactory ( )
virtualdefault

Member Function Documentation

virtual std::shared_ptr<LogHandler> folly::LogHandlerFactory::createHandler ( const Options options)
pure virtual
virtual StringPiece folly::LogHandlerFactory::getType ( ) const
pure virtual

Get the type name of this LogHandlerFactory.

The type field in the LogHandlerConfig for all LogHandlers created by this factory should match the type of the LogHandlerFactory.

The type of a LogHandlerFactory should never change. The returned StringPiece should be valid for the lifetime of the LogHandlerFactory.

Implemented in folly::TestLogHandlerFactory, folly::TestHandlerFactory, folly::FileHandlerFactory, and folly::StreamHandlerFactory.

virtual std::shared_ptr<LogHandler> folly::LogHandlerFactory::updateHandler ( FOLLY_MAYBE_UNUSED const std::shared_ptr< LogHandler > &  existingHandler,
const Options options 
)
inlinevirtual

Update an existing LogHandler with a new configuration.

This may create a new LogHandler object, or it may update the existing LogHandler in place.

The returned pointer will point to the input handler if it was updated in place, or will point to a new LogHandler if a new one was created.

Definition at line 60 of file LogHandlerFactory.h.

References createHandler().

62  {
63  // Subclasses may override this with functionality to update an existing
64  // handler in-place. However, provide a default implementation that simply
65  // calls createHandler() to always create a new handler object.
66  return createHandler(options);
67  }
virtual std::shared_ptr< LogHandler > createHandler(const Options &options)=0

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