source: molecuilder/src/info.cpp@ 794482

Last change on this file since 794482 was edf611, checked in by Frederik Heber <heber@…>, 16 years ago

New Info class that contains a global verbosity level, increased per function call and decreased per exit.

  • the idea is to have the "begin of .." and "end of .." messages in an object that automatically holds the current recursion level and hence may change verbosity accordingly for Logger
  • verbose::DoOutput() checks relative to Info::verbosity now.
  • InfoUnitTest was done and works well.

Signed-off-by: Frederik Heber <heber@…>

  • Property mode set to 100644
File size: 693 bytes
Line 
1/*
2 * Info.cpp
3 *
4 * Created on: Nov 25, 2009
5 * Author: heber
6 */
7
8#include "info.hpp"
9#include "log.hpp"
10#include "verbose.hpp"
11
12int Info::verbosity = 0;
13
14/**
15 * Constructor. Do not use this function. Use getInstance() instead.
16 *
17 * \return Info instance
18 */
19Info::Info(const char *msg)
20{
21 verbosity++;
22 FunctionName = msg;
23 Log() << Verbose(0) << "Begin of " << FunctionName << endl;
24};
25
26/**
27 * Destructor. Better use purgeInstance().
28 */
29Info::~Info() {
30 Log() << Verbose(0) << "End of " << FunctionName << endl;
31 verbosity--;
32}
33
34/**
35 * Sets the verbosity.
36 *
37 * \param verbosityLevel verbosity
38 */
39void Info::setVerbosity(int verbosityLevel) {
40 verbosity = verbosityLevel;
41}
Note: See TracBrowser for help on using the repository browser.