proxygen
folly::LogHandlerConfig Class Reference

#include <LogHandlerConfig.h>

Public Types

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

Public Member Functions

 LogHandlerConfig ()
 
 LogHandlerConfig (StringPiece type)
 
 LogHandlerConfig (Optional< StringPiece > type)
 
 LogHandlerConfig (StringPiece type, Options options)
 
 LogHandlerConfig (Optional< StringPiece > type, Options options)
 
void update (const LogHandlerConfig &other)
 
bool operator== (const LogHandlerConfig &other) const
 
bool operator!= (const LogHandlerConfig &other) const
 

Public Attributes

Optional< std::stringtype
 
Options options
 

Detailed Description

Configuration for a LogHandler

Definition at line 29 of file LogHandlerConfig.h.

Member Typedef Documentation

Definition at line 31 of file LogHandlerConfig.h.

Constructor & Destructor Documentation

folly::LogHandlerConfig::LogHandlerConfig ( )

Definition at line 24 of file LogHandlerConfig.cpp.

24 {}
folly::LogHandlerConfig::LogHandlerConfig ( StringPiece  type)
explicit

Definition at line 26 of file LogHandlerConfig.cpp.

References folly::Range< Iter >::str().

26 : type{t.str()} {}
Optional< std::string > type
folly::LogHandlerConfig::LogHandlerConfig ( Optional< StringPiece type)
explicit

Definition at line 28 of file LogHandlerConfig.cpp.

References folly::Optional< Value >::hasValue().

29  : type{t.hasValue() ? Optional<string>{t->str()} : Optional<string>{}} {}
Optional< std::string > type
folly::LogHandlerConfig::LogHandlerConfig ( StringPiece  type,
Options  options 
)

Definition at line 31 of file LogHandlerConfig.cpp.

References folly::gen::move, options, and folly::Range< Iter >::str().

32  : type{t.str()}, options{std::move(opts)} {}
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
Optional< std::string > type
folly::LogHandlerConfig::LogHandlerConfig ( Optional< StringPiece type,
Options  options 
)

Definition at line 34 of file LogHandlerConfig.cpp.

References folly::Optional< Value >::hasValue(), folly::gen::move, and options.

35  : type{t.hasValue() ? Optional<string>{t->str()} : Optional<string>{}},
36  options{std::move(opts)} {}
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
Optional< std::string > type

Member Function Documentation

bool folly::LogHandlerConfig::operator!= ( const LogHandlerConfig other) const

Definition at line 50 of file LogHandlerConfig.cpp.

50  {
51  return !(*this == other);
52 }
bool folly::LogHandlerConfig::operator== ( const LogHandlerConfig other) const

Definition at line 46 of file LogHandlerConfig.cpp.

References options, and type.

46  {
47  return type == other.type && options == other.options;
48 }
Optional< std::string > type
void folly::LogHandlerConfig::update ( const LogHandlerConfig other)

Update this LogHandlerConfig object by merging in settings from another LogConfig.

The other LogHandlerConfig must not have a type set.

Definition at line 38 of file LogHandlerConfig.cpp.

References FOLLY_SAFE_DCHECK, folly::Optional< Value >::hasValue(), option(), options, and type.

Referenced by folly::LoggerDB::startConfigUpdate().

38  {
40  !other.type.hasValue(), "LogHandlerConfig type cannot be updated");
41  for (const auto& option : other.options) {
42  options[option.first] = option.second;
43  }
44 }
#define FOLLY_SAFE_DCHECK(expr, msg)
Definition: SafeAssert.h:42
option(BUILD_SHARED_LIBS"Build shared libraries (DLLs)."OFF) option(gmock_build_tests"Build all of Google Mock's own tests."OFF) if(EXISTS"$
Definition: CMakeLists.txt:10

Member Data Documentation

Optional<std::string> folly::LogHandlerConfig::type

The handler type name.

If this field is unset than this configuration object is intended to be used to update an existing LogHandler object. This field must always be set in the configuration for all existing LogHandler objects.

Definition at line 57 of file LogHandlerConfig.h.

Referenced by folly::logConfigToDynamic(), folly::operator<<(), operator==(), folly::LoggerDB::startConfigUpdate(), and update().


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