libt2n: (gerd) fix & improve logging
[libt2n] / src / client.cpp
index 88a24f5..2ce213b 100644 (file)
 namespace libt2n
 {
 
+client_connection::client_connection()
+    : connection()
+{
+    set_logging(NULL,none);
+}
+
+/// get pointer to logging stream, returns NULL if no logging needed
+std::ostream* client_connection::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 client_connection::set_logging(std::ostream *_logstream, log_level_values _log_level)
+{
+    log_level=_log_level;
+    logstream=_logstream;
+}
 
 };