X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=blobdiff_plain;f=src%2Fclient_wrapper.cpp;h=735ac29278d9bb80c32fd6507075b51214d7d614;hp=af60da9a71a1e4859e3f7898afd0cbf1df692708;hb=e1614a6d1d9c022b83c0aa8cdb948bd7dc98ff23;hpb=ffbbf9abeb195a4017c1ede383cc9ab906aa4a0c diff --git a/src/client_wrapper.cpp b/src/client_wrapper.cpp index af60da9..735ac29 100644 --- a/src/client_wrapper.cpp +++ b/src/client_wrapper.cpp @@ -24,4 +24,27 @@ namespace libt2n const char* T2nSingletonWrapperMessages::NotInitializedMessage = "T2nSingletonWrapper used before setting initializing connection"; +/// get pointer to logging stream, returns NULL if no logging needed +std::ostream* ConnectionWrapper::get_logstream(log_level_values level) +{ + if (logstream && log_level >= level) + return logstream; + else + return NULL; +} + +/// activate logging to the given stream. everything above the given level is logged. +void ConnectionWrapper::set_logging(std::ostream *_logstream, log_level_values _log_level) +{ + log_level=_log_level; + logstream=_logstream; +} + +/// always call this when you got a new connection to transfer logging settings +void ConnectionWrapper::set_logging_on_connection(client_connection& c) +{ + if (logstream != NULL && log_level > none) + c.set_logging(logstream,log_level); +} + }