diff --git a/logger/Logger.cxx b/logger/Logger.cxx index 10e77bd..27ec2e1 100644 --- a/logger/Logger.cxx +++ b/logger/Logger.cxx @@ -489,7 +489,7 @@ void Logger::SetConsoleColor(const bool colored) fColored = colored; } -void Logger::InitFileSink(const Severity severity, const string& filename, bool customizeName) +string Logger::InitFileSink(const Severity severity, const string& filename, bool customizeName) { lock_guard lock(fMtx); if (fFileStream.is_open()) { @@ -520,15 +520,16 @@ void Logger::InitFileSink(const Severity severity, const string& filename, bool cout << "Error opening file: " << fullName; } + return fullName; } -void Logger::InitFileSink(const string& severityStr, const string& filename, bool customizeName) +string Logger::InitFileSink(const string& severityStr, const string& filename, bool customizeName) { if (fSeverityMap.count(severityStr)) { - InitFileSink(fSeverityMap.at(severityStr), filename, customizeName); + return InitFileSink(fSeverityMap.at(severityStr), filename, customizeName); } else { LOG(error) << "Unknown severity setting: '" << severityStr << "', setting to default 'info'."; - InitFileSink(Severity::info, filename); + return InitFileSink(Severity::info, filename); } } diff --git a/logger/Logger.h b/logger/Logger.h index 5c8fee5..fba5fc9 100644 --- a/logger/Logger.h +++ b/logger/Logger.h @@ -272,8 +272,8 @@ class Logger static void SetConsoleColor(const bool colored = true); - static void InitFileSink(const Severity severity, const std::string& filename, bool customizeName = true); - static void InitFileSink(const std::string& severityStr, const std::string& filename, bool customizeName = true); + static std::string InitFileSink(const Severity severity, const std::string& filename, bool customizeName = true); + static std::string InitFileSink(const std::string& severityStr, const std::string& filename, bool customizeName = true); static void RemoveFileSink();