mirror of
https://github.com/NixOS/nix.git
synced 2025-11-11 21:16:02 +01: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()) {
|
||||||
|
std::vector<std::unique_ptr<Logger>> loggers;
|
||||||
try {
|
try {
|
||||||
std::vector<std::unique_ptr<Logger>> loggers;
|
|
||||||
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