Improved logging abstraction

This also gets rid of --log-type, since the nested log type isn't
useful in a multi-threaded situation, and nobody cares about the
"pretty" log type.
This commit is contained in:
Eelco Dolstra 2016-04-25 15:26:07 +02:00
parent c879a20850
commit 41633f9f73
29 changed files with 394 additions and 456 deletions

View file

@ -18,15 +18,6 @@ MixCommonArgs::MixCommonArgs(const string & programName)
verbosity = lvlDebug;
});
mkFlag1(0, "log-type", "type", "set logging format ('pretty', 'flat', 'systemd')",
[](std::string s) {
if (s == "pretty") logType = ltPretty;
else if (s == "escapes") logType = ltEscapes;
else if (s == "flat") logType = ltFlat;
else if (s == "systemd") logType = ltSystemd;
else throw UsageError("unknown log type");
});
mkFlag(0, "option", {"name", "value"}, "set a Nix configuration option (overriding nix.conf)", 2,
[](Strings ss) {
auto name = ss.front(); ss.pop_front();

View file

@ -111,8 +111,7 @@ void initNix()
std::cerr.rdbuf()->pubsetbuf(buf, sizeof(buf));
#endif
if (getEnv("IN_SYSTEMD") == "1")
logType = ltSystemd;
logger = makeDefaultLogger();
/* Initialise OpenSSL locking. */
opensslLocks = std::vector<std::mutex>(CRYPTO_num_locks());