Index: trunk/ippToPsps/src/DetectionBatch.c
===================================================================
--- trunk/ippToPsps/src/DetectionBatch.c	(revision 31025)
+++ trunk/ippToPsps/src/DetectionBatch.c	(revision 31030)
@@ -47,5 +47,5 @@
 
     // open input FITS file
-    Fits* fitsIn = existing_Fits(this->base.inputFiles[0]);
+    Fits* fitsIn = existing_Fits(this->base.inputFiles[0], this->base.logger);
     if (fitsIn->getFilePtr(fitsIn) == NULL)  return PS_EXIT_SYS_ERROR;
 
@@ -157,4 +157,9 @@
     }
 
+    this->base.logger->print(this->base.logger, MSG_INFO, 
+            "+-----------+---------+----------+----------------+--------------+--------------+\n");
+    this->base.logger->print(this->base.logger, MSG_INFO, 
+            "| Extension | Rows in | Rows out |  Duplicate IDs | Invalid Flux | Bogus det ID |\n");
+
     // loop round chips
     for (int x=startX; x<stopX; x++) {
@@ -190,5 +195,5 @@
             skylist = dvoSkyListByExternID(this->base.dvoConfig, sourceId, imageId, &image);
             if (skylist == NULL) {
-                psError(PS_ERR_IO, false,
+                this->base.logger->print(this->base.logger, MSG_ERROR, 
                         "DVO: can't find SkyList for sourceId='%d' imageId='%d' (CCD = XY%s): skipping this chip\n",
                         sourceId, imageId, ccdNumber);
@@ -205,5 +210,5 @@
             if (numDvoDetections > this->MAXDETECT ) {
 
-                psError(PS_ERR_IO, false, " Number of detections (%d) exceeds max limit (%ld)\n",
+                this->base.logger->print(this->base.logger, MSG_ERROR,"Number of detections (%d) exceeds max limit (%ld)\n",
                         numDvoDetections, this->MAXDETECT);
                 error = true;
@@ -370,7 +375,5 @@
             }
 
-            psLogMsg("ippToPsps", PS_LOG_INFO,
-                    "+-----------+---------+----------+----------------+--------------+--------------+\n"
-                    "| Extension | Rows in | Rows out |  Duplicate IDs | Invalid Flux | Bogus det ID |\n"
+            this->base.logger->print(this->base.logger, MSG_INFO,
                     "|  %s |  %5ld  |   %5d  |     %5d      |    %5d     |    %5d     |\n",
                     extensionName, nChipDetectionsIn, nChipDetectionsOut, numOfDuplicates, numInvalidFlux, numOfInvalidIppIDet);
@@ -385,5 +388,8 @@
     }
 
-    psLogMsg("ippToPsps", PS_LOG_INFO, "Total detections for this exposure = %ld\n", totalDetectionsOut);
+    this->base.logger->print(this->base.logger, MSG_INFO, 
+            "+-----------+---------+----------+----------------+--------------+--------------+\n");
+
+    this->base.logger->print(this->base.logger, MSG_INFO, "Total detections for this exposure = %ld\n", totalDetectionsOut);
 
     // free-up memory
@@ -419,5 +425,5 @@
     writeResults(this, minObjID, maxObjID, totalDetectionsOut);
 
-    psLogMsg("ippToPsps", PS_LOG_INFO, "Data written for a total of %d chips/OTAs", nOta);
+    this->base.logger->print(this->base.logger, MSG_INFO, "Data written for a total of %d chips/OTAs", nOta);
 
     if (error || nOta < 1) this->base.exitCode = PS_EXIT_DATA_ERROR;
@@ -481,5 +487,5 @@
             !haveExpName) {
 
-        printf("\n* ERROR with supplied arguments:");
+        this->base.logger->print(this->base.logger, MSG_ERROR, "Problem with supplied arguments\n");
         this->print(this);
         this->base.exitCode = PS_EXIT_CONFIG_ERROR;
@@ -493,14 +499,11 @@
   Constructor. Returns a new DetectionBatch object.
   */
-DetectionBatch* new_DetectionBatch(int *argc, char **argv) {
-
+DetectionBatch* new_DetectionBatch(Logger* logger, int *argc, char **argv) {
+
+    logger->print(logger, MSG_DEBUG, "DetectionBatch: Constructor\n");
     DetectionBatch *this = (DetectionBatch*)calloc(1, sizeof(DetectionBatch));
 
     // call base-class constructor
-    if (!new_Batch(&this->base)) {
-
-        psError(PS_ERR_IO, false, "Unable to create Batch base-class object");
-        return this;
-    }
+    new_Batch(logger, &this->base);
 
     this->MAXDETECT = 200000;
@@ -525,9 +528,11 @@
     psTimerStart("detectionbatch");
 
-    ippToPsps_VersionPrint();
+//    ippToPsps_VersionPrint();
 
     int exitCode;
 
-    DetectionBatch* detectionBatch = new_DetectionBatch(&argc, argv);
+    Logger* logger = new_Logger(NULL);
+
+    DetectionBatch* detectionBatch = new_DetectionBatch(logger, &argc, argv);
     detectionBatch->base.run(detectionBatch);
     exitCode = detectionBatch->base.exitCode;
@@ -537,5 +542,5 @@
     double secs = psTimerMark("detectionbatch");
 
-    psLogMsg("detectionbatch", 3, "detectionbatch completed %ssuccessfully, with exit code %d, in %.1f %s\n",
+    logger->print(logger, MSG_INFO, "detectionbatch completed %ssuccessfully, with exit code %d, in %.1f %s\n",
             (exitCode == PS_EXIT_SUCCESS) ? "" : "un",
             exitCode,
@@ -546,4 +551,5 @@
     psTimerStop();
     psLibFinalize();
+    logger->destroy(logger);
 
     return exitCode;
