35 #include "boost/bind.hpp"
48 QMutexLocker sentry(&mActionsMutex);
49 mPendingActions.push_back(action);
52 this->invokePendingAction();
55 void ThreadMethodInvoker::invokePendingAction()
57 QMetaObject::invokeMethod(
this,
"pendingAction", Qt::QueuedConnection);
60 void ThreadMethodInvoker::pendingAction()
62 while (this->executeAction());
65 bool ThreadMethodInvoker::executeAction()
77 QMutexLocker sentry(&mActionsMutex);
80 if (mPendingActions.isEmpty())
83 action = mPendingActions.front();
84 mPendingActions.pop_front();
123 mQueue->callInLogThread(action);
153 int LogThread::getDefaultTimeout(MESSAGE_LEVEL messageLevel)
const
virtual void installObserver(MessageObserverPtr observer, bool resend)
void uninstall(MessageObserverPtr observer)
ThreadMethodInvoker(QObject *parent)
virtual void uninstallObserver(MessageObserverPtr observer)
static MessageRepositoryPtr create()
virtual void setLoggingFolder(QString absoluteLoggingFolderPath)
call during startup, will fail if called when running
LogThread(QObject *parent=NULL)
MESSAGE_LEVEL mMessageLevel
MessageRepositoryPtr mRepository
virtual void executeSetLoggingFolder(QString absoluteLoggingFolderPath)=0
void emittedMessage(Message message)
emitted for each new message, in addition to writing to observer.
void install(MessageObserverPtr observer, bool resend)
boost::shared_ptr< class MessageObserver > MessageObserverPtr
boost::function< void()> ActionType
void callInLogThread(ThreadMethodInvoker::ActionType action)
void callInLogThread(ActionType action)
void processMessage(Message msg)
Message cleanupMessage(Message message)