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

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

cleaning some output

YM

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