Index: sources/storage/Logger.cpp =================================================================== diff -u -r61f16c988a159401c92730b4cbfca5085c77222f -r13d6a4fae2f910ab6e289ac9280258a94f734405 --- sources/storage/Logger.cpp (.../Logger.cpp) (revision 61f16c988a159401c92730b4cbfca5085c77222f) +++ sources/storage/Logger.cpp (.../Logger.cpp) (revision 13d6a4fae2f910ab6e289ac9280258a94f734405) @@ -57,9 +57,6 @@ checkLogPath(); initConnections(); - ADD_EVENT_HEADER; - LOG_DEBUG("UI," + tr("%1 Initialized").arg(metaObject()->className())); - return true; } @@ -82,6 +79,36 @@ // coco end /*! + * \brief Logger::postInit + * \details these are the actions that should be executed after the logger has been initialized + * but also cannot be done in the Logger class since it is not immediately moving to the thread. + */ +void Logger::postInit() +{ + if ( ! checkThread() ) return; + ADD_EVENT_HEADER; + LOG_DEBUG("UI," + tr("%1 Initialized").arg(metaObject()->className())); + LOG_DEBUG("UI," + QString("Application %1 Started").arg(qApp->applicationName())); + LOG_EVENT("UI," + qApp-> applicationVersion()); +} + +/*! + * \brief Logger::checkThread + * \details Checks the current thread to be the logger thread + * otherwise sends out a message to the console and returns false. + * \return false if not logger thread + */ +bool Logger::checkThread() +{ + bool ok = true; + if ( this->thread() != &Threads::_Logger_Thread ) { + qDebug() << " ----- " << "The main Log function rejection: The Logger is not initialized for proper use"; + ok = false; + } + return ok; +} + +/*! * \brief Logger quit * \details quits the class * Calls quitThread @@ -245,6 +272,8 @@ */ void Logger::log(const QString &vContent, LogType vLogType, bool vTimestamp) { + if ( ! checkThread() ) return; + static QString date; QString mContent; QString currentDate = QDate::currentDate().toString(_dateFormat);