Page MenuHomePhabricator

mitkLogToOutputWindow.patch

Authored By
baumhaue
Sep 8 2010, 3:12 PM
Size
1 KB
Referenced Files
None
Subscribers
None

mitkLogToOutputWindow.patch

Index: Core/Code/IO/mitkLog.cpp
===================================================================
--- Core/Code/IO/mitkLog.cpp (revision 25905)
+++ Core/Code/IO/mitkLog.cpp (working copy)
@@ -18,6 +18,7 @@
#include "mitkLog.h"
#include "itkSimpleFastMutexLock.h"
+#include <itkOutputWindow.h>
#include <iostream>
#include <fstream>
@@ -25,7 +26,15 @@
static itk::SimpleFastMutexLock logMutex;
static mitk::LogBackend *mitkLogBackend = 0;
static std::ofstream *logFile = 0;
+static std::stringstream *outputWindow = 0;
+static bool logOutputWindow = false;
+void mitk::LogBackend::EnableOutputWindow(bool enable)
+{
+ logOutputWindow = enable;
+}
+
+
void mitk::LogBackend::ProcessMessage(const mbilog::LogMessage& l )
{
logMutex.Lock();
@@ -43,7 +52,17 @@
mbilog::BackendCout::FormatFull( *logFile, l );
#endif
}
-
+ if(logOutputWindow)
+ {
+ if(outputWindow == NULL)
+ outputWindow = new std::stringstream();
+ #ifdef _WIN32
+ mbilog::BackendCout::FormatFull( *outputWindow, l, (int)GetCurrentThreadId() );
+ #else
+ mbilog::BackendCout::FormatFull( *outputWindow, l );
+ #endif
+ itk::OutputWindow::GetInstance()->DisplayText(outputWindow->str().c_str());
+ }
logMutex.Unlock();
}
Index: Core/Code/IO/mitkLog.h
===================================================================
--- Core/Code/IO/mitkLog.h (revision 25905)
+++ Core/Code/IO/mitkLog.h (working copy)
@@ -46,6 +46,8 @@
/** \brief Sets extra log file path (additionally to the console log)
*/
static void SetLogFile(const char *file);
+
+ static void EnableOutputWindow(bool enable);
/** \brief Automatically extracts and removes the "--logfile <file>" parameters from the standard C main(argc,argv) parameter list and calls SetLogFile if needed
*/

File Metadata

Mime Type
text/plain
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
570
Default Alt Text
mitkLogToOutputWindow.patch (1 KB)

Event Timeline