diff --git a/src/BasicChannel.h b/src/BasicChannel.h index 2086048..a42ffcc 100644 --- a/src/BasicChannel.h +++ b/src/BasicChannel.h @@ -67,7 +67,7 @@ namespace ts { auto permission_manager = this->permissions(); /* copy the manager */ assert(permission_manager); const auto data = permission_manager->permission_value_flagged(permission); - return BasicChannel::permission_granted(data,granted_value, require_granted_value); + return BasicChannel::permission_granted(data, granted_value, require_granted_value); } ts_always_inline bool talk_power_granted(const permission::v2::PermissionFlaggedValue& granted_value) { diff --git a/src/log/LogUtils.cpp b/src/log/LogUtils.cpp index 8f0ca11..f90190e 100644 --- a/src/log/LogUtils.cpp +++ b/src/log/LogUtils.cpp @@ -110,30 +110,25 @@ namespace logger { logger(0)->debug("Creating new grouped logger for group {}", group); vector sinks; - string path; - if(logConfig->logfileLevel != spdlog::level::off) { - path = generate_log_file(group); + auto path = generate_log_file(group); - auto logFile = fs::u8path(path); - if(!logFile.parent_path().empty()) - fs::create_directories(logFile.parent_path()); + auto logFile = fs::u8path(path); + if(!logFile.parent_path().empty()) + fs::create_directories(logFile.parent_path()); - try { - auto sink = make_shared(logFile.string(), 1024 * 1024 * 50, 12); - sink->set_formatter(std::make_unique(::logger::currentConfig()->file_colored)); - sinks.push_back(sink); - } catch(std::exception& ex) { - if(group != 0 && group != -1) - logger(0)->critical("Failed to create file for new log group: {}", ex.what()); - else + try { + auto sink = make_shared(logFile.string(), 1024 * 1024 * 50, 12); + sink->set_formatter(std::make_unique(::logger::currentConfig()->file_colored)); + sinks.push_back(sink); + } catch(std::exception& ex) { + if(group != 0 && group != -1) + logger(0)->critical("Failed to create file for new log group: {}", ex.what()); + else #ifdef HAVE_CXX_TERMINAL - terminal::instance()->writeMessage("§4[CRITICAL] §eFailed to create main log file: " + string{ex.what()}, false); + terminal::instance()->writeMessage("§4[CRITICAL] §eFailed to create main log file: " + string{ex.what()}, false); #else - std::cout << "[CRITICAL] Failed to create main log file: " << ex.what() << "\n"; + std::cout << "[CRITICAL] Failed to create main log file: " << ex.what() << "\n"; #endif - } - } else { - path = "/dev/null (" + to_string(group) + ")"; } sinks.push_back(terminalSink); @@ -143,6 +138,7 @@ namespace logger { std::shared_ptr logger; if(!logConfig->sync) { logger = std::make_shared("Logger (" + path + ")", sinks.begin(), sinks.end(), logging_threads, async_overflow_policy::block); + logger->flush_on(level::debug); } else { logger = std::make_shared("Logger (" + path + ")", sinks.begin(), sinks.end()); logger->flush_on(level::trace);