libopenraw
trace.cpp
1 /*
2  * libopenraw - trace.cpp
3  *
4  * Copyright (C) 2006-2007, 2010 Hubert Figuiere
5  *
6  * This library is free software: you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation, either version 3 of
9  * the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 #include <iostream>
23 
24 #include "trace.h"
25 
26 
27 
28 namespace Debug {
29 
30  int Trace::debugLevel = NOTICE;
31 
32  void Trace::setDebugLevel(debug_level lvl)
33  {
34  debugLevel = lvl;
35  }
36 
37  void Trace::print(int i)
38  {
39  std::cerr << i << " ";
40  }
41 
42  Trace & Trace::operator<<(int i)
43  {
44  if (m_level <= debugLevel) {
45  std::cerr << i;
46  }
47  return *this;
48  }
49 
50  Trace & Trace::operator<<(const char * s)
51  {
52  if (m_level <= debugLevel) {
53  std::cerr << s;
54  }
55  return *this;
56  }
57 
58  Trace & Trace::operator<<(void *p)
59  {
60  if (m_level <= debugLevel) {
61  std::cerr << p;
62  }
63  return *this;
64  }
65 
66  Trace & Trace::operator<<(const std::string & s)
67  {
68  if (m_level <= debugLevel) {
69  std::cerr << s;
70  }
71  return *this;
72  }
73 
74 }
Definition: trace.cpp:28