Do proper logging rather than fprintf(stderr, ...)
diff --git a/common/rfb/CMsgReader.cxx b/common/rfb/CMsgReader.cxx
index e8e7afb..2b5b9fb 100644
--- a/common/rfb/CMsgReader.cxx
+++ b/common/rfb/CMsgReader.cxx
@@ -23,10 +23,13 @@
 #include <rfb/msgTypes.h>
 #include <rdr/InStream.h>
 #include <rfb/Exception.h>
+#include <rfb/LogWriter.h>
 #include <rfb/util.h>
 #include <rfb/CMsgHandler.h>
 #include <rfb/CMsgReader.h>
 
+static rfb::LogWriter vlog("CMsgReader");
+
 using namespace rfb;
 
 CMsgReader::CMsgReader(CMsgHandler* handler_, rdr::InStream* is_)
@@ -74,7 +77,7 @@
       readEndOfContinuousUpdates();
       break;
     default:
-      fprintf(stderr, "unknown message type %d\n", type);
+      vlog.error("unknown message type %d", type);
       throw Exception("unknown message type");
     }
   } else {
@@ -151,7 +154,7 @@
   rdr::U32 len = is->readU32();
   if (len > 256*1024) {
     is->skip(len);
-    fprintf(stderr,"cut text too long (%d bytes) - ignoring\n",len);
+    vlog.error("cut text too long (%d bytes) - ignoring",len);
     return;
   }
   CharArray ca(len+1);
@@ -172,7 +175,7 @@
 
   len = is->readU8();
   if (len > sizeof(data)) {
-    fprintf(stderr, "Ignoring fence with too large payload\n");
+    vlog.error("Ignoring fence with too large payload");
     is->skip(len);
     return;
   }
@@ -198,14 +201,14 @@
 {
   if ((r.br.x > handler->server.width()) ||
       (r.br.y > handler->server.height())) {
-    fprintf(stderr, "Rect too big: %dx%d at %d,%d exceeds %dx%d\n",
+    vlog.error("Rect too big: %dx%d at %d,%d exceeds %dx%d",
 	    r.width(), r.height(), r.tl.x, r.tl.y,
             handler->server.width(), handler->server.height());
     throw Exception("Rect too big");
   }
 
   if (r.is_empty())
-    fprintf(stderr, "Warning: zero size rect\n");
+    vlog.error("zero size rect");
 
   handler->dataRect(r, encoding);
 }
@@ -449,7 +452,7 @@
   char* name = is->readString();
 
   if (x || y || w || h) {
-    fprintf(stderr, "Ignoring DesktopName rect with non-zero position/size\n");
+    vlog.error("Ignoring DesktopName rect with non-zero position/size");
   } else {
     handler->setName(name);
   }