-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: log more detailed info to log files
- Loading branch information
Showing
6 changed files
with
49 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include "log.h" | ||
#include <memory> | ||
#include <spdlog/sinks/basic_file_sink.h> | ||
#include <spdlog/sinks/stdout_color_sinks.h> | ||
#include <spdlog/spdlog.h> | ||
|
||
void log_to_console_and_file() | ||
{ | ||
auto console_sink{std::make_shared<spdlog::sinks::stdout_color_sink_mt>()}; | ||
console_sink->set_level(spdlog::level::warn); | ||
|
||
auto file_sink{std::make_shared<spdlog::sinks::basic_file_sink_mt>( | ||
"logs/multisink.txt", true)}; | ||
file_sink->set_level(spdlog::level::trace); | ||
|
||
auto logger{std::make_shared<spdlog::logger>( | ||
"", spdlog::sinks_init_list{console_sink, file_sink})}; | ||
|
||
spdlog::default_logger()->name(); | ||
spdlog::set_default_logger(logger); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#pragma once | ||
|
||
void log_to_console_and_file(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters