logger: reformatting

This commit is contained in:
Moritz Bunkus 2021-03-03 11:16:31 +01:00
parent 5dfa723d15
commit d18ac8e5df
No known key found for this signature in database
GPG Key ID: 74AF00ADF2E32C85

View File

@ -52,7 +52,9 @@ target_c::format_line(std::string const &message) {
target_c &
target_c::get_default_logger() {
if (!s_default_logger) {
if (s_default_logger)
return *s_default_logger;
auto var = mtx::sys::get_environment_variable("MTX_LOGGER");
if (var.empty()) {
@ -66,7 +68,7 @@ target_c::get_default_logger() {
auto spec = mtx::string::split(var, ":");
if (spec[0] == "file") {
auto file = (spec.size() > 1) && !spec[1].empty() ? spec[1] : "mkvtoolnix-debug.log"s;
auto file = (spec.size() > 1) && !spec[1].empty() ? spec[1] : "mkvtoolnix-debug.txt"s;
set_default_logger(target_cptr{new file_target_c{mtx::fs::to_path(file)}});
@ -77,7 +79,7 @@ target_c::get_default_logger() {
} else
set_default_logger(target_cptr{new stderr_target_c{}});
}
return *s_default_logger;
}