Skip to content
Snippets Groups Projects
Commit d07a3e68 authored by René Fritze's avatar René Fritze
Browse files

[logging] remove created()

it's much better to inform the user about missing Logger initialization
parent 5a3def75
No related branches found
No related tags found
No related merge requests found
...@@ -76,15 +76,8 @@ void Logging::create(int logflags, const std::string logfile, const std::string ...@@ -76,15 +76,8 @@ void Logging::create(int logflags, const std::string logfile, const std::string
flagmap_[*it] = logflags; flagmap_[*it] = logflags;
streammap_[*it] = new FileLogStream(*it, flagmap_[*it], logfile_); streammap_[*it] = new FileLogStream(*it, flagmap_[*it], logfile_);
} }
created_ = true;
} // Create } // Create
bool Logging::created() const
{
return created_;
}
void Logging::setPrefix(std::string prefix) void Logging::setPrefix(std::string prefix)
{ {
deinit(); deinit();
...@@ -103,7 +96,8 @@ int Logging::getStreamFlags(int streamID) const ...@@ -103,7 +96,8 @@ int Logging::getStreamFlags(int streamID) const
{ {
const auto it = flagmap_.find(streamID); const auto it = flagmap_.find(streamID);
if (it == flagmap_.end()) 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; return it->second;
} }
...@@ -111,8 +105,7 @@ LogStream& Logging::getStream(int streamId) ...@@ -111,8 +105,7 @@ LogStream& Logging::getStream(int streamId)
{ {
const auto it = streammap_.find(streamId); const auto it = streammap_.find(streamId);
if (it == streammap_.end()) if (it == streammap_.end())
return emptyLogStream_; DUNE_THROW(InvalidStateException, "cannot get unknown logStream, maybe you forgot to call \"Logging::create\"?");
// DUNE_THROW(InvalidStateException, "cannot get unkown Stream");
else { else {
assert(it->second); assert(it->second);
return *(it->second); return *(it->second);
......
...@@ -45,8 +45,6 @@ private: ...@@ -45,8 +45,6 @@ private:
public: public:
~Logging(); ~Logging();
bool created() const;
/** \brief setup loglevel, logfilename /** \brief setup loglevel, logfilename
* \param logflags any OR'd combination of flags * \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 * \param logfile filename for log, can contain paths, but creation will fail if dir is non-existant
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment