refactor(3p/nix/libutil): Replace internal logging library with glog

This commit is contained in:
Vincent Ambo 2020-05-18 02:34:41 +01:00
parent c584480cd4
commit 6dc6c29fa4
10 changed files with 76 additions and 44 deletions

View file

@ -1,6 +1,9 @@
#define GOOGLE_STRIP_LOG 0
#include "config.hh"
#include <glog/logging.h>
#include "args.hh"
#include "json.hh"
// #include <glog/log_severity.h>
namespace nix {
@ -30,9 +33,12 @@ void Config::addSetting(AbstractSetting* setting) {
for (auto& alias : setting->aliases) {
auto i = unknownSettings.find(alias);
if (i != unknownSettings.end()) {
if (set)
warn("setting '%s' is set, but it's an alias of '%s' which is also set",
alias, setting->name);
if (set) {
LOG(WARNING) << "setting '" << alias
<< "' is set, but it's an alias of '" << setting->name
<< "', which is also set";
}
else {
setting->set(i->second);
setting->overriden = true;
@ -44,7 +50,9 @@ void Config::addSetting(AbstractSetting* setting) {
}
void AbstractConfig::warnUnknownSettings() {
for (auto& s : unknownSettings) warn("unknown setting '%s'", s.first);
for (auto& s : unknownSettings) {
LOG(WARNING) << "unknown setting: " << s.first;
}
}
void AbstractConfig::reapplyUnknownSettings() {