Skip to content
Snippets Groups Projects
Commit c2b6808e authored by Dr. Felix Tobias Schindler's avatar Dr. Felix Tobias Schindler
Browse files

[common.logging] added create() to test if create() has been called

parent 6d533f2b
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,7 @@ namespace Common { ...@@ -27,6 +27,7 @@ namespace Common {
Logging::Logging() Logging::Logging()
: logflags_(LOG_NONE) : logflags_(LOG_NONE)
, emptyLogStream_(logflags_) , emptyLogStream_(logflags_)
, created_(false)
{ {
streamIDs_.push_back(LOG_ERROR); streamIDs_.push_back(LOG_ERROR);
streamIDs_.push_back(LOG_DEBUG); streamIDs_.push_back(LOG_DEBUG);
...@@ -72,8 +73,15 @@ void Logging::create(int logflags, const std::string logfile, const std::string ...@@ -72,8 +73,15 @@ 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)
{ {
// / begin dtor // / begin dtor
......
...@@ -43,6 +43,8 @@ private: ...@@ -43,6 +43,8 @@ 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
...@@ -149,6 +151,7 @@ private: ...@@ -149,6 +151,7 @@ private:
// satisfy stricter warnings wrt copying // satisfy stricter warnings wrt copying
Logging(const Logging&); Logging(const Logging&);
Logging& operator=(const Logging&); Logging& operator=(const Logging&);
bool created_;
}; };
//! global Logging instance //! global Logging instance
......
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