diff transform/FileFeatureWriter.cpp @ 689:573d45e9487b

Merge from debug-output branch
author Chris Cannam
date Tue, 14 Jun 2011 14:47:59 +0100
parents 06f13a3b9e9e
children 1424aa29ae95
line wrap: on
line diff
--- a/transform/FileFeatureWriter.cpp	Tue Jun 14 13:43:03 2011 +0100
+++ b/transform/FileFeatureWriter.cpp	Tue Jun 14 14:47:59 2011 +0100
@@ -46,7 +46,7 @@
         } else if (m_support & SupportOneFileTotal) {
             m_singleFileName = QString("output.%1").arg(m_extension);
         } else {
-            cerr << "FileFeatureWriter::FileFeatureWriter: ERROR: Invalid support specification " << support << endl;
+            DEBUG << "FileFeatureWriter::FileFeatureWriter: ERROR: Invalid support specification " << support << endl;
         }
     }
 }
@@ -60,8 +60,8 @@
     }
     while (!m_files.empty()) {
         if (m_files.begin()->second) {
-            cerr << "FileFeatureWriter::~FileFeatureWriter: NOTE: Closing feature file \""
-                 << m_files.begin()->second->fileName().toStdString() << "\"" << endl;
+            DEBUG << "FileFeatureWriter::~FileFeatureWriter: NOTE: Closing feature file \""
+                 << m_files.begin()->second->fileName() << "\"" << endl;
             delete m_files.begin()->second;
         }
         m_files.erase(m_files.begin());
@@ -128,7 +128,7 @@
             if (m_support & SupportOneFilePerTrackTransform &&
                 m_support & SupportOneFilePerTrack) {
                 if (m_singleFileName != "") {
-                    cerr << "FileFeatureWriter::setParameters: WARNING: Both one-file and many-files parameters provided, ignoring many-files" << endl;
+                    DEBUG << "FileFeatureWriter::setParameters: WARNING: Both one-file and many-files parameters provided, ignoring many-files" << endl;
                 } else {
                     m_manyFiles = true;
                 }
@@ -142,7 +142,7 @@
                     // OneFilePerTrack), so we need to be able to
                     // override it
 //                    if (m_manyFiles) {
-//                        cerr << "FileFeatureWriter::setParameters: WARNING: Both many-files and one-file parameters provided, ignoring one-file" << endl;
+//                        DEBUG << "FileFeatureWriter::setParameters: WARNING: Both many-files and one-file parameters provided, ignoring one-file" << endl;
 //                    } else {
                         m_singleFileName = i->second.c_str();
 //                    }
@@ -151,7 +151,7 @@
         } else if (i->first == "stdout") {
             if (m_support & SupportOneFileTotal) {
                 if (m_singleFileName != "") {
-                    cerr << "FileFeatureWriter::setParameters: WARNING: Both stdout and one-file provided, ignoring stdout" << endl;
+                    DEBUG << "FileFeatureWriter::setParameters: WARNING: Both stdout and one-file provided, ignoring stdout" << endl;
                 } else {
                     m_stdout = true;
                 }
@@ -170,8 +170,8 @@
 {
     if (m_singleFileName != "") {
         if (QFileInfo(m_singleFileName).exists() && !(m_force || m_append)) {
-            cerr << endl << "FileFeatureWriter: ERROR: Specified output file \"" << m_singleFileName.toStdString() << "\" exists and neither --" << getWriterTag().toStdString() << "-force nor --" << getWriterTag().toStdString() << "-append flag is specified -- not overwriting" << endl;
-            cerr << "NOTE: To find out how to fix this problem, read the help for the --" << getWriterTag().toStdString() << "-force" << endl << "and --" << getWriterTag().toStdString() << "-append options" << endl;
+            cerr << endl << "FileFeatureWriter: ERROR: Specified output file \"" << m_singleFileName << "\" exists and neither --" << getWriterTag() << "-force nor --" << getWriterTag() << "-append flag is specified -- not overwriting" << endl;
+            DEBUG << "NOTE: To find out how to fix this problem, read the help for the --" << getWriterTag() << "-force" << endl << "and --" << getWriterTag() << "-append options" << endl;
             return "";
         }
         return m_singleFileName;
@@ -193,14 +193,14 @@
         infilename = scheme + ":" + infilename; // DOS drive!
     }
 
-//    cerr << "trackId = " << trackId.toStdString() << ", url = " << url.toString().toStdString() << ", infilename = "
-//         << infilename.toStdString() << ", basename = " << basename.toStdString() << ", m_baseDir = " << m_baseDir.toStdString() << endl;
+//    cerr << "trackId = " << trackId << ", url = " << url.toString() << ", infilename = "
+//         << infilename << ", basename = " << basename << ", m_baseDir = " << m_baseDir << endl;
 
     if (m_baseDir != "") dirname = QFileInfo(m_baseDir).absoluteFilePath();
     else if (local) dirname = QFileInfo(infilename).absolutePath();
     else dirname = QDir::currentPath();
 
-//    cerr << "dirname = " << dirname.toStdString() << endl;
+//    cerr << "dirname = " << dirname << endl;
 
     QString filename;
 
@@ -215,8 +215,8 @@
     filename = QDir(dirname).filePath(filename);
 
     if (QFileInfo(filename).exists() && !(m_force || m_append)) {
-        cerr << endl << "FileFeatureWriter: ERROR: Output file \"" << filename.toStdString() << "\" exists (for input file or URL \"" << trackId.toStdString() << "\" and transform \"" << transformId.toStdString() << "\") and neither --" << getWriterTag().toStdString() << "-force nor --" << getWriterTag().toStdString() << "-append is specified -- not overwriting" << endl;
-        cerr << "NOTE: To find out how to fix this problem, read the help for the --" << getWriterTag().toStdString() << "-force" << endl << "and --" << getWriterTag().toStdString() << "-append options" << endl;
+        cerr << endl << "FileFeatureWriter: ERROR: Output file \"" << filename << "\" exists (for input file or URL \"" << trackId << "\" and transform \"" << transformId << "\") and neither --" << getWriterTag() << "-force nor --" << getWriterTag() << "-append is specified -- not overwriting" << endl;
+        DEBUG << "NOTE: To find out how to fix this problem, read the help for the --" << getWriterTag() << "-force" << endl << "and --" << getWriterTag() << "-append options" << endl;
         return "";
     }
     
@@ -263,11 +263,11 @@
             return 0;
         }
 
-        cerr << "FileFeatureWriter: NOTE: Using output filename \""
-             << filename.toStdString() << "\"" << endl;
+        DEBUG << "FileFeatureWriter: NOTE: Using output filename \""
+             << filename << "\"" << endl;
 
         if (m_append) {
-            cerr << "FileFeatureWriter: NOTE: Calling reviewFileForAppending" << endl;
+            DEBUG << "FileFeatureWriter: NOTE: Calling reviewFileForAppending" << endl;
             reviewFileForAppending(filename);
         }
         
@@ -329,7 +329,7 @@
 void
 FileFeatureWriter::finish()
 {
-//    cerr << "FileFeatureWriter::finish()" << endl;
+//    DEBUG << "FileFeatureWriter::finish()" << endl;
 
     if (m_singleFileName != "" || m_stdout) return;
 
@@ -340,8 +340,8 @@
     }
     while (!m_files.empty()) {
         if (m_files.begin()->second) {
-            cerr << "FileFeatureWriter::finish: NOTE: Closing feature file \""
-                 << m_files.begin()->second->fileName().toStdString() << "\"" << endl;
+            DEBUG << "FileFeatureWriter::finish: NOTE: Closing feature file \""
+                 << m_files.begin()->second->fileName() << "\"" << endl;
             delete m_files.begin()->second;
         }
         m_files.erase(m_files.begin());