Fix 'occurred' typo
[libt2n] / src / client_wrapper.cpp
CommitLineData
19facd85
TJ
1/*
2Copyright (C) 2006 by Intra2net AG - Gerd v. Egidy
3
4The software in this package is distributed under the GNU General
5Public License version 2 (with a special exception described below).
6
7A copy of GNU General Public License (GPL) is included in this distribution,
8in the file COPYING.GPL.
9
10As a special exception, if other files instantiate templates or use macros
11or inline functions from this file, or you compile this file and link it
12with other works to produce a work based on this file, this file
13does not by itself cause the resulting work to be covered
14by the GNU General Public License.
15
16However the source code for this file must still be made available
17in accordance with section (3) of the GNU General Public License.
18
19This exception does not invalidate any other reasons why a work based
20on this file might be covered by the GNU General Public License.
21*/
a64066eb 22
a64066eb
GE
23#include <client_wrapper.hxx>
24
a64066eb
GE
25namespace libt2n
26{
27
a64066eb
GE
28const char* T2nSingletonWrapperMessages::NotInitializedMessage = "T2nSingletonWrapper used before setting initializing connection";
29
e1614a6d
GE
30/// get pointer to logging stream, returns NULL if no logging needed
31std::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.
40void 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
47void 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}