diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2017-08-25T19·26+0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2017-08-25T19·26+0200 |
commit | 94a0548dc420e23c64b18d36ea8d50a2afbce6fb (patch) | |
tree | 3953949513bce46fb7656f77e6f21784d7aa7a80 /src/libutil/logging.hh | |
parent | 9b845e6936929711fe03d23adc1059acdc84a4fd (diff) |
Simplify
Diffstat (limited to 'src/libutil/logging.hh')
-rw-r--r-- | src/libutil/logging.hh | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libutil/logging.hh b/src/libutil/logging.hh index 57157dce15cc..4b1f3b5f70cf 100644 --- a/src/libutil/logging.hh +++ b/src/libutil/logging.hh @@ -32,6 +32,7 @@ typedef enum { resUntrustedPath = 102, resCorruptedPath = 103, resSetPhase = 104, + resProgress = 105, } ResultType; typedef uint64_t ActivityId; @@ -71,8 +72,6 @@ public: virtual void stopActivity(ActivityId act) { }; - virtual void progress(ActivityId act, uint64_t done = 0, uint64_t expected = 0, uint64_t running = 0, uint64_t failed = 0) { }; - virtual void setExpected(ActivityId act, ActivityType type, uint64_t expected) { }; virtual void result(ActivityId act, ResultType type, const Fields & fields) { }; @@ -95,16 +94,21 @@ struct Activity { logger.stopActivity(id); } void progress(uint64_t done = 0, uint64_t expected = 0, uint64_t running = 0, uint64_t failed = 0) const - { logger.progress(id, done, expected, running, failed); } + { result(resProgress, done, expected, running, failed); } void setExpected(ActivityType type2, uint64_t expected) const { logger.setExpected(id, type2, expected); } template<typename... Args> - void result(ResultType type, const Args & ... args) + void result(ResultType type, const Args & ... args) const { Logger::Fields fields; nop{(fields.emplace_back(Logger::Field(args)), 1)...}; + result(type, fields); + } + + void result(ResultType type, const Logger::Fields & fields) const + { logger.result(id, type, fields); } |