28#include <spdlog/common.h>
29#include <spdlog/sinks/rotating_file_sink.h>
30#include <spdlog/sinks/stdout_color_sinks.h>
43 auto spdlog_logger = spdlog::stdout_color_mt(
"stdout");
46 return std::make_shared<impl::spdlog_backend::SpdlogLogSink>(
47 std::move(spdlog_logger));
56 std::string_view file_path, std::size_t max_file_size,
57 std::size_t max_files) {
58 auto spdlog_logger = spdlog::rotating_logger_mt(std::string(file_path),
59 spdlog::filename_t(file_path), max_file_size, max_files,
true);
62 return std::make_shared<impl::spdlog_backend::SpdlogLogSink>(
63 std::move(spdlog_logger));
68 if (
config.file_path().empty()) {
Class of Logging configuration.
Definition of ILogSink class.
Declaration of functions to create log sinks.
Namespace of configurations.
void configure_spdlog_logger_format_for_consoles(const std::shared_ptr< spdlog::logger > &logger)
Configure the log format of a logger in spdlog library for output to consoles.
void configure_spdlog_logger_format_for_files(const std::shared_ptr< spdlog::logger > &logger)
Configure the log format of a logger in spdlog library for output to files.
std::shared_ptr< ILogSink > create_rotating_file_log_sink(std::string_view file_path, std::size_t max_file_size, std::size_t max_files)
Create a log sink to write to a file with rotation.
std::shared_ptr< ILogSink > create_stdout_log_sink()
Create a log sink to write to standard output.
std::shared_ptr< ILogSink > create_log_sink_from_config(const config::LoggingConfig &config)
Create a log sink from a configuration.
std::shared_ptr< ILogSink > create_stdout_log_sink_impl()
Create a log sink to write to standard output.
Definition of SpdlogLogSink class.