Do proper logging rather than fprintf(stderr, ...)
diff --git a/common/rfb/Region.cxx b/common/rfb/Region.cxx
index c17c5d4..beca482 100644
--- a/common/rfb/Region.cxx
+++ b/common/rfb/Region.cxx
@@ -24,6 +24,7 @@
 //
 
 #include <rfb/Region.h>
+#include <rfb/LogWriter.h>
 #include <assert.h>
 #include <stdio.h>
 
@@ -33,6 +34,8 @@
 #include <Xregion/Xregion.h>
 }
 
+static rfb::LogWriter vlog("Region");
+
 // A _RectRegion must never be passed as a return parameter to the Xlib region
 // operations.  This is because for efficiency its "rects" member has not been
 // allocated with Xmalloc.  It is however safe to pass it as an input
@@ -123,7 +126,7 @@
     BOX* prevRects = xrgn->rects;
     xrgn->rects = (BOX*)Xrealloc((char*)xrgn->rects, nRects * sizeof(BOX));
     if (!xrgn->rects) {
-      fprintf(stderr,"Xrealloc failed\n");
+      vlog.error("Xrealloc failed");
       Xfree(prevRects);
       return;
     }
@@ -234,13 +237,13 @@
 
 void rfb::Region::debug_print(const char* prefix) const
 {
-  fprintf(stderr,"%s num rects %3ld extents %3d,%3d %3dx%3d\n",
+  vlog.debug("%s num rects %3ld extents %3d,%3d %3dx%3d",
           prefix, xrgn->numRects, xrgn->extents.x1, xrgn->extents.y1,
           xrgn->extents.x2-xrgn->extents.x1,
           xrgn->extents.y2-xrgn->extents.y1);
 
   for (int i = 0; i < xrgn->numRects; i++) {
-    fprintf(stderr,"    rect %3d,%3d %3dx%3d\n",
+    vlog.debug("    rect %3d,%3d %3dx%3d",
             xrgn->rects[i].x1, xrgn->rects[i].y1,
             xrgn->rects[i].x2-xrgn->rects[i].x1,
             xrgn->rects[i].y2-xrgn->rects[i].y1);