ソースを参照

Fixed VTK log message parsing regexp

0x prefix is not printed before object address on Windows,
with latest VTK, therefore the 0x prefix is now optional before
the address.

Added parsing of messages logged using DisplayText() to allow
logging full context, such as file name, line number, etc. for
informational messages.
Andras Lasso 10 年 前
コミット
467e45adc9
共有1 個のファイルを変更した9 個の追加3 個の削除を含む
  1. 9 3
      Libs/Visualization/VTK/Core/ctkVTKErrorLogMessageHandler.cpp

+ 9 - 3
Libs/Visualization/VTK/Core/ctkVTKErrorLogMessageHandler.cpp

@@ -43,8 +43,10 @@ public:
   vtkTypeMacro(ctkVTKOutputWindow,vtkOutputWindow);
   vtkTypeMacro(ctkVTKOutputWindow,vtkOutputWindow);
   void PrintSelf(ostream& os, vtkIndent indent);
   void PrintSelf(ostream& os, vtkIndent indent);
 
 
-  ctkVTKOutputWindow():MessageHandler(0),
-    ContextRegExp("[a-zA-Z\\s]+: In (.+), line ([\\d]+)\\n(.+\\(0x[a-fA-F0-9]+\\))\\:\\s(.*)"){}
+  ctkVTKOutputWindow()
+    : MessageHandler(0)
+    , ContextRegExp("[a-zA-Z\\s]+: In (.+), line ([\\d]+)\\n(.+\\((?:0x)?[a-fA-F0-9]+\\))\\:\\s(.*)")
+  {}
   ~ctkVTKOutputWindow(){}
   ~ctkVTKOutputWindow(){}
 
 
   virtual void DisplayText(const char*);
   virtual void DisplayText(const char*);
@@ -77,10 +79,14 @@ void ctkVTKOutputWindow::PrintSelf(ostream& os, vtkIndent indent)
 void ctkVTKOutputWindow::DisplayText(const char* text)
 void ctkVTKOutputWindow::DisplayText(const char* text)
 {
 {
   Q_ASSERT(this->MessageHandler);
   Q_ASSERT(this->MessageHandler);
+
+  ctkErrorLogContext context;
+  QString textOnly = this->parseText(text, context);
+
   this->MessageHandler->handleMessage(
   this->MessageHandler->handleMessage(
         ctk::qtHandleToString(QThread::currentThreadId()),
         ctk::qtHandleToString(QThread::currentThreadId()),
         ctkErrorLogLevel::Info,
         ctkErrorLogLevel::Info,
-        this->MessageHandler->handlerPrettyName(), ctkErrorLogContext(), text);
+        this->MessageHandler->handlerPrettyName(), context, textOnly);
 }
 }
 
 
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------