userver: userver/logging/logger.hpp Source File
Loading...
Searching...
No Matches
logger.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/logging/logger.hpp
4/// @brief Logger definitions and helpers
5
6#include <memory>
7#include <string>
8
9#include <userver/logging/format.hpp>
10#include <userver/logging/fwd.hpp>
11#include <userver/logging/level.hpp>
12
13USERVER_NAMESPACE_BEGIN
14
15namespace logging {
16
17namespace impl {
18
19class LoggerBase;
20void LogRaw(LoggerBase& logger, Level level, std::string_view message);
21
22} // namespace impl
23
24/// @brief Creates synchronous stderr logger with default tskv pattern
25/// @param name logger name, for internal use, must be unique
26/// @see components::Logging
27LoggerPtr MakeStderrLogger(const std::string& name, Format format, Level level = Level::kInfo);
28
29/// @brief Creates synchronous stdout logger with default tskv pattern
30/// @param name logger name, for internal use, must be unique
31/// @see components::Logging
32LoggerPtr MakeStdoutLogger(const std::string& name, Format format, Level level = Level::kInfo);
33
34/// @brief Creates synchronous file logger with default tskv pattern
35/// @param name logger name, for internal use, must be unique
36/// @param path target log file path
37/// @see components::Logging
38LoggerPtr MakeFileLogger(const std::string& name, const std::string& path, Format format, Level level = Level::kInfo);
39
40namespace impl {
41class TagWriter;
42}
43
44namespace impl::default_ {
45
46bool DoShouldLog(Level) noexcept;
47
48void PrependCommonTags(TagWriter writer);
49
50} // namespace impl::default_
51
52} // namespace logging
53
54USERVER_NAMESPACE_END