diff options
author | Ben Burdette <bburdette@gmail.com> | 2020-04-24 12:44:23 -0600 |
---|---|---|
committer | Ben Burdette <bburdette@gmail.com> | 2020-04-24 12:44:23 -0600 |
commit | d9632765a81604d270bf4693bddd53c22ee189d4 (patch) | |
tree | 1d769acd5a44bad6ee7343ec8485f60a365968bd | |
parent | 833501f6f11095ae226c13948eb3dc1de2a246ea (diff) |
add has_value check; remove obslete friend class
-rw-r--r-- | src/libutil/error.cc | 2 | ||||
-rw-r--r-- | src/libutil/fmt.hh | 5 | ||||
-rw-r--r-- | src/libutil/logging.hh | 9 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/libutil/error.cc b/src/libutil/error.cc index 41595b0df..c6bca7135 100644 --- a/src/libutil/error.cc +++ b/src/libutil/error.cc @@ -162,7 +162,7 @@ std::ostream& operator<<(std::ostream &out, const ErrorInfo &einfo) out << prefix << std::endl; // lines of code. - if (einfo.nixCode->errLineOfCode != "") { + if (einfo.nixCode.has_value() && einfo.nixCode->errLineOfCode != "") { printCodeLines(prefix, *einfo.nixCode); out << prefix << std::endl; } diff --git a/src/libutil/fmt.hh b/src/libutil/fmt.hh index d65215063..d182adc3a 100644 --- a/src/libutil/fmt.hh +++ b/src/libutil/fmt.hh @@ -92,9 +92,11 @@ public: { fmt.exceptions(boost::io::all_error_bits ^ boost::io::too_many_args_bit); } + hintformat(const hintformat &hf) : fmt(hf.fmt) {} + template<class T> hintformat& operator%(const T &value) { @@ -102,14 +104,11 @@ public: return *this; } - std::string str() const { return fmt.str(); } - template <typename U> - friend class AddHint; private: format fmt; }; diff --git a/src/libutil/logging.hh b/src/libutil/logging.hh index 8269e2e1a..89fd98419 100644 --- a/src/libutil/logging.hh +++ b/src/libutil/logging.hh @@ -62,11 +62,12 @@ public: virtual void logEI(const ErrorInfo &ei) = 0; - void logEI(Verbosity lvl, ErrorInfo ei) { - ei.level = lvl; - logEI(ei); + void logEI(Verbosity lvl, ErrorInfo ei) + { + ei.level = lvl; + logEI(ei); } - + virtual void warn(const std::string & msg); virtual void startActivity(ActivityId act, Verbosity lvl, ActivityType type, |