proxygen
folly::StreamHandlerFactory Class Reference

#include <StreamHandlerFactory.h>

Inheritance diagram for folly::StreamHandlerFactory:
folly::LogHandlerFactory

Classes

class  WriterFactory
 

Public Member Functions

StringPiece getType () const override
 
std::shared_ptr< LogHandlercreateHandler (const Options &options) override
 
- Public Member Functions inherited from folly::LogHandlerFactory
virtual ~LogHandlerFactory ()=default
 
virtual std::shared_ptr< LogHandlerupdateHandler (FOLLY_MAYBE_UNUSED const std::shared_ptr< LogHandler > &existingHandler, const Options &options)
 

Additional Inherited Members

- Public Types inherited from folly::LogHandlerFactory
using Options = std::unordered_map< std::string, std::string >
 

Detailed Description

StreamHandlerFactory is a LogHandlerFactory that constructs log handlers that write to stdout or stderr.

This is quite similar to FileHandlerFactory, but it always writes to an existing open file descriptor rather than opening a new file. This handler factory is separate from FileHandlerFactory primarily for safety reasons: FileHandlerFactory supports appending to arbitrary files via config parameters, while StreamHandlerFactory does not.

Definition at line 32 of file StreamHandlerFactory.h.

Member Function Documentation

std::shared_ptr< LogHandler > folly::StreamHandlerFactory::createHandler ( const Options options)
overridevirtual

Create a new LogHandler.

Implements folly::LogHandlerFactory.

Definition at line 60 of file StreamHandlerFactory.cpp.

References folly::StandardLogHandlerFactory::createHandler(), and getType().

Referenced by getType(), and TEST().

61  {
62  WriterFactory writerFactory;
64  getType(), &writerFactory, options);
65 }
static std::shared_ptr< StandardLogHandler > createHandler(StringPiece type, WriterFactory *writerFactory, const Options &options)
StringPiece getType() const override
StringPiece folly::StreamHandlerFactory::getType ( ) const
inlineoverridevirtual

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.

Implements folly::LogHandlerFactory.

Definition at line 34 of file StreamHandlerFactory.h.

References createHandler().

Referenced by createHandler().

34  {
35  return "stream";
36  }

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