From: Gerd v. Egidy Date: Fri, 19 Sep 2008 13:41:24 +0000 (+0000) Subject: libt2n, arnied: (gerd) set logging on existing connections too, show t2n-debugging... X-Git-Tag: v0.4~4 X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=commitdiff_plain;h=2a956e6587338524eec8f66efe3a733a2116eb9b libt2n, arnied: (gerd) set logging on existing connections too, show t2n-debugging on ARNIED-LOG-EVERYTHING --- diff --git a/src/client_wrapper.hxx b/src/client_wrapper.hxx index 14dabfb..3370615 100644 --- a/src/client_wrapper.hxx +++ b/src/client_wrapper.hxx @@ -101,7 +101,7 @@ class ConnectionWrapper void set_hello_timeout_usec(long long _hello_timeout_usec) { hello_timeout_usec=_hello_timeout_usec; } - void set_logging(std::ostream *_logstream, log_level_values _log_level); + virtual void set_logging(std::ostream *_logstream, log_level_values _log_level); std::ostream* get_logstream(log_level_values level); }; diff --git a/src/socket_wrapper.cpp b/src/socket_wrapper.cpp index cc10e0c..7bbe20c 100644 --- a/src/socket_wrapper.cpp +++ b/src/socket_wrapper.cpp @@ -25,6 +25,16 @@ namespace libt2n { +/// set logging for coming and current connections +void BasicSocketWrapper::set_logging(std::ostream *_logstream, log_level_values _log_level) +{ + ConnectionWrapper::set_logging(_logstream,_log_level); + + if (connection_established()) + get_connection()->set_logging(_logstream,_log_level); +} + + /// return active connection, create new tcp or unix connection if not existing client_connection* BasicSocketWrapper::get_connection(void) { diff --git a/src/socket_wrapper.hxx b/src/socket_wrapper.hxx index da972a2..ebb85f6 100644 --- a/src/socket_wrapper.hxx +++ b/src/socket_wrapper.hxx @@ -65,6 +65,8 @@ class BasicSocketWrapper : public ConnectionWrapper bool connection_established(void) { return (c.get() != NULL); } + + void set_logging(std::ostream *_logstream, log_level_values _log_level); }; class ReconnectSocketWrapper : public BasicSocketWrapper