mirror of
https://github.com/FairRootGroup/FairLogger.git
synced 2025-10-13 16:46:46 +00:00
Throw if removing non-existing sink or adding existing
This commit is contained in:
parent
adcd48937a
commit
63e7850ad3
|
@ -577,6 +577,7 @@ void Logger::AddCustomSink(const string& key, Severity severity, function<void(c
|
||||||
UpdateMinSeverity();
|
UpdateMinSeverity();
|
||||||
} else {
|
} else {
|
||||||
cout << "Logger::AddCustomSink: sink '" << key << "' already exists, will not add again. Remove first with Logger::RemoveCustomSink(const string& key)" << endl;
|
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();
|
UpdateMinSeverity();
|
||||||
} else {
|
} else {
|
||||||
cout << "Logger::RemoveCustomSink: sink '" << key << "' doesn't exists, will not remove." << endl;
|
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 <mutex>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <time.h> // time_t
|
#include <time.h> // time_t
|
||||||
#include <type_traits> // is_same
|
#include <type_traits> // is_same
|
||||||
|
|
Loading…
Reference in New Issue
Block a user