]> git.donarmstrong.com Git - mothur.git/blobdiff - mothur.cpp
added set.logfile command
[mothur.git] / mothur.cpp
index 623601207afe90ae92a691646110eac2e9a18f79..4f91c2e90a0b52aa8c3f51140e857660e8ba038f 100644 (file)
@@ -73,9 +73,9 @@ int main(int argc, char *argv[]){
                #endif
                
                //header
-               m->mothurOut("mothur v.1.8");
+               m->mothurOut("mothur v.1.9");
                m->mothurOutEndLine();          
-               m->mothurOut("Last updated: 2/02/2010");
+               m->mothurOut("Last updated: 4/16/2010");
                m->mothurOutEndLine();  
                m->mothurOutEndLine();          
                m->mothurOut("by");
@@ -144,12 +144,37 @@ int main(int argc, char *argv[]){
                
                while(bail == 0)        {       bail = mothur->getInput();      }
                
+               //closes logfile so we can rename
+               m->closeLog();
+               
                string outputDir = mothur->getOutputDir();
-               string newlogFileName = outputDir + logFileName;
-       
-               //need this because m->mothurOut makes the logfile, but doesn't know where to put it
-               rename(logFileName.c_str(), newlogFileName.c_str()); //logfile with timestamp
+               string tempLog = mothur->getLogFileName();
+               bool append = mothur->getAppend();
                
+               string newlogFileName;
+               if (tempLog != "") {
+                       newlogFileName = outputDir + tempLog;
+                       
+                       if (!append) {  
+                               //need this because m->mothurOut makes the logfile, but doesn't know where to put it
+                               rename(logFileName.c_str(), newlogFileName.c_str()); //logfile with timestamp
+
+                       }else {
+                               ofstream outNewLog;
+                               openOutputFileAppend(newlogFileName, outNewLog);
+                               outNewLog << endl << endl << "*********************************************************************************" << endl << endl;
+                               outNewLog.close();
+                               
+                               appendFiles(logFileName, newlogFileName);
+                               remove(logFileName.c_str());
+                       }
+               }else{  
+                       newlogFileName = outputDir + logFileName;
+                       //need this because m->mothurOut makes the logfile, but doesn't know where to put it
+                       rename(logFileName.c_str(), newlogFileName.c_str()); //logfile with timestamp
+               }
+               
+                               
                delete mothur;
                
                #ifdef USE_MPI