forked from lix-project/lix
Merge pull request #5695 from obsidiansystems/tidy-logging
Tidy up the logging
This commit is contained in:
commit
bc57b3854e
|
@ -956,7 +956,7 @@ void processConnection(
|
||||||
|
|
||||||
Finally finally([&]() {
|
Finally finally([&]() {
|
||||||
_isInterrupted = false;
|
_isInterrupted = false;
|
||||||
prevLogger->log(lvlDebug, fmt("%d operations", opCount));
|
printMsgUsing(prevLogger, lvlDebug, "%d operations", opCount);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (GET_PROTOCOL_MINOR(clientVersion) >= 14 && readInt(from)) {
|
if (GET_PROTOCOL_MINOR(clientVersion) >= 14 && readInt(from)) {
|
||||||
|
@ -989,6 +989,8 @@ void processConnection(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printMsgUsing(prevLogger, lvlDebug, "received daemon op %d", op);
|
||||||
|
|
||||||
opCount++;
|
opCount++;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1079,7 +1079,7 @@ std::map<StorePath, StorePath> copyPaths(
|
||||||
nrFailed++;
|
nrFailed++;
|
||||||
if (!settings.keepGoing)
|
if (!settings.keepGoing)
|
||||||
throw e;
|
throw e;
|
||||||
logger->log(lvlError, fmt("could not copy %s: %s", dstStore.printStorePath(storePath), e.what()));
|
printMsg(lvlError, "could not copy %s: %s", dstStore.printStorePath(storePath), e.what());
|
||||||
showProgress();
|
showProgress();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,13 +189,14 @@ extern Verbosity verbosity; /* suppress msgs > this */
|
||||||
/* Print a string message if the current log level is at least the specified
|
/* Print a string message if the current log level is at least the specified
|
||||||
level. Note that this has to be implemented as a macro to ensure that the
|
level. Note that this has to be implemented as a macro to ensure that the
|
||||||
arguments are evaluated lazily. */
|
arguments are evaluated lazily. */
|
||||||
#define printMsg(level, args...) \
|
#define printMsgUsing(loggerParam, level, args...) \
|
||||||
do { \
|
do { \
|
||||||
auto __lvl = level; \
|
auto __lvl = level; \
|
||||||
if (__lvl <= nix::verbosity) { \
|
if (__lvl <= nix::verbosity) { \
|
||||||
logger->log(__lvl, fmt(args)); \
|
loggerParam->log(__lvl, fmt(args)); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
#define printMsg(level, args...) printMsgUsing(logger, level, args)
|
||||||
|
|
||||||
#define printError(args...) printMsg(lvlError, args)
|
#define printError(args...) printMsg(lvlError, args)
|
||||||
#define notice(args...) printMsg(lvlNotice, args)
|
#define notice(args...) printMsg(lvlNotice, args)
|
||||||
|
|
Loading…
Reference in a new issue