Do proper logging rather than fprintf(stderr, ...)
diff --git a/common/rdr/ZlibOutStream.cxx b/common/rdr/ZlibOutStream.cxx
index 9d9f8ba..dd3c236 100644
--- a/common/rdr/ZlibOutStream.cxx
+++ b/common/rdr/ZlibOutStream.cxx
@@ -21,11 +21,14 @@
 
 #include <rdr/ZlibOutStream.h>
 #include <rdr/Exception.h>
+#include <rfb/LogWriter.h>
 
 #include <zlib.h>
 
 #undef ZLIBOUT_DEBUG
 
+static rfb::LogWriter vlog("ZlibOutStream");
+
 using namespace rdr;
 
 enum { DEFAULT_BUF_SIZE = 16384 };
@@ -85,7 +88,7 @@
   zs->avail_in = ptr - start;
 
 #ifdef ZLIBOUT_DEBUG
-  fprintf(stderr,"zos flush: avail_in %d\n",zs->avail_in);
+  vlog.debug("flush: avail_in %d",zs->avail_in);
 #endif
 
   // Force out everything from the zlib encoder
@@ -98,7 +101,7 @@
 int ZlibOutStream::overrun(int itemSize, int nItems)
 {
 #ifdef ZLIBOUT_DEBUG
-  fprintf(stderr,"zos overrun\n");
+  vlog.debug("overrun");
 #endif
 
   if (itemSize > bufSize)
@@ -120,7 +123,7 @@
     } else {
       // but didn't consume all the data?  try shifting what's left to the
       // start of the buffer.
-      fprintf(stderr,"z out buf not full, but in data not consumed\n");
+      vlog.info("z out buf not full, but in data not consumed");
       memmove(start, zs->next_in, ptr - zs->next_in);
       offset += zs->next_in - start;
       ptr -= zs->next_in - start;
@@ -149,8 +152,8 @@
     zs->avail_out = underlying->getend() - underlying->getptr();
 
 #ifdef ZLIBOUT_DEBUG
-    fprintf(stderr,"zos: calling deflate, avail_in %d, avail_out %d\n",
-            zs->avail_in,zs->avail_out);
+    vlog.debug("calling deflate, avail_in %d, avail_out %d",
+               zs->avail_in,zs->avail_out);
 #endif
 
     rc = ::deflate(zs, flush);
@@ -163,8 +166,8 @@
     }
 
 #ifdef ZLIBOUT_DEBUG
-    fprintf(stderr,"zos: after deflate: %d bytes\n",
-            zs->next_out-underlying->getptr());
+    vlog.debug("after deflate: %d bytes",
+               zs->next_out-underlying->getptr());
 #endif
 
     underlying->setptr(zs->next_out);
@@ -177,7 +180,7 @@
 
   if (newLevel != compressionLevel) {
 #ifdef ZLIBOUT_DEBUG
-    fprintf(stderr,"zos change: avail_in %d\n",zs->avail_in);
+    vlog.debug("change: avail_in %d",zs->avail_in);
 #endif
 
     // zlib is just horribly stupid. It does an implicit flush on