proxygen
folly::FileHandlerFactory::WriterFactory Class Reference
Inheritance diagram for folly::FileHandlerFactory::WriterFactory:
folly::StandardLogHandlerFactory::WriterFactory folly::StandardLogHandlerFactory::OptionProcessor

Public Member Functions

bool processOption (StringPiece name, StringPiece value) override
 
std::shared_ptr< LogWritercreateWriter () override
 
- Public Member Functions inherited from folly::StandardLogHandlerFactory::OptionProcessor
virtual ~OptionProcessor ()
 

Public Attributes

std::string path_
 
FileWriterFactory fileWriterFactory_
 

Detailed Description

Definition at line 24 of file FileHandlerFactory.cpp.

Member Function Documentation

std::shared_ptr<LogWriter> folly::FileHandlerFactory::WriterFactory::createWriter ( )
inlineoverridevirtual

Implements folly::StandardLogHandlerFactory::WriterFactory.

Definition at line 39 of file FileHandlerFactory.cpp.

References folly::FileWriterFactory::createWriter(), fileWriterFactory_, and path_.

39  {
40  // Get the output file to use
41  if (path_.empty()) {
42  throw std::invalid_argument("no path specified for file handler");
43  }
45  File{path_, O_WRONLY | O_APPEND | O_CREAT});
46  }
std::shared_ptr< LogWriter > createWriter(File file)
bool folly::FileHandlerFactory::WriterFactory::processOption ( StringPiece  name,
StringPiece  value 
)
inlineoverridevirtual

Process an option.

This should return true if the option was processed successfully, or false if this is an unknown option name. It should throw an exception if the option name is known but there is a problem with the value.

Implements folly::StandardLogHandlerFactory::OptionProcessor.

Definition at line 27 of file FileHandlerFactory.cpp.

References fileWriterFactory_, path_, folly::FileWriterFactory::processOption(), and folly::Range< Iter >::str().

27  {
28  if (name == "path") {
29  path_ = value.str();
30  return true;
31  }
32 
33  // TODO(T29811675): In the future it would be nice to support log rotation,
34  // and add parameters to control when the log file should be rotated.
35 
37  }
bool processOption(StringPiece name, StringPiece value)
const char * name
Definition: http_parser.c:437
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)

Member Data Documentation

FileWriterFactory folly::FileHandlerFactory::WriterFactory::fileWriterFactory_

Definition at line 49 of file FileHandlerFactory.cpp.

Referenced by createWriter(), and processOption().

std::string folly::FileHandlerFactory::WriterFactory::path_

Definition at line 48 of file FileHandlerFactory.cpp.

Referenced by createWriter(), and processOption().


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