1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-30 19:57:59 +02:00
This commit is contained in:
Eelco Dolstra 2025-03-26 23:49:35 +01:00
parent c8692b378b
commit 17d0810a7c
4 changed files with 18 additions and 21 deletions

View file

@ -341,6 +341,20 @@ std::unique_ptr<Logger> makeJSONLogger(const std::filesystem::path & path, bool
return std::make_unique<JSONFileLogger>(std::move(fd), includeNixPrefix);
}
void applyJSONLogger()
{
if (!loggerSettings.jsonLogPath.get().empty()) {
try {
std::vector<std::unique_ptr<Logger>> loggers;
loggers.push_back(std::move(logger));
loggers.push_back(makeJSONLogger(std::filesystem::path(loggerSettings.jsonLogPath.get()), false));
logger = makeTeeLogger(std::move(loggers));
} catch (...) {
ignoreExceptionExceptInterrupt();
}
}
}
static Logger::Fields getFields(nlohmann::json & json)
{
Logger::Fields fields;