TARAXA
Loading...
Searching...
No Matches
logging_config.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <spdlog/common.h>
4
5#include <filesystem>
6#include <string>
7
8namespace fs = std::filesystem;
9
10namespace taraxa {
11
16 enum class LoggingType { Console, File };
17
22 struct SinkConfig {
23 SinkConfig() = default;
24
26 std::string name{"console"};
27 std::string file_name;
28 std::optional<std::filesystem::path> file_dir;
29 std::filesystem::path file_full_path; // file_path(or default value) + file_name
30 std::string format{"[%Y-%m-%d %H:%M:%S.%e] [%n] [%l] %v"};
31 spdlog::level::level_enum verbosity{spdlog::level::err};
32 uint64_t rotation_size{10000000};
33 uint64_t max_files_num{20};
34 bool on{true};
35 std::optional<std::vector<std::string>> channels;
36 };
37
38 std::unordered_map<std::string, spdlog::level::level_enum> channels;
39 std::vector<SinkConfig> outputs;
40};
41
42} // namespace taraxa
Definition app.hpp:16
By default all loggers are registered to sinks without specified channels. If sink config has specifi...
Definition logging_config.hpp:22
std::string file_name
Definition logging_config.hpp:27
std::optional< std::filesystem::path > file_dir
Definition logging_config.hpp:28
std::string name
Definition logging_config.hpp:26
LoggingType type
Definition logging_config.hpp:25
std::filesystem::path file_full_path
Definition logging_config.hpp:29
bool on
Definition logging_config.hpp:34
std::string format
Definition logging_config.hpp:30
uint64_t rotation_size
Definition logging_config.hpp:32
uint64_t max_files_num
Definition logging_config.hpp:33
spdlog::level::level_enum verbosity
Definition logging_config.hpp:31
std::optional< std::vector< std::string > > channels
Definition logging_config.hpp:35
Definition logging_config.hpp:12
LoggingType
Logging type.
Definition logging_config.hpp:16
std::unordered_map< std::string, spdlog::level::level_enum > channels
Definition logging_config.hpp:38
std::vector< SinkConfig > outputs
Definition logging_config.hpp:39