Switch to side-by-side view

--- a/src/internfile/mh_execm.cpp
+++ b/src/internfile/mh_execm.cpp
@@ -23,7 +23,7 @@
 #include "cstr.h"
 #include "mh_execm.h"
 #include "mh_html.h"
-#include "debuglog.h"
+#include "log.h"
 #include "cancelcheck.h"
 #include "smallut.h"
 #include "md5ut.h"
@@ -36,10 +36,10 @@
 
 bool MimeHandlerExecMultiple::startCmd()
 {
-    LOGDEB(("MimeHandlerExecMultiple::startCmd\n"));
+    LOGDEB("MimeHandlerExecMultiple::startCmd\n" );
     if (params.empty()) {
 	// Hu ho
-	LOGERR(("MHExecMultiple::startCmd: empty params\n"));
+	LOGERR("MHExecMultiple::startCmd: empty params\n" );
 	m_reason = "RECFILTERROR BADCONFIG";
 	return false;
     }
@@ -86,15 +86,15 @@
 
     // Read name and length
     if (m_cmd.getline(ibuf) <= 0) {
-        LOGERR(("MHExecMultiple: getline error\n"));
+        LOGERR("MHExecMultiple: getline error\n" );
         return false;
     }
     
-    LOGDEB1(("MHEM:rde: line [%s]\n", ibuf.c_str()));
+    LOGDEB1("MHEM:rde: line ["  << (ibuf) << "]\n" );
 
     // Empty line (end of message) ?
     if (!ibuf.compare("\n")) {
-        LOGDEB(("MHExecMultiple: Got empty line\n"));
+        LOGDEB("MHExecMultiple: Got empty line\n" );
         name.clear();
         return true;
     }
@@ -112,8 +112,7 @@
     vector<string> tokens;
     stringToTokens(ibuf, tokens);
     if (tokens.size() != 2) {
-        LOGERR(("MHExecMultiple: bad line in filter output: [%s]\n",
-                ibuf.c_str()));
+        LOGERR("MHExecMultiple: bad line in filter output: ["  << (ibuf) << "]\n" );
         return false;
     }
     vector<string>::iterator it = tokens.begin();
@@ -121,13 +120,12 @@
     string& slen = *it;
     int len;
     if (sscanf(slen.c_str(), "%d", &len) != 1) {
-        LOGERR(("MHExecMultiple: bad line in filter output: [%s]\n",
-                ibuf.c_str()));
+        LOGERR("MHExecMultiple: bad line in filter output: ["  << (ibuf) << "]\n" );
         return false;
     }
 
     if (len / 1024 > m_maxmemberkb) {
-        LOGERR(("MHExecMultiple: data len > maxmemberkb\n"));
+        LOGERR("MHExecMultiple: data len > maxmemberkb\n" );
         return false;
     }
     
@@ -144,24 +142,23 @@
     // Read element data
     datap->erase();
     if (len > 0 && m_cmd.receive(*datap, len) != len) {
-        LOGERR(("MHExecMultiple: expected %d bytes of data, got %d\n", 
-                len, datap->length()));
-        return false;
-    }
-    LOGDEB1(("MHExecMe:rdDtElt got: name [%s] len %d value [%s]\n", 
-	     name.c_str(), len, datap->size() > 100 ? 
-	     (datap->substr(0, 100) + " ...").c_str() : datap->c_str()));
+        LOGERR("MHExecMultiple: expected "  << (len) << " bytes of data, got "  << (datap->length()) << "\n" );
+        return false;
+    }
+    LOGDEB1("MHExecMe:rdDtElt got: name [" << name << "] len " << len <<
+            "value [" << (datap->size() > 100 ? 
+                          (datap->substr(0, 100) + " ...") : datap) << endl);
     return true;
 }
 
 bool MimeHandlerExecMultiple::next_document()
 {
-    LOGDEB(("MimeHandlerExecMultiple::next_document(): [%s]\n", m_fn.c_str()));
+    LOGDEB("MimeHandlerExecMultiple::next_document(): ["  << (m_fn) << "]\n" );
     if (m_havedoc == false)
 	return false;
 
     if (missingHelper) {
-	LOGDEB(("MHExecMultiple::next_document(): helper known missing\n"));
+	LOGDEB("MHExecMultiple::next_document(): helper known missing\n" );
 	return false;
     }
 
@@ -185,8 +182,7 @@
 	    if (MD5File(m_fn, md5, &reason)) {
 		file_md5 = MD5HexPrint(md5, xmd5);
 	    } else {
-		LOGERR(("MimeHandlerExecM: cant compute md5 for [%s]: %s\n",
-			m_fn.c_str(), reason.c_str()));
+		LOGERR("MimeHandlerExecM: cant compute md5 for ["  << (m_fn) << "]: "  << (reason) << "\n" );
 	    }
 	}
         obuf << "FileName: " << m_fn.length() << "\n" << m_fn;
