about summary refs log tree commit diff
path: root/src/libutil/logging.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-04-12T12·53+0200
committerEelco Dolstra <edolstra@gmail.com>2017-04-13T14·03+0200
commit6d97d816565505606792050131b5d4d7fca33245 (patch)
tree5fc50ee88f0eb16de9a6a9144aef205f441af030 /src/libutil/logging.cc
parent31cc9366fc81c3f478b31a206daa6b38801cd3b1 (diff)
Add warn function
Diffstat (limited to 'src/libutil/logging.cc')
-rw-r--r--src/libutil/logging.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libutil/logging.cc b/src/libutil/logging.cc
index 53f6260b7886..afcc2ec58543 100644
--- a/src/libutil/logging.cc
+++ b/src/libutil/logging.cc
@@ -5,6 +5,11 @@ namespace nix {
 
 Logger * logger = makeDefaultLogger();
 
+void Logger::warn(const std::string & msg)
+{
+    log(lvlInfo, ANSI_RED "warning:" ANSI_NORMAL " " + msg);
+}
+
 class SimpleLogger : public Logger
 {
 public:
@@ -52,7 +57,7 @@ Verbosity verbosity = lvlInfo;
 void warnOnce(bool & haveWarned, const FormatOrString & fs)
 {
     if (!haveWarned) {
-        printError(format("warning: %1%") % fs.s);
+        warn(fs.s);
         haveWarned = true;
     }
 }