author | terom |
Thu, 20 Nov 2008 23:45:33 +0000 | |
branch | no-netsession |
changeset 41 | ca80cd67785d |
parent 24 | b81cb670e6b2 |
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 |
|
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
2 |
#include "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 |
Logger::Logger (std::ostream &stream, enum LogLevel level, const char *module) : stream(stream), level(level), module(module) { |
24 | 5 |
const char *l; |
23
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
6 |
|
24 | 7 |
switch (level) { |
8 |
case FATAL: l = "FATAL"; break; |
|
9 |
case ERROR: l = "ERROR"; break; |
|
10 |
case WARN: l = "WARN"; break; |
|
11 |
case INFO: l = "INFO"; break; |
|
12 |
case DEBUG: l = "DEBUG"; break; |
|
13 |
default: l = "???"; break; |
|
14 |
}; |
|
23
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
15 |
|
24 | 16 |
stream << l << " [" << module << "] "; |
23
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
17 |
} |
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
18 |
|
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
19 |
Logger::~Logger (void) { |
24 | 20 |
stream << std::endl; |
23
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
21 |
} |
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
22 |
|
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
23 |
std::ostream& operator<< (std::ostream &s, CL_NetComputer &c) { |
24 | 24 |
s << "[" << c.get_address().get_address() << ":" << c.get_address().get_port() << "]"; |
23
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
25 |
|
24 | 26 |
return s; |
23
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
27 |
} |
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
28 |
|
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
29 |
std::ostream& operator<< (std::ostream &s, CL_NetObject_Server &obj) { |
24 | 30 |
s << "%" << obj.get_obj_id(); |
23
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
31 |
|
24 | 32 |
return s; |
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_NetObject_Client &obj) { |
24 | 36 |
s << "%" << obj.get_obj_id(); |
23
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
37 |
|
24 | 38 |
return s; |
23
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
39 |
} |
8d802b573cf0
fixed more network code, there's actually a high probability of it working now
terom
parents:
diff
changeset
|
40 |