mirror of
https://github.com/NixOS/nix
synced 2025-06-30 19:57:59 +02:00
makeTeeLogger(): Distinguish between main and extra loggers
This commit is contained in:
parent
eca002ddc4
commit
37f3b255b2
3 changed files with 20 additions and 7 deletions
|
@ -344,15 +344,16 @@ std::unique_ptr<Logger> makeJSONLogger(const std::filesystem::path & path, bool
|
|||
void applyJSONLogger()
|
||||
{
|
||||
if (!loggerSettings.jsonLogPath.get().empty()) {
|
||||
std::vector<std::unique_ptr<Logger>> loggers;
|
||||
try {
|
||||
loggers.push_back(std::move(logger));
|
||||
std::vector<std::unique_ptr<Logger>> loggers;
|
||||
loggers.push_back(makeJSONLogger(std::filesystem::path(loggerSettings.jsonLogPath.get()), false));
|
||||
logger = makeTeeLogger(std::move(loggers));
|
||||
// Note: this had better not throw, otherwise `logger` is
|
||||
// left unset.
|
||||
logger = makeTeeLogger(std::move(logger), std::move(loggers));
|
||||
} catch (...) {
|
||||
logger = std::move(loggers[0]);
|
||||
ignoreExceptionExceptInterrupt();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue