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