Rev | Line | |
---|
[300] | 1 | #ifndef __XIOS_LOG__ |
---|
| 2 | |
---|
[364] | 3 | #include <string> |
---|
[300] | 4 | #include <iostream> |
---|
| 5 | |
---|
[335] | 6 | namespace xios |
---|
[300] | 7 | { |
---|
| 8 | using namespace std ; |
---|
| 9 | |
---|
| 10 | class CLog : public ostream |
---|
| 11 | { |
---|
| 12 | public : |
---|
[347] | 13 | CLog(const string& name_) : ostream(cout.rdbuf()),level(0),name(name_) {} |
---|
[300] | 14 | CLog& operator()(int l) |
---|
| 15 | { |
---|
| 16 | if (l<=level) |
---|
| 17 | { |
---|
| 18 | rdbuf(cout.rdbuf()) ; |
---|
[347] | 19 | *this<<"-> "<<name<<" : " ; |
---|
[300] | 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 ; |
---|
[347] | 31 | string name ; |
---|
[300] | 32 | }; |
---|
| 33 | |
---|
| 34 | extern CLog info; |
---|
[347] | 35 | extern CLog report; |
---|
[300] | 36 | } |
---|
| 37 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.