diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2017-04-12 14:53:10 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2017-04-13 16:03:31 +0200 |
commit | 6d97d816565505606792050131b5d4d7fca33245 (patch) | |
tree | 5fc50ee88f0eb16de9a6a9144aef205f441af030 /src/libutil/logging.hh | |
parent | 31cc9366fc81c3f478b31a206daa6b38801cd3b1 (diff) |
Add warn function
Diffstat (limited to 'src/libutil/logging.hh')
-rw-r--r-- | src/libutil/logging.hh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libutil/logging.hh b/src/libutil/logging.hh index 3f8366479..81aebccdc 100644 --- a/src/libutil/logging.hh +++ b/src/libutil/logging.hh @@ -30,6 +30,8 @@ public: log(lvlInfo, fs); } + virtual void warn(const std::string & msg); + virtual void setExpected(const std::string & label, uint64_t value = 1) { } virtual void setProgress(const std::string & label, uint64_t value = 1) { } virtual void incExpected(const std::string & label, uint64_t value = 1) { } @@ -82,6 +84,14 @@ extern Verbosity verbosity; /* suppress msgs > this */ #define debug(args...) printMsg(lvlDebug, args) #define vomit(args...) printMsg(lvlVomit, args) +template<typename... Args> +inline void warn(const std::string & fs, Args... args) +{ + boost::format f(fs); + formatHelper(f, args...); + logger->warn(f.str()); +} + void warnOnce(bool & haveWarned, const FormatOrString & fs); void writeToStderr(const string & s); |