| 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 | */ |
| 22 | #include <sstream> |
| 23 | |
| 24 | #include "client.hxx" |
| 25 | |
| 26 | namespace libt2n |
| 27 | { |
| 28 | |
| 29 | client_connection::client_connection() |
| 30 | : connection() |
| 31 | { |
| 32 | set_logging(NULL,none); |
| 33 | } |
| 34 | |
| 35 | /// get pointer to logging stream, returns NULL if no logging needed |
| 36 | std::ostream* client_connection::get_logstream(log_level_values level) |
| 37 | { |
| 38 | if (logstream && log_level >= level) |
| 39 | return logstream; |
| 40 | else |
| 41 | return NULL; |
| 42 | } |
| 43 | |
| 44 | /// activate logging to the given stream. everything above the given level is logged. |
| 45 | void client_connection::set_logging(std::ostream *_logstream, log_level_values _log_level) |
| 46 | { |
| 47 | log_level=_log_level; |
| 48 | logstream=_logstream; |
| 49 | } |
| 50 | |
| 51 | }; |