diff options
Diffstat (limited to 'src/libutil/logging.cc')
-rw-r--r-- | src/libutil/logging.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libutil/logging.cc b/src/libutil/logging.cc index b103b902eab0..e38a460537ea 100644 --- a/src/libutil/logging.cc +++ b/src/libutil/logging.cc @@ -45,6 +45,13 @@ public: writeToStderr(prefix + (tty ? fs.s : filterANSIEscapes(fs.s)) + "\n"); } + + void startActivity(ActivityId act, Verbosity lvl, ActivityType type, + const std::string & s, const Fields & fields, ActivityId parent) + { + if (lvl <= verbosity && !s.empty()) + log(lvl, s + "..."); + } }; Verbosity verbosity = lvlInfo; @@ -76,11 +83,11 @@ Logger * makeDefaultLogger() std::atomic<uint64_t> nextId{(uint64_t) getpid() << 32}; -Activity::Activity(Logger & logger, ActivityType type, +Activity::Activity(Logger & logger, Verbosity lvl, ActivityType type, const std::string & s, const Logger::Fields & fields, ActivityId parent) : logger(logger), id(nextId++) { - logger.startActivity(id, type, s, fields, parent); + logger.startActivity(id, lvl, type, s, fields, parent); } } |