Commit | Line | Data |
---|---|---|
19facd85 TJ |
1 | /* |
2 | Copyright (C) 2006 by Intra2net AG - Gerd v. Egidy | |
3 | ||
4 | The software in this package is distributed under the GNU General | |
5 | Public License version 2 (with a special exception described below). | |
6 | ||
7 | A copy of GNU General Public License (GPL) is included in this distribution, | |
8 | in the file COPYING.GPL. | |
9 | ||
10 | As a special exception, if other files instantiate templates or use macros | |
11 | or inline functions from this file, or you compile this file and link it | |
12 | with other works to produce a work based on this file, this file | |
13 | does not by itself cause the resulting work to be covered | |
14 | by the GNU General Public License. | |
15 | ||
16 | However the source code for this file must still be made available | |
17 | in accordance with section (3) of the GNU General Public License. | |
18 | ||
19 | This exception does not invalidate any other reasons why a work based | |
20 | on this file might be covered by the GNU General Public License. | |
21 | */ | |
a64066eb | 22 | |
a64066eb GE |
23 | #include <client_wrapper.hxx> |
24 | ||
a64066eb GE |
25 | namespace libt2n |
26 | { | |
27 | ||
a64066eb GE |
28 | const char* T2nSingletonWrapperMessages::NotInitializedMessage = "T2nSingletonWrapper used before setting initializing connection"; |
29 | ||
e1614a6d GE |
30 | /// get pointer to logging stream, returns NULL if no logging needed |
31 | std::ostream* ConnectionWrapper::get_logstream(log_level_values level) | |
32 | { | |
33 | if (logstream && log_level >= level) | |
34 | return logstream; | |
35 | else | |
36 | return NULL; | |
37 | } | |
38 | ||
39 | /// activate logging to the given stream. everything above the given level is logged. | |
40 | void ConnectionWrapper::set_logging(std::ostream *_logstream, log_level_values _log_level) | |
41 | { | |
42 | log_level=_log_level; | |
43 | logstream=_logstream; | |
44 | } | |
45 | ||
46 | /// always call this when you got a new connection to transfer logging settings | |
47 | void ConnectionWrapper::set_logging_on_connection(client_connection& c) | |
48 | { | |
49 | if (logstream != NULL && log_level > none) | |
50 | c.set_logging(logstream,log_level); | |
51 | } | |
52 | ||
a64066eb | 53 | } |