Chrysalis - Logging
Toggle main menu visibility
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
7
namespace
Logging
{
8
template
<
typename
NameFormatter,
typename
LevelFormatter>
9
class
LoggerFormatter
{
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
Logging::LoggerFormatter
Definition
LoggerFormatter.h:9
Logging::LoggerFormatter::apply
static void apply(const std::shared_ptr< spdlog::sinks::sink > &sink)
Definition
LoggerFormatter.h:11
Logging
Definition
BaseConsoleUser.h:4
logging
include
LoggerFormatter.h
Generated by
1.17.0