Chrysalis - Logging
Loading...
Searching...
No Matches
LoggerFormatter.h
Go to the documentation of this file.
1#ifndef CHRYSALIS_LOGGERFORMATTER_H
2#define CHRYSALIS_LOGGERFORMATTER_H
3
4#include <spdlog/sinks/sink.h>
5#include <spdlog/pattern_formatter.h>
6
7namespace Logging {
8 template<typename NameFormatter, typename LevelFormatter>
10 public:
11 static void apply(const std::shared_ptr<spdlog::sinks::sink>& sink) {
12 static constexpr auto PATTERN = "%Y-%m-%d %H:%M:%S.%e [%*] [%&] %v";
13
14 auto formatter = std::make_unique<spdlog::pattern_formatter>();
15 formatter->add_flag<NameFormatter>('&');
16 formatter->add_flag<LevelFormatter>('*');
17 formatter->set_pattern(PATTERN);
18
19 sink->set_formatter(std::move(formatter));
20 }
21 };
22}
23
24#endif //CHRYSALIS_LOGGERFORMATTER_H
Definition LoggerFormatter.h:9
static void apply(const std::shared_ptr< spdlog::sinks::sink > &sink)
Definition LoggerFormatter.h:11
Definition BaseConsoleUser.h:4