39#include "DGtal/base/Config.h"
40#include "DGtal/base/Common.h"
49 trace.info()<<
"This is an Info trace"<<endl;
50 trace.warning()<<
"This is an warning trace"<<endl;
51 trace.error()<<
"This is an Error trace"<<endl;
52 trace.emphase()<<
"This is an Emphased trace"<<endl;
60 trace.info()<<
"This is an Info trace, level 0"<<endl;
61 trace.beginBlock(
"FirstMethod");
62 trace.info()<<
"This is an Info trace, level 1"<<endl;
63 trace.info()<<
"This is an Info trace, level 1"<<endl;
64 trace.beginBlock(
"SecondMethod");
65 trace.warning()<<
"This is an Warning trace, level 2"<<endl;
66 trace.warning()<<
"This is an Warning trace, level 2"<<endl;
67 trace.info()<<
"This is an Info trace, level 2"<<endl;
68 trace.error()<<
"This is an Error trace, level 2 (followed by a loop)"<<endl;
70 for (
unsigned int i=0 ; i< 450; i++)
71 tmp = (
long)cos((
double)tmp+i);
74 trace.info()<<
"This is an Info trace, level 1 (followed by another loop)"<<endl;
76 for (
unsigned int i=0 ; i< 430; i++)
77 tmp = (
long)cos((
double)tmp+i);
80 trace.info()<<
"This is an Info trace, level 0"<<endl<<endl;
90 trace.beginBlock(
"testFileStream");
91 trace.info() <<
"Checking the filestream output.. Please check the 'example.txt' file"<<endl;
94 myfile.open (
"example.txt");
97 Trace t2(traceWriterFile);
99 t2.
info()<<
"This is an Info trace"<<endl;
100 t2.
warning()<<
"This is an warning trace"<<endl;
102 t2.
error()<<
"This is an Error trace"<<endl;
103 t2.
emphase()<<
"This is an Emphased trace"<<endl;
106 t2.
info()<<
"This is an Info trace, level 1"<<endl;
107 t2.
info()<<
"This is an Info trace, level 1"<<endl;
119 trace.beginBlock(
"Level0");
122 trace.beginBlock(
"Level1");
123 trace.info()<<
"..."<<std::endl;
124 for (
unsigned int i=0 ; i< 4350; i++)
125 tmp = (
long)cos((
double)tmp+i);
126 duration =
trace.endBlock();
128 trace.beginBlock(
"Level1B");
129 trace.info()<<
"..."<<std::endl;
130 for (
unsigned int i=0 ; i< 4350; i++)
131 tmp = (
long)cos((
double)tmp+i);
133 trace.beginBlock(
"Level2");
134 trace.info()<<
"..."<<std::endl;
135 for (
unsigned int i=0 ; i< 4350; i++)
136 tmp = (
long)cos((
double)tmp+i);
137 duration +=
trace.endBlock();
139 trace.beginBlock(
"Level2B");
140 trace.info()<<
"..."<<std::endl;
141 for (
unsigned int i=0 ; i< 4350; i++)
142 tmp = (
long)cos((
double)tmp+i);
143 duration +=
trace.endBlock();
145 trace.beginBlock(
"Level2C");
146 trace.info()<<
"..."<<std::endl;
147 for (
unsigned int i=0 ; i< 4450; i++)
148 tmp = (
long)cos((
double)tmp+i);
149 duration +=
trace.endBlock();
151 duration +=
trace.endBlock();
153 trace.beginBlock(
"Level1C");
154 trace.info()<<
"..."<<std::endl;
155 for (
unsigned int i=0 ; i< 430; i++)
156 tmp = (
long)cos((
double)tmp+i);
157 duration +=
trace.endBlock();
159 duration +=
trace.endBlock();
160 trace.info()<<
"Duration="<<duration<<std::endl;
implementation of basic methods to trace out messages with indentation levels.
void beginBlock(const std::string &keyword="")
DGtal is the top-level namespace which contains all DGtal functions and types.