diff --git a/lix/libutil/logging.cc b/lix/libutil/logging.cc index c301b1706..3e3ed3548 100644 --- a/lix/libutil/logging.cc +++ b/lix/libutil/logging.cc @@ -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( diff --git a/lix/libutil/logging.hh b/lix/libutil/logging.hh index 8e9aaf662..4ebccb02d 100644 --- a/lix/libutil/logging.hh +++ b/lix/libutil/logging.hh @@ -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 -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); diff --git a/lix/nix/flake.cc b/lix/nix/flake.cc index 2051f2c1a..ee638c141 100644 --- a/lix/nix/flake.cc +++ b/lix/nix/flake.cc @@ -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))