Loading...
Searching...
No Matches
logger.hpp
1/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com)
2 *
3 * Distributed under the Boost Software License, Version 1.0. (See
4 * accompanying file LICENSE.txt)
5 */
6
7#ifndef BOOST_REDIS_LOGGER_HPP
8#define BOOST_REDIS_LOGGER_HPP
9
10#include <functional>
11#include <string_view>
12
13namespace boost::redis {
14
20struct logger {
24 enum class level
25 {
28
30 emerg,
31
33 alert,
34
36 crit,
37
39 err,
40
42 warning,
43
45 notice,
46
48 info,
49
51 debug,
52 };
53
65
76 logger(level l, std::function<void(level, std::string_view)> fn)
77 : lvl{l}
78 , fn{std::move(fn)}
79 { }
80
88
95 std::function<void(level, std::string_view)> fn;
96};
97
98} // namespace boost::redis
99
100#endif // BOOST_REDIS_LOGGER_HPP
level
Syslog-like log levels.
Definition logger.hpp:25
Defines logging configuration.
Definition logger.hpp:20
logger(level l, std::function< void(level, std::string_view)> fn)
Constructor from a level and a function.
Definition logger.hpp:76
logger(level l=level::info)
Constructor from a level.
std::function< void(level, std::string_view)> fn
Defines a severity filter for messages.
Definition logger.hpp:95
level lvl
Defines a severity filter for messages.
Definition logger.hpp:87