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
9
#include "
util/common/logging.hpp
"
10
11
#include <libnuraft/nuraft.hxx>
12
13
namespace
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_
cbdc::raft::console_logger
nuraft::logger implementation using logging::log.
Definition
console_logger.hpp:25
cbdc::raft::console_logger::get_level
auto get_level() -> int override
Return the log level of the underlying logger.
Definition
console_logger.cpp:60
cbdc::raft::console_logger::console_logger
console_logger(std::shared_ptr< logging::log > log)
Constructor.
Definition
console_logger.cpp:9
cbdc::raft::console_logger::put_details
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.
Definition
console_logger.cpp:12
logging.hpp
cbdc::raft
Definition
console_logger.cpp:8
cbdc::raft::log_level
log_level
Map from NuRaft-internal log levels to names.
Definition
console_logger.hpp:15
cbdc::raft::log_level::trace
@ trace
cbdc::raft::log_level::warn
@ warn
cbdc::raft::log_level::debug
@ debug
cbdc::raft::log_level::info
@ info
cbdc::raft::log_level::error
@ error
cbdc::raft::log_level::fatal
@ fatal
src
util
raft
console_logger.hpp
Generated by
1.12.0