author | terom |
Sun, 09 Nov 2008 20:40:46 +0000 | |
changeset 24 | b81cb670e6b2 |
parent 23 | 8d802b573cf0 |
permissions | -rw-r--r-- |
23
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
1 |
#ifndef LOGGER_HH |
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
2 |
#define LOGGER_HH |
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
3 |
|
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
4 |
#include <ClanLib/network.h> |
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
5 |
|
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
6 |
#include <iostream> |
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
7 |
|
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
8 |
enum LogLevel { |
24 | 9 |
FATAL, |
10 |
ERROR, |
|
11 |
WARN, |
|
12 |
INFO, |
|
13 |
DEBUG, |
|
23
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
14 |
}; |
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
15 |
|
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
16 |
class Logger { |
24 | 17 |
private: |
18 |
std::ostream &stream; |
|
19 |
enum LogLevel level; |
|
20 |
const char *module; |
|
23
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
21 |
|
24 | 22 |
public: |
23 |
Logger (std::ostream &stream, enum LogLevel level, const char *module); |
|
23
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
24 |
|
24 | 25 |
template <typename T> Logger& operator<< (T &val) { |
26 |
stream << val; |
|
23
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
27 |
|
24 | 28 |
return *this; |
29 |
} |
|
23
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
30 |
|
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
31 |
|
24 | 32 |
~Logger (void); |
23
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
33 |
}; |
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
34 |
|
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
35 |
std::ostream& operator<< (std::ostream &s, CL_NetComputer &c); |
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
36 |
std::ostream& operator<< (std::ostream &s, CL_NetObject_Server &obj); |
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
37 |
std::ostream& operator<< (std::ostream &s, CL_NetObject_Client &obj); |
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
38 |
|
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
39 |
#endif /* LOGGER_HH */ |