Index: trunk/ippToPsps/src/Batch.c
===================================================================
--- trunk/ippToPsps/src/Batch.c	(revision 31035)
+++ trunk/ippToPsps/src/Batch.c	(revision 31036)
@@ -113,5 +113,6 @@
     while (fgets(line, 1000, file) != NULL) this->numOfInputFiles++;
 
-    this->logger->print(this->logger, MSG_INFO, "Batch", "%d input files found\n", this->numOfInputFiles);
+    this->logger->print(this->logger, MSG_INFO, "Batch", 
+            "%d input file%s found\n", this->numOfInputFiles, (this->numOfInputFiles > 1) ? "s" : "");
 
     if (this->numOfInputFiles < 1) return false;
@@ -256,10 +257,12 @@
 static void print(Batch* this) {
 
-    printf("\n");
-    printf("* surveyType      : '%s'\n", this->surveyType);
-    printf("* surveyID        : %d\n", this->surveyID);
-    printf("* resultsPath     : '%s'\n", this->resultsPath);
-    printf("* numOfInputFiles : %d\n", this->numOfInputFiles);
-    printf("* fitsInPath      : '%s'\n", this->fitsInPath);
+    this->logger->print(this->logger, MSG_INFO, "Batch", "\n");
+    this->logger->print(this->logger, MSG_INFO, "Batch", "     Class fields:\n");
+    this->logger->print(this->logger, MSG_INFO, "Batch", "surveyType      : %s\n", this->surveyType);
+    this->logger->print(this->logger, MSG_INFO, "Batch", "surveyID        : %d\n", this->surveyID);
+    this->logger->print(this->logger, MSG_INFO, "Batch", "resultsPath     : %s\n", this->resultsPath);
+    this->logger->print(this->logger, MSG_INFO, "Batch", "numOfInputFiles : %d\n", this->numOfInputFiles);
+    this->logger->print(this->logger, MSG_INFO, "Batch", "fitsInPath      : %s\n", this->fitsInPath);
+    this->logger->print(this->logger, MSG_INFO, "Batch", "testMode        : %s\n", this->testMode ? "yes" : "no");
 }
 
Index: trunk/ippToPsps/src/Batch.h
===================================================================
--- trunk/ippToPsps/src/Batch.h	(revision 31035)
+++ trunk/ippToPsps/src/Batch.h	(revision 31036)
@@ -30,5 +30,5 @@
   - StackBatch
 
-  All subclasses need to implement the run() method and may need to implenent print()
+  All subclasses need to implement the run() method and may need to implement print()
   */
 typedef struct Batch {
Index: trunk/ippToPsps/src/DetectionBatch.c
===================================================================
--- trunk/ippToPsps/src/DetectionBatch.c	(revision 31035)
+++ trunk/ippToPsps/src/DetectionBatch.c	(revision 31036)
@@ -440,7 +440,7 @@
     this->base.print(&this->base);
 
-    printf("* exp ID          : %d\n", this->expId);
-    printf("* exp name        : '%s'\n",  this->expName ? this->expName : "undef");
-    printf("\n");
+    this->base.logger->print(this->base.logger, MSG_INFO, "DetectionBatch", "exp ID          : %d\n", this->expId);
+    this->base.logger->print(this->base.logger, MSG_INFO, "DetectionBatch", "exp name        : %s\n",  this->expName ? this->expName : "undef");
+    this->base.logger->print(this->base.logger, MSG_INFO, "DetectionBatch", "\n");
 }
 
@@ -518,4 +518,6 @@
     parseArguments(this, *argc, argv);
 
+    this->print(this);
+
     return this;
 }
@@ -528,5 +530,6 @@
 //    ippToPsps_VersionPrint();
 
-    Logger* logger = new_Logger(NULL);
+    Logger* logger = new_Logger(NULL, false);
+//    Logger* logger = new_Logger("./detBatchLog.txt", false);
     logger->print(logger, MSG_INFO, "main", "Creating new detection batch\n");
 
Index: trunk/ippToPsps/src/Fits.c
===================================================================
--- trunk/ippToPsps/src/Fits.c	(revision 31035)
+++ trunk/ippToPsps/src/Fits.c	(revision 31036)
@@ -45,5 +45,5 @@
     }
     else 
-        this->logger->print(this->logger, MSG_INFO, "Fits", "Closed FITS file '%s'\n", this->path);
+        this->logger->print(this->logger, MSG_DEBUG, "Fits", "Closed FITS file '%s'\n", this->path);
 
     free(this);
Index: trunk/ippToPsps/src/InitBatch.c
===================================================================
--- trunk/ippToPsps/src/InitBatch.c	(revision 31035)
+++ trunk/ippToPsps/src/InitBatch.c	(revision 31036)
@@ -50,5 +50,4 @@
     }
 
-
     return true;
 }
