userver
C++ Async Framework
Loading...
Searching...
No Matches
level.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/logging/level.hpp
4
/// @brief Log levels
5
6
#
include
<
optional
>
7
#
include
<
string
>
8
9
USERVER_NAMESPACE_BEGIN
10
11
/// Logging macro and utilities
12
namespace
logging
{
13
14
/// Log levels
15
enum
class
Level
{
16
kTrace = 0,
17
kDebug = 1,
18
kInfo = 2,
19
kWarning = 3,
20
kError = 4,
21
kCritical = 5,
22
kNone = 6
23
};
24
25
inline
constexpr
auto
kLevelMax =
static_cast
<
int
>(
Level
::kNone);
26
27
/// @brief Converts lowercase level name to a corresponding Level, throws
28
/// std::runtime_error if no matching log level found.
29
Level
LevelFromString
(
std
::
string_view
);
30
31
/// @brief Returns a string representation of logging level, e.g. "info"
32
std
::
string_view
ToString
(
Level
level
);
33
34
/// @brief Returns a string representation of logging level, e.g. "INFO"
35
std
::
string_view
ToUpperCaseString
(
Level
level
)
noexcept
;
36
37
/// @brief Returns std::nullopt if level_name is std::nullopt, otherwise
38
/// behaves exactly like logging::LevelFromString.
39
std::optional<
Level
>
OptionalLevelFromString
(
40
const
std::optional<std::string>& level_name);
41
42
}
// namespace logging
43
44
USERVER_NAMESPACE_END
userver
logging
level.hpp
Generated on Wed Oct 4 2023 12:19:25 for userver by
Doxygen
1.9.8