1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 16:51:15 +02:00

logError, logWarning; Logger functions; switch to Verbosity enum

This commit is contained in:
Ben Burdette 2020-04-17 15:07:44 -06:00
parent 12814806ef
commit 3d5b1032a1
7 changed files with 128 additions and 66 deletions

View file

@ -3,6 +3,7 @@
#include <atomic>
#include <nlohmann/json.hpp>
#include <sstream>
namespace nix {
@ -57,6 +58,14 @@ public:
writeToStderr(prefix + filterANSIEscapes(fs.s, !tty) + "\n");
}
void logEI(const ErrorInfo & ei) override
{
std::stringstream oss;
oss << ei;
log(ei.level, oss.str());
}
void startActivity(ActivityId act, Verbosity lvl, ActivityType type,
const std::string & s, const Fields & fields, ActivityId parent)
override
@ -135,6 +144,15 @@ struct JSONLogger : Logger
write(json);
}
void logEI(const ErrorInfo & ei) override
{
// nlohmann::json json;
// json["action"] = "msg";
// json["level"] = lvl;
// json["msg"] = fs.s;
// write(json);
}
void startActivity(ActivityId act, Verbosity lvl, ActivityType type,
const std::string & s, const Fields & fields, ActivityId parent) override
{