libutil, cli: remove Logger::warn
only use the free function instead, so we can turn that into a macro. Change-Id: I0319e9f7bdebb96f6159053e8b7b7a82559c9b33
This commit is contained in:
@@ -21,11 +21,6 @@ static GlobalConfig::Register rLoggerSettings(&loggerSettings);
|
||||
|
||||
Logger * logger = makeSimpleLogger(true);
|
||||
|
||||
void Logger::warn(const std::string & msg)
|
||||
{
|
||||
log(lvlWarn, ANSI_WARNING "warning:" ANSI_NORMAL " " + msg);
|
||||
}
|
||||
|
||||
void Logger::writeToStdout(std::string_view s)
|
||||
{
|
||||
writeFull(
|
||||
|
||||
@@ -140,8 +140,6 @@ public:
|
||||
logEI(ei);
|
||||
}
|
||||
|
||||
virtual void warn(const std::string & msg);
|
||||
|
||||
virtual void startActivity(ActivityId act, Verbosity lvl, ActivityType type,
|
||||
const std::string & s, const Fields & fields, ActivityId parent) { };
|
||||
|
||||
@@ -279,9 +277,11 @@ extern Verbosity verbosity;
|
||||
* if verbosity >= lvlWarn, print a message with a yellow 'warning:' prefix.
|
||||
*/
|
||||
template<typename... Args>
|
||||
inline void warn(const std::string & fs, const Args & ... args)
|
||||
inline void warn(const std::string & fs, const Args &... args)
|
||||
{
|
||||
logger->warn(HintFmt(fs, args...).str());
|
||||
logger->log(
|
||||
lvlWarn, fmt(ANSI_WARNING "warning:" ANSI_NORMAL " %1%", HintFmt(fs, args...).str())
|
||||
);
|
||||
}
|
||||
|
||||
void writeLogsToStderr(std::string_view s);
|
||||
|
||||
+12
-3
@@ -1340,7 +1340,10 @@ struct CmdFlakeShow : FlakeCommand, MixJSON
|
||||
if (!json)
|
||||
logger->cout(fmt("%s " ANSI_WARNING "omitted" ANSI_NORMAL " (use '--all-systems' to show)", headerPrefix));
|
||||
else {
|
||||
logger->warn(fmt("%s omitted (use '--all-systems' to show)", concatStringsSep(".", attrPath)));
|
||||
warn(
|
||||
"%s omitted (use '--all-systems' to show)",
|
||||
concatStringsSep(".", attrPath)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if (visitor.isDerivation(*state))
|
||||
@@ -1364,13 +1367,19 @@ struct CmdFlakeShow : FlakeCommand, MixJSON
|
||||
if (!json)
|
||||
logger->cout(fmt("%s " ANSI_WARNING "omitted" ANSI_NORMAL " (use '--legacy' to show)", headerPrefix));
|
||||
else {
|
||||
logger->warn(fmt("%s omitted (use '--legacy' to show)", concatStringsSep(".", attrPath)));
|
||||
warn(
|
||||
"%s omitted (use '--legacy' to show)",
|
||||
concatStringsSep(".", attrPath)
|
||||
);
|
||||
}
|
||||
} else if (!showAllSystems && attrPath[1] != localSystem) {
|
||||
if (!json)
|
||||
logger->cout(fmt("%s " ANSI_WARNING "omitted" ANSI_NORMAL " (use '--all-systems' to show)", headerPrefix));
|
||||
else {
|
||||
logger->warn(fmt("%s omitted (use '--all-systems' to show)", concatStringsSep(".", attrPath)));
|
||||
warn(
|
||||
"%s omitted (use '--all-systems' to show)",
|
||||
concatStringsSep(".", attrPath)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if (visitor.isDerivation(*state))
|
||||
|
||||
Reference in New Issue
Block a user