Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkLoggingMacros.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  See COPYRIGHT.txt
6  or http://www.slicer.org/copyright/copyright.txt for details.
7 
8  Unless required by applicable law or agreed to in writing, software
9  distributed under the License is distributed on an "AS IS" BASIS,
10  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11  See the License for the specific language governing permissions and
12  limitations under the License.
13 
14 ==============================================================================*/
15 #ifndef __vtkLoggingMacros_h
16 #define __vtkLoggingMacros_h
17 
18 #include "vtkAddon.h"
19 
20 // Macro for logging informational messages
21 //
22 // Informational messages log important information and non-error events
23 // that can be used for approximately tracking user actions.
24 // The information is essential for troubleshooting errors (as the user
25 // can be asked to simply provide the application log instead of describing
26 // what he did in detail).
27 //
28 // A new vtkInfoMacro logging macro had to be added as vtkDebugMacro only logs
29 // the message if debug is enabled for the particular object (also, typically
30 // debug output contains many low-level details), and Error and Warning macros
31 // are reserved for reporting potential issues.
32 
33 #ifndef vtkInfoWithObjectMacro
34 #define vtkInfoWithObjectMacro(self, x) \
35  { \
36  vtkOStreamWrapper::EndlType endl; \
37  vtkOStreamWrapper::UseEndl(endl); \
38  vtkOStrStreamWrapper vtkmsg; \
39  vtkmsg << "Info: In " __FILE__ ", line " << __LINE__ \
40  << "\n" << self->GetClassName() << " (" << self \
41  << "): " x << "\n\n"; \
42  vtkOutputWindowDisplayText(vtkmsg.str()); \
43  vtkmsg.rdbuf()->freeze(0); \
44  }
45 #endif
46 
47 #ifndef vtkInfoWithoutObjectMacro
48 #define vtkInfoWithoutObjectMacro(x) \
49  { \
50  vtkOStreamWrapper::EndlType endl; \
51  vtkOStreamWrapper::UseEndl(endl); \
52  vtkOStrStreamWrapper vtkmsg; \
53  vtkmsg << "Info: In " __FILE__ ", line " << __LINE__ \
54  << "\n" x << "\n\n"; \
55  vtkOutputWindowDisplayText(vtkmsg.str()); \
56  vtkmsg.rdbuf()->freeze(0); \
57  }
58 #endif
59 
60 #ifndef vtkInfoMacro
61 #define vtkInfoMacro(x) \
62  vtkInfoWithObjectMacro(this,x);
63 #endif
64 
65 #endif // __vtkLoggingMacros_h