From d07a3e68669156789c56d55f5c12a569888d6608 Mon Sep 17 00:00:00 2001 From: Rene Milk <rene.milk@uni-muenster.de> Date: Fri, 8 Feb 2013 16:23:58 +0100 Subject: [PATCH] [logging] remove created() it's much better to inform the user about missing Logger initialization --- dune/stuff/common/logging.cc | 13 +++---------- dune/stuff/common/logging.hh | 2 -- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/dune/stuff/common/logging.cc b/dune/stuff/common/logging.cc index a32ab014b..877c935a6 100644 --- a/dune/stuff/common/logging.cc +++ b/dune/stuff/common/logging.cc @@ -76,15 +76,8 @@ void Logging::create(int logflags, const std::string logfile, const std::string flagmap_[*it] = logflags; streammap_[*it] = new FileLogStream(*it, flagmap_[*it], logfile_); } - created_ = true; } // Create -bool Logging::created() const -{ - return created_; -} - - void Logging::setPrefix(std::string prefix) { deinit(); @@ -103,7 +96,8 @@ int Logging::getStreamFlags(int streamID) const { const auto it = flagmap_.find(streamID); if (it == flagmap_.end()) - DUNE_THROW(InvalidStateException, "cannot get flags for unkown Stream id"); + DUNE_THROW(InvalidStateException, + "cannot get flags for unkown Stream id, maybe you forgot to call \"Logging::create\"?"); return it->second; } @@ -111,8 +105,7 @@ LogStream& Logging::getStream(int streamId) { const auto it = streammap_.find(streamId); if (it == streammap_.end()) - return emptyLogStream_; - // DUNE_THROW(InvalidStateException, "cannot get unkown Stream"); + DUNE_THROW(InvalidStateException, "cannot get unknown logStream, maybe you forgot to call \"Logging::create\"?"); else { assert(it->second); return *(it->second); diff --git a/dune/stuff/common/logging.hh b/dune/stuff/common/logging.hh index 949a42fe0..8692b6c4b 100644 --- a/dune/stuff/common/logging.hh +++ b/dune/stuff/common/logging.hh @@ -45,8 +45,6 @@ private: public: ~Logging(); - bool created() const; - /** \brief setup loglevel, logfilename * \param logflags any OR'd combination of flags * \param logfile filename for log, can contain paths, but creation will fail if dir is non-existant -- GitLab