treewide: don't call Logger output functions directly
always use log macros, which also have the benefit of respecting the verbosity setting without needing virtual function calls to read it. Change-Id: I1c605562a53e54140724d5225e040abcf49ac996
This commit is contained in:
@@ -1155,7 +1155,7 @@ try {
|
||||
std::shared_ptr<Error> remoteError;
|
||||
if (result.getResult().isBad()) {
|
||||
remoteError = std::make_shared<Error>(from(result.getResult().getBad()));
|
||||
logger->logEI(remoteError->info());
|
||||
logErrorInfo(remoteError->info().level, remoteError->info());
|
||||
}
|
||||
co_return HookResult::Accept{TRY_AWAIT(buildDone(remoteError))};
|
||||
} catch (...) {
|
||||
|
||||
@@ -61,16 +61,15 @@ void setStackSize(rlim_t stackSize)
|
||||
savedStackSize = limit.rlim_cur;
|
||||
limit.rlim_cur = std::min(stackSize, limit.rlim_max);
|
||||
if (setrlimit(RLIMIT_STACK, &limit) != 0) {
|
||||
logger->log(
|
||||
lvlError,
|
||||
HintFmt(
|
||||
"Failed to increase stack size from %1% to %2% (maximum allowed stack size: %3%): %4%",
|
||||
savedStackSize,
|
||||
stackSize,
|
||||
limit.rlim_max,
|
||||
std::strerror(errno)
|
||||
).str()
|
||||
);
|
||||
printError(HintFmt(
|
||||
"Failed to increase stack size from %1% to %2% (maximum allowed "
|
||||
"stack size: %3%): %4%",
|
||||
savedStackSize,
|
||||
stackSize,
|
||||
limit.rlim_max,
|
||||
std::strerror(errno)
|
||||
)
|
||||
.str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ struct CmdDoctor : StoreCommand
|
||||
|
||||
void run(ref<Store> store) override
|
||||
{
|
||||
logger->log("Running checks against store uri: " + store->getUri());
|
||||
printInfo("Running checks against store uri: " + store->getUri());
|
||||
|
||||
if (store.try_cast_shared<LocalFSStore>()) {
|
||||
success &= checkNixInPath();
|
||||
|
||||
+3
-3
@@ -424,9 +424,9 @@ struct CmdFlakeCheck : FlakeCommand
|
||||
// FIXME: check meta attributes
|
||||
auto storePath = drvInfo->queryDrvPath(*state);
|
||||
if (storePath) {
|
||||
logger->log(lvlInfo,
|
||||
fmt("derivation evaluated to %s",
|
||||
store->printStorePath(storePath.value())));
|
||||
printInfo(
|
||||
"derivation evaluated to %s", store->printStorePath(storePath.value())
|
||||
);
|
||||
}
|
||||
return storePath;
|
||||
}
|
||||
|
||||
@@ -83,11 +83,9 @@ auto resolveNamedConstituents(const std::map<std::string, nix::JSON> &jobs)
|
||||
const nix::JSON &job) -> bool {
|
||||
if (job.find("error") != job.end()) {
|
||||
std::string error = job["error"];
|
||||
nix::logger->log(
|
||||
nix::lvlError,
|
||||
nix::fmt(
|
||||
"aggregate job '%s' references broken job '%s': %s",
|
||||
jobName, childJobName, error));
|
||||
printError(
|
||||
"aggregate job '%s' references broken job '%s': %s",
|
||||
jobName, childJobName, error);
|
||||
brokenJobs[childJobName] = error;
|
||||
return true;
|
||||
}
|
||||
@@ -97,10 +95,9 @@ auto resolveNamedConstituents(const std::map<std::string, nix::JSON> &jobs)
|
||||
for (const std::string childJobName : *named) {
|
||||
auto childJobIter = jobs.find(childJobName);
|
||||
if (childJobIter == jobs.end()) {
|
||||
nix::logger->log(nix::lvlError,
|
||||
nix::fmt("aggregate job '%s' references "
|
||||
"non-existent job '%s'",
|
||||
jobName, childJobName));
|
||||
printError(
|
||||
"aggregate job '%s' references non-existent job '%s'",
|
||||
jobName, childJobName);
|
||||
brokenJobs[childJobName] = "does not exist";
|
||||
} else if (!isBroken(childJobName, childJobIter->second)) {
|
||||
results.insert(childJobName);
|
||||
@@ -156,10 +153,8 @@ void rewriteAggregates(std::map<std::string, nix::JSON> &jobs,
|
||||
|
||||
register_gc_root(gcRootsDir, newDrvPathS, store, aio);
|
||||
|
||||
nix::logger->log(nix::lvlDebug,
|
||||
nix::fmt("rewrote aggregate derivation %s -> %s",
|
||||
store->printStorePath(drvPath),
|
||||
newDrvPathS));
|
||||
printError("rewrote aggregate derivation %s -> %s",
|
||||
store->printStorePath(drvPath), newDrvPathS);
|
||||
|
||||
job["drvPath"] = newDrvPathS;
|
||||
job["outputs"]["out"] = store->printStorePath(outPath);
|
||||
|
||||
@@ -417,10 +417,9 @@ int main(int argc, char **argv) {
|
||||
myArgs.gcRootsDir, aio);
|
||||
},
|
||||
[&](const DependencyCycle &e) {
|
||||
nix::logger->log(nix::lvlError,
|
||||
nix::fmt("Found dependency cycle "
|
||||
"between jobs '%s' and '%s'",
|
||||
e.a, e.b));
|
||||
printError(
|
||||
"Found dependency cycle between jobs '%s' and '%s'",
|
||||
e.a, e.b);
|
||||
state->jobs[e.a]["error"] = e.message();
|
||||
state->jobs[e.b]["error"] = e.message();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user