source: XIOS/trunk/src/log.hpp @ 364

Last change on this file since 364 was 364, checked in by ymipsl, 12 years ago

missing <string> header

YM

File size: 755 bytes
Line 
1#ifndef __XIOS_LOG__
2
3#include <string>
4#include <iostream>
5
6namespace xios
7{
8  using namespace std ;
9
10  class CLog : public ostream
11  {
12    public :
13    CLog(const string& name_) : ostream(cout.rdbuf()),level(0),name(name_) {}
14    CLog& operator()(int l) 
15    { 
16      if (l<=level) 
17      {
18        rdbuf(cout.rdbuf()) ;
19        *this<<"-> "<<name<<" : " ;
20      }
21      else rdbuf(NULL) ;
22      return *this;
23    }
24    void setLevel(int l) {level=l; } 
25    int getLevel() {return level ;}
26    bool isActive(void) { if (rdbuf()==NULL) return true ; else return false ;}
27    bool isActive(int l) {if (l<=level) return true ; else return false ; }
28
29    private :
30    int level ;
31    string name ;
32  };
33
34  extern CLog info;
35  extern CLog report;
36}
37#endif
Note: See TracBrowser for help on using the repository browser.