mirror of
https://github.com/FairRootGroup/FairLogger.git
synced 2025-10-13 16:46:46 +00:00
InitFileSink(): return name of the created file
This commit is contained in:
parent
1f3b2a2c82
commit
e9bd3f2b62
|
@ -489,7 +489,7 @@ void Logger::SetConsoleColor(const bool colored)
|
||||||
fColored = 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<mutex> lock(fMtx);
|
lock_guard<mutex> lock(fMtx);
|
||||||
if (fFileStream.is_open()) {
|
if (fFileStream.is_open()) {
|
||||||
|
@ -520,15 +520,16 @@ void Logger::InitFileSink(const Severity severity, const string& filename, bool
|
||||||
cout << "Error opening file: " << fullName;
|
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)) {
|
if (fSeverityMap.count(severityStr)) {
|
||||||
InitFileSink(fSeverityMap.at(severityStr), filename, customizeName);
|
return InitFileSink(fSeverityMap.at(severityStr), filename, customizeName);
|
||||||
} else {
|
} else {
|
||||||
LOG(error) << "Unknown severity setting: '" << severityStr << "', setting to default 'info'.";
|
LOG(error) << "Unknown severity setting: '" << severityStr << "', setting to default 'info'.";
|
||||||
InitFileSink(Severity::info, filename);
|
return InitFileSink(Severity::info, filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -272,8 +272,8 @@ class Logger
|
||||||
|
|
||||||
static void SetConsoleColor(const bool colored = true);
|
static void SetConsoleColor(const bool colored = true);
|
||||||
|
|
||||||
static void InitFileSink(const Severity severity, const std::string& filename, bool customizeName = true);
|
static std::string 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 std::string& severityStr, const std::string& filename, bool customizeName = true);
|
||||||
|
|
||||||
static void RemoveFileSink();
|
static void RemoveFileSink();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user