mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-29 23:03:18 +00:00
improvements in logging
This commit is contained in:
parent
5a30f0711e
commit
6a5308d521
3 changed files with 28 additions and 17 deletions
|
@ -1,21 +1,25 @@
|
|||
#include <vector>
|
||||
#include <spdlog/common.h>
|
||||
#include <spdlog/sinks/stdout_color_sinks.h>
|
||||
#include <spdlog/pattern_formatter.h>
|
||||
#include <spdlog/sinks/basic_file_sink.h>
|
||||
#include <spdlog/sinks/stdout_color_sinks.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace logging {
|
||||
std::vector<spdlog::sink_ptr> sinks;
|
||||
std::vector<spdlog::sink_ptr> sinks;
|
||||
|
||||
int init(bool use_stdout) {
|
||||
auto f = std::make_unique<spdlog::pattern_formatter>("%^|%L|: %v%$", spdlog::pattern_time_type::local, std::string("")); // disable eol
|
||||
spdlog::set_formatter(std::move(f));
|
||||
sinks.clear();//clear existing sinks
|
||||
if (use_stdout)//if we use stdout window then init it as well
|
||||
sinks.push_back(std::make_shared<spdlog::sinks::stdout_color_sink_mt>());
|
||||
int init(bool use_stdout) {
|
||||
sinks.clear(); // clear existing sinks
|
||||
if (use_stdout) // if we use stdout window then init it as well
|
||||
sinks.push_back(std::make_shared<spdlog::sinks::stdout_color_sink_mt>());
|
||||
sinks.push_back(std::make_shared<spdlog::sinks::basic_file_sink_mt>(L"shadps4.txt", true));
|
||||
spdlog::set_default_logger(std::make_shared<spdlog::logger>("shadps4 logger", begin(sinks), end(sinks)));
|
||||
auto f = std::make_unique<spdlog::pattern_formatter>("%^|%L|: %v%$", spdlog::pattern_time_type::local, std::string("")); // disable eol
|
||||
spdlog::set_formatter(std::move(f));
|
||||
return 0; // all ok
|
||||
}
|
||||
|
||||
return 0;//all ok
|
||||
}
|
||||
}
|
||||
void set_level(spdlog::level::level_enum log_level) { spdlog::set_level(log_level); }
|
||||
|
||||
} // namespace logging
|
Loading…
Add table
Add a link
Reference in a new issue