@@ -72,4 +71,6 @@
     parseArguments(this, *argc, argv);
 
+    this->print(this);
+
     return this;
 }
@@ -82,5 +83,5 @@
 //    ippToPsps_VersionPrint();
 
-    Logger* logger = new_Logger(NULL);
+    Logger* logger = new_Logger(NULL, false);
     logger->print(logger, MSG_INFO, "main", "Creating new initialization batch\n");
 
@@ -90,5 +91,4 @@
 
     initBatch->destroy(initBatch);
-
 
     // tidy up
Index: trunk/ippToPsps/src/Logger.c
===================================================================
--- trunk/ippToPsps/src/Logger.c	(revision 31035)
+++ trunk/ippToPsps/src/Logger.c	(revision 31036)
@@ -40,4 +40,6 @@
 static void print(void* this, const int8_t typeInt, const char* class, const char* fmt, ...) {
 
+    Logger* logger = (Logger*)this;
+
     va_list args;
     va_start(args, fmt);
@@ -55,4 +57,5 @@
             break;
         case MSG_DEBUG:
+            if (!logger->showDebug) return;
             sprintf(typeStr, "DEBUG");
             break;
@@ -70,7 +73,6 @@
         sprintf(msg_fmt, "%s", fmt);
     else
-        sprintf(msg_fmt, "%19s | %6s | %15s | %s ", timeStr, typeStr, class,  fmt);
+        sprintf(msg_fmt, "%18s | %6s | %15s | %s ", timeStr, typeStr, class,  fmt);
 
-    Logger* logger = (Logger*)this;
 
     // write either to file or stdout
@@ -83,22 +85,29 @@
 
   Returns a new Logger object.
+  
+  path      - path to file where log should be saved, otherwise stdout is used
+  showDebug - show debug messages or not 
   */
-Logger* new_Logger(const char* path) {
-
+Logger* new_Logger(const char* path, const int8_t showDebug) {
 
     Logger* this = (Logger*)calloc(1, sizeof(Logger));
 
     this->file = NULL;
+    this->showDebug = showDebug;
     gettimeofday(&this->startTime, 0);
 
     // open a file to write to
-    if (path != NULL) {
-
-        this->file = fopen(path, "w+");
-        if (this->file == NULL) 
-            print(this, MSG_ERROR, "Logger", "Cannot open file for writing here '%s'\n", path);
-    }
+    if (path != NULL) this->file = fopen(path, "w+");
 
     print(this, MSG_DEBUG, "Logger", "Constructor\n");
+    print(this, MSG_INFO, "Logger", "Starting timer\n");
+
+    if (path != NULL) { 
+
+        if (this->file == NULL)
+            print(this, MSG_ERROR, "Logger", "Cannot open file for writing here '%s'\n", path);
+        else
+            printf("**** Saving log to '%s'\n", path);
+    }
 
     // method pointers
Index: trunk/ippToPsps/src/Logger.h
===================================================================
--- trunk/ippToPsps/src/Logger.h	(revision 31035)
+++ trunk/ippToPsps/src/Logger.h	(revision 31036)
@@ -32,4 +32,5 @@
     FILE* file;
     struct timeval startTime;
+    int8_t showDebug;
 
     // methods
@@ -43,5 +44,5 @@
 
 // constructor
-Logger* new_Logger(const char* path);
+Logger* new_Logger(const char* path, const int8_t showDebug);
 
 # endif // IPPTOPSPS_LOGGER_H 
Index: trunk/ippToPsps/src/StackBatch.c
===================================================================
--- trunk/ippToPsps/src/StackBatch.c	(revision 31035)
+++ trunk/ippToPsps/src/StackBatch.c	(revision 31036)
@@ -386,6 +386,6 @@
     this->base.print(&this->base);
 
-    printf("* skycell ID      : %d\n", this->skycellId);
-    printf("\n");
+    this->base.logger->print(this->base.logger, MSG_INFO, "StackBatch", "skycell ID      : %d\n", this->skycellId);
+    this->base.logger->print(this->base.logger, MSG_INFO, "StackBatch", "\n");
 }
 
@@ -454,4 +454,6 @@
     parseArguments(this, *argc, argv);
 
+    this->print(this);
+
     return this;
 }
@@ -464,12 +466,10 @@
 //    ippToPsps_VersionPrint();
 
-    int exitCode;
-
-    Logger* logger = new_Logger(NULL);
+    Logger* logger = new_Logger(NULL, false);
     logger->print(logger, MSG_INFO, "main", "Creating new stack batch\n");
 
     StackBatch* stackBatch = new_StackBatch(logger, &argc, argv);
     stackBatch->base.run(stackBatch);
-    exitCode = stackBatch->base.exitCode;
+    int exitCode = stackBatch->base.exitCode;
 
     stackBatch->destroy(stackBatch);
