OpenCBDC Transaction Processor
Loading...
Searching...
No Matches
console_logger.hpp
Go to the documentation of this file.
1// Copyright (c) 2021 MIT Digital Currency Initiative,
2// Federal Reserve Bank of Boston
3// Distributed under the MIT software license, see the accompanying
4// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6#ifndef OPENCBDC_TX_SRC_RAFT_CONSOLE_LOGGER_H_
7#define OPENCBDC_TX_SRC_RAFT_CONSOLE_LOGGER_H_
8
10
11#include <libnuraft/nuraft.hxx>
12
13namespace cbdc::raft {
15 enum class log_level : int {
16 trace = 6,
17 debug = 5,
18 info = 4,
19 warn = 3,
20 error = 2,
21 fatal = 1
22 };
23
25 class console_logger : public nuraft::logger {
26 public:
29 explicit console_logger(std::shared_ptr<logging::log> log);
30
38 void put_details(int level,
39 const char* source_file,
40 const char* func_name,
41 size_t line_number,
42 const std::string& log_line) override;
43
46 [[nodiscard]] auto get_level() -> int override;
47
48 private:
49 std::shared_ptr<logging::log> m_log;
50 };
51}
52
53#endif // OPENCBDC_TX_SRC_RAFT_CONSOLE_LOGGER_H_
nuraft::logger implementation using logging::log.
auto get_level() -> int override
Return the log level of the underlying logger.
console_logger(std::shared_ptr< logging::log > log)
Constructor.
void put_details(int level, const char *source_file, const char *func_name, size_t line_number, const std::string &log_line) override
Write a log message to the log.
log_level
Map from NuRaft-internal log levels to names.