Replace socket_handler::fill_buffer() recursion with loop (#8389)
[libt2n] / src / client.cpp
CommitLineData
19facd85
TJ
1/*
2Copyright (C) 2006 by Intra2net AG - Gerd v. Egidy
a11e19b7 3
19facd85
TJ
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*/
a11e19b7
GE
22#include <sstream>
23
24#include "client.hxx"
25
26namespace libt2n
27{
28
a7170401 29client_connection::client_connection()
a64066eb 30 : connection()
a7170401
GE
31{
32 set_logging(NULL,none);
33}
34
35/// get pointer to logging stream, returns NULL if no logging needed
36std::ostream* client_connection::get_logstream(log_level_values level)
37{
d535333f 38 if (logstream && log_level >= level)
a7170401 39 return logstream;
d535333f
GE
40 else
41 return NULL;
a7170401
GE
42}
43
44/// activate logging to the given stream. everything above the given level is logged.
45void client_connection::set_logging(std::ostream *_logstream, log_level_values _log_level)
46{
47 log_level=_log_level;
48 logstream=_logstream;
49}
a11e19b7
GE
50
51};