proxygen
|
#include <LogName.h>
Classes | |
struct | Equals |
struct | Hash |
Static Public Member Functions | |
static std::string | canonicalize (folly::StringPiece name) |
static size_t | hash (folly::StringPiece name) |
static int | cmp (folly::StringPiece nameA, folly::StringPiece nameB) |
static folly::StringPiece | getParent (folly::StringPiece name) |
The LogName class contains utility functions for processing log category names. It primarily handles canonicalization of names.
For instance, "foo.bar", "foo/bar", "foo..bar", and ".foo.bar..." all refer to the same log category.
|
static |
Return a canonicalized version of the log name.
'/' and '\' characters are converted to '.', then leading and trailing '.' characters are removed, and all sequences of consecutive '.' characters are replaced with a single '.'
Definition at line 26 of file LogName.cpp.
References folly::test::end(), folly::Range< Iter >::size(), and string.
Referenced by folly::LogCategory::LogCategory(), folly::parseLogConfigDynamic(), TEST(), and TEST_F().
|
static |
Compare two log names.
The log name does not need to be pre-canonicalized. Returns 0 if and only if the two names refer to the same log category. Otherwise, returns -1 if the canonical version of nameA is less than the canonical version of nameB.
Definition at line 81 of file LogName.cpp.
References folly::Range< Iter >::empty(), folly::Range< Iter >::front(), s, and folly::Range< Iter >::uncheckedAdvance().
Referenced by folly::LogName::Equals::operator()(), and TEST().
|
static |
Get the name of the parent log category.
Returns a StringPiece pointing into the input data. As a result, the parent log name may not be canonical if the input log name is not already canonical.
If the input log name refers to the root log category, an empty StringPiece will be returned.
Definition at line 126 of file LogName.cpp.
References folly::Range< Iter >::begin(), folly::Range< Iter >::empty(), name, and folly::Range< Iter >::size().
Referenced by folly::LoggerDB::getOrCreateCategoryLocked(), and TEST().
|
static |
Hash a log name.
The log name does not need to be pre-canonicalized. The hash for equivalent log names will always be equal.
Definition at line 52 of file LogName.cpp.
References folly::test::end(), folly::Range< Iter >::size(), uint32_t, uint8_t, and folly::value().
Referenced by folly::LogName::Hash::operator()(), and TEST().