mirror of
https://github.com/FairRootGroup/FairLogger.git
synced 2025-10-13 00:31:12 +00:00
Throw if removing non-existing sink or adding existing
This commit is contained in:
parent
e9bd3f2b62
commit
1253bbbac8
|
@ -577,6 +577,7 @@ void Logger::AddCustomSink(const string& key, Severity severity, function<void(c
|
|||
UpdateMinSeverity();
|
||||
} else {
|
||||
cout << "Logger::AddCustomSink: sink '" << key << "' already exists, will not add again. Remove first with Logger::RemoveCustomSink(const string& key)" << endl;
|
||||
throw runtime_error("Adding a sink with a key that already exists. Remove first.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -597,6 +598,7 @@ void Logger::RemoveCustomSink(const string& key)
|
|||
UpdateMinSeverity();
|
||||
} else {
|
||||
cout << "Logger::RemoveCustomSink: sink '" << key << "' doesn't exists, will not remove." << endl;
|
||||
throw runtime_error("Trying to remove a sink with a key that does not exist.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <mutex>
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <time.h> // time_t
|
||||
#include <type_traits> // is_same
|
||||
|
|
Loading…
Reference in New Issue
Block a user