ANNA Suite  2020b
Multipurpose development suite for Telco applications
TraceFunction.hpp
Go to the documentation of this file.
1 // ANNA - Anna is Not Nothingness Anymore //
2 // //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
4 // //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7 
8 
9 #ifndef anna_core_tracing_TraceFunction_hpp
10 #define anna_core_tracing_TraceFunction_hpp
11 
13 
14 namespace anna {
15 
23 public:
32  TraceFunction(const char* functionName, const char* fromFile, const int fromLine) :
33  a_functionName(functionName),
34  a_fromFile(fromFile),
35  a_ok(false) {
36  if(Logger::isActive(Logger::Debug) == true) {
37  a_ok = true;
38  Logger::write(Logger::Debug, functionName, "begin", fromFile, fromLine);
39  }
40  }
41 
46  if(a_ok == true && Logger::isActive(Logger::Debug) == true)
47  Logger::write(Logger::Debug, a_functionName, "end", a_fromFile, 0);
48  }
49 
50 private:
51  const char* a_functionName;
52  const char* a_fromFile;
53  bool a_ok;
54 };
55 
56 } //namespace anna
57 
58 #endif
59 
Definition: TraceFunction.hpp:22
Definition: Logger.hpp:42
TraceFunction(const char *functionName, const char *fromFile, const int fromLine)
Definition: TraceFunction.hpp:32
Definition: app.hpp:12
static void write(const Level level, const char *text, const char *fromFile, const int fromLine)
~TraceFunction()
Definition: TraceFunction.hpp:45
static bool isActive(const Level level)
Definition: Logger.hpp:169