mirror of
https://github.com/NixOS/nix
synced 2025-07-01 08:28:00 +02:00
Don't segfault if we can't create the JSON logger
This commit is contained in:
parent
17d0810a7c
commit
eca002ddc4
1 changed files with 2 additions and 1 deletions
|
@ -344,12 +344,13 @@ std::unique_ptr<Logger> makeJSONLogger(const std::filesystem::path & path, bool
|
||||||
void applyJSONLogger()
|
void applyJSONLogger()
|
||||||
{
|
{
|
||||||
if (!loggerSettings.jsonLogPath.get().empty()) {
|
if (!loggerSettings.jsonLogPath.get().empty()) {
|
||||||
try {
|
|
||||||
std::vector<std::unique_ptr<Logger>> loggers;
|
std::vector<std::unique_ptr<Logger>> loggers;
|
||||||
|
try {
|
||||||
loggers.push_back(std::move(logger));
|
loggers.push_back(std::move(logger));
|
||||||
loggers.push_back(makeJSONLogger(std::filesystem::path(loggerSettings.jsonLogPath.get()), false));
|
loggers.push_back(makeJSONLogger(std::filesystem::path(loggerSettings.jsonLogPath.get()), false));
|
||||||
logger = makeTeeLogger(std::move(loggers));
|
logger = makeTeeLogger(std::move(loggers));
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
|
logger = std::move(loggers[0]);
|
||||||
ignoreExceptionExceptInterrupt();
|
ignoreExceptionExceptInterrupt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue