diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-04-16 13:12:58 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-04-16 18:03:38 +0200 |
commit | 67a5941472ab56a798556ee2d5afc62fc38a799a (patch) | |
tree | c96092cfc32ebb4355f99f7d678810a5a4ff3276 /src/libutil/logging.hh | |
parent | fcd048a526bd239fa615457e77d61d69d679bf03 (diff) |
Logger: Add method for writing to stdout
Usually this just writes to stdout, but for ProgressBar, we need to
clear the current line, write the line to stdout, and then redraw the
progress bar.
(cherry picked from commit 696c026006a6ac46adc990ed5cb0f31535bac076)
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 108b5dcb0..18c24d508 100644 --- a/src/libutil/logging.hh +++ b/src/libutil/logging.hh @@ -78,6 +78,16 @@ public: virtual void stopActivity(ActivityId act) { }; virtual void result(ActivityId act, ResultType type, const Fields & fields) { }; + + virtual void writeToStdout(std::string_view s); + + template<typename... Args> + inline void stdout(const std::string & fs, const Args & ... args) + { + boost::format f(fs); + formatHelper(f, args...); + writeToStdout(f.str()); + } }; ActivityId getCurActivity(); |