@@ -196,8 +192,7 @@
         obuf << "Filename: " << 0 << "\n";
     }
     if (!m_ipath.empty()) {
-	LOGDEB(("next_doc: sending len %d val [%s]\n", m_ipath.length(),
-		m_ipath.c_str()));
+	LOGDEB("next_doc: sending len "  << (m_ipath.length()) << " val ["  << (m_ipath) << "]\n" );
         obuf << "Ipath: " << m_ipath.length() << "\n" << m_ipath;
     }
     if (!m_dfltInputCharset.empty()) {
@@ -208,14 +203,14 @@
     obuf << "\n";
     if (m_cmd.send(obuf.str()) < 0) {
         m_cmd.zapChild();
-        LOGERR(("MHExecMultiple: send error\n"));
+        LOGERR("MHExecMultiple: send error\n" );
         return false;
     }
 
     m_adv.reset();
 
     // Read answer (multiple elements)
-    LOGDEB1(("MHExecMultiple: reading answer\n"));
+    LOGDEB1("MHExecMultiple: reading answer\n" );
     bool eofnext_received = false;
     bool eofnow_received = false;
     bool fileerror_received = false;
@@ -231,47 +226,46 @@
                 return false;
             }
         } catch (HandlerTimeout) {
-            LOGINFO(("MHExecMultiple: timeout\n"));
+            LOGINFO("MHExecMultiple: timeout\n" );
             m_cmd.zapChild();
             return false;
         } catch (CancelExcept) {
-            LOGINFO(("MHExecMultiple: interrupt\n"));
+            LOGINFO("MHExecMultiple: interrupt\n" );
             m_cmd.zapChild();
             return false;
         }
         if (name.empty())
             break;
         if (!stringlowercmp("eofnext:", name)) {
-            LOGDEB(("MHExecMultiple: got EOFNEXT\n"));
+            LOGDEB("MHExecMultiple: got EOFNEXT\n" );
             eofnext_received = true;
         } else if (!stringlowercmp("eofnow:", name)) {
-            LOGDEB(("MHExecMultiple: got EOFNOW\n"));
+            LOGDEB("MHExecMultiple: got EOFNOW\n" );
             eofnow_received = true;
         } else if (!stringlowercmp("fileerror:", name)) {
-            LOGDEB(("MHExecMultiple: got FILEERROR\n"));
+            LOGDEB("MHExecMultiple: got FILEERROR\n" );
 	    fileerror_received = true;
         } else if (!stringlowercmp("subdocerror:", name)) {
-            LOGDEB(("MHExecMultiple: got SUBDOCERROR\n"));
+            LOGDEB("MHExecMultiple: got SUBDOCERROR\n" );
 	    subdocerror_received = true;
         } else if (!stringlowercmp("ipath:", name)) {
             ipath = data;
-            LOGDEB(("MHExecMultiple: got ipath [%s]\n", data.c_str()));
+            LOGDEB("MHExecMultiple: got ipath ["  << (data) << "]\n" );
         } else if (!stringlowercmp("charset:", name)) {
             charset = data;
-            LOGDEB(("MHExecMultiple: got charset [%s]\n", data.c_str()));
+            LOGDEB("MHExecMultiple: got charset ["  << (data) << "]\n" );
         } else if (!stringlowercmp("mimetype:", name)) {
             mtype = data;
-            LOGDEB(("MHExecMultiple: got mimetype [%s]\n", data.c_str()));
+            LOGDEB("MHExecMultiple: got mimetype ["  << (data) << "]\n" );
         } else {
             string nm = stringtolower((const string&)name);
             trimstring(nm, ":");
-            LOGDEB(("MHExecMultiple: got [%s] -> [%s]\n", nm.c_str(),
-                    data.c_str()));
+            LOGDEB("MHExecMultiple: got ["  << (nm) << "] -> ["  << (data) << "]\n" );
             m_metaData[nm] += data;
         }
         if (loop == 20) {
             // ?? 
-            LOGERR(("MHExecMultiple: filter sent too many parameters\n"));
+            LOGERR("MHExecMultiple: filter sent too many parameters\n" );
             return false;
         }
     }
@@ -289,8 +283,7 @@
     // this was wrong. Empty documents can be found ie in zip files and should 
     // not be interpreted as eof.
     if (m_metaData[cstr_dj_keycontent].empty()) {
-        LOGDEB0(("MHExecMultiple: got empty document inside [%s]: [%s]\n", 
-                m_fn.c_str(), ipath.c_str()));
+        LOGDEB0("MHExecMultiple: got empty document inside ["  << (m_fn) << "]: ["  << (ipath) << "]\n" );
     }
 
     if (!ipath.empty()) {
@@ -300,8 +293,7 @@
 	// string which we can use to compute a mime type
         m_metaData[cstr_dj_keyipath] = ipath;
         if (mtype.empty()) {
-	    LOGDEB0(("MHExecMultiple: no mime type from filter, "
-		    "using ipath for a guess\n"));
+	    LOGDEB0("MHExecMultiple: no mime type from filter, using ipath for a guess\n" );
             mtype = mimetype(ipath, 0, m_config, false);
             if (mtype.empty()) {
                 // mimetype() won't call idFile when there is no file. Do it
@@ -310,7 +302,7 @@
                     // Note this happens for example for directory zip members
                     // We could recognize them by the end /, but wouldn't know
                     // what to do with them anyway.
-                    LOGINFO(("MHExecMultiple: cant guess mime type\n"));
+                    LOGINFO("MHExecMultiple: cant guess mime type\n" );
                     mtype = "application/octet-stream";
                 }
             }
@@ -335,10 +327,7 @@
     if (eofnext_received)
         m_havedoc = false;
 
-    LOGDEB0(("MHExecMultiple: returning %d bytes of content,"
-	    " mtype [%s] charset [%s]\n", 
-	     m_metaData[cstr_dj_keycontent].size(), 
-	     m_metaData[cstr_dj_keymt].c_str(), 
-	     m_metaData[cstr_dj_keycharset].c_str()));
+    LOGDEB0("MHExecMultiple: returning "  << (m_metaData[cstr_dj_keycontent].size()) << " bytes of content, mtype ["  << (m_metaData[cstr_dj_keymt]) << "] charset ["  << (m_metaData[cstr_dj_keycharset]) << "]\n" );
     return true;
 }
+