proxygen
folly::FileHandlerFactory Class Reference

#include <FileHandlerFactory.h>

Inheritance diagram for folly::FileHandlerFactory:
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

FileHandlerFactory is a LogHandlerFactory that constructs log handlers that write to a file.

Note that FileHandlerFactory allows opening and appending to arbitrary files based on the handler options. This may make it unsafe to use FileHandlerFactory in some contexts: for instance, a setuid binary should generally avoid registering the FileHandlerFactory if they allow log handlers to be configured via command line parameters, since otherwise this may allow non-root users to append to files that they otherwise would not have write permissions for.

Definition at line 34 of file FileHandlerFactory.h.

Member Function Documentation

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

Create a new LogHandler.

Implements folly::LogHandlerFactory.

Definition at line 52 of file FileHandlerFactory.cpp.

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

Referenced by getType(), and TEST().

53  {
54  WriterFactory writerFactory;
56  getType(), &writerFactory, options);
57 }
static std::shared_ptr< StandardLogHandler > createHandler(StringPiece type, WriterFactory *writerFactory, const Options &options)
StringPiece getType() const override
StringPiece folly::FileHandlerFactory::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 36 of file FileHandlerFactory.h.

References createHandler().

Referenced by createHandler().

36  {
37  return "file";
38  }

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