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