fw4spl
vtklogging.cpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2017.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #include <fwCore/base.hpp>
8 
9 #include <vtkObjectFactory.h>
10 #include <vtkOutputWindow.h>
11 
12 class vtkOutputWindowToSpyLog : public vtkOutputWindow
13 {
14 public:
15 
16  vtkTypeMacro(vtkOutputWindowToSpyLog, vtkObject);
17  // Description:
18  // Print ObjectFactor to stream.
19  virtual void PrintSelf(ostream& os, vtkIndent indent) override;
20 
21  static vtkOutputWindowToSpyLog* New();
22 
23  virtual void DisplayText(const char*) override;
24 
25 protected:
27  virtual ~vtkOutputWindowToSpyLog();
28 
29 private:
30  vtkOutputWindowToSpyLog(const vtkOutputWindowToSpyLog&); // Not implemented.
31  void operator=(const vtkOutputWindowToSpyLog&); // Not implemented.
32 };
33 
34 //------------------------------------------------------------------------------
35 
36 vtkStandardNewMacro(vtkOutputWindowToSpyLog);
37 
38 //------------------------------------------------------------------------------
39 
40 vtkOutputWindowToSpyLog::vtkOutputWindowToSpyLog()
41 {
42 }
43 
44 //------------------------------------------------------------------------------
45 
46 vtkOutputWindowToSpyLog::~vtkOutputWindowToSpyLog()
47 {
48 }
49 
50 //------------------------------------------------------------------------------
51 
52 void vtkOutputWindowToSpyLog::PrintSelf(ostream& os, vtkIndent indent)
53 {
54  this->Superclass::PrintSelf(os, indent);
55 
56  os << indent << "vtkOutputWindowToSpyLog" << std::endl;
57 }
58 
59 //------------------------------------------------------------------------------
60 
61 void vtkOutputWindowToSpyLog::DisplayText(const char* txt)
62 {
63  OSLM_WARN("[VTK]: " << txt);
64 }
65 
66 //------------------------------------------------------------------------------
67 
69 {
70 
71 public:
73  {
74  auto output = vtkOutputWindowToSpyLog::New();
75  vtkOutputWindow::SetInstance( output );
76  output->Delete();
77  }
78 };
79 
80 static InitializeVtkOutputWindow _vtkOutputWindowInstantiator;
#define OSLM_WARN(message)
Definition: spyLog.hpp:263