prettified LOG lines
This commit is contained in:
parent
c9c3158121
commit
9f02bc8119
@ -77,7 +77,8 @@ static string colon_restore(const string& in)
|
||||
// (ie message having a given attachment)
|
||||
bool FileInterner::getEnclosingUDI(const Rcl::Doc &doc, string& udi)
|
||||
{
|
||||
LOGDEB("FileInterner::getEnclosingUDI(): url [" << (doc.url) << "] ipath [" << (doc.ipath) << "]\n" );
|
||||
LOGDEB("FileInterner::getEnclosingUDI(): url [" << doc.url <<
|
||||
"] ipath [" << doc.ipath << "]\n");
|
||||
string eipath = doc.ipath;
|
||||
string::size_type colon;
|
||||
if (eipath.empty())
|
||||
@ -119,7 +120,7 @@ FileInterner::FileInterner(const string &fn, const struct stat *stp,
|
||||
RclConfig *cnf, int flags, const string *imime)
|
||||
: m_ok(false), m_missingdatap(0), m_uncomp((flags & FIF_forPreview) != 0)
|
||||
{
|
||||
LOGDEB0("FileInterner::FileInterner(fn=" << (fn) << ")\n" );
|
||||
LOGDEB0("FileInterner::FileInterner(fn=" << fn << ")\n");
|
||||
if (fn.empty()) {
|
||||
LOGERR("FileInterner::FileInterner: empty file name!\n");
|
||||
return;
|
||||
@ -154,7 +155,7 @@ void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf,
|
||||
// document, but this can be part of a compound document, and
|
||||
// we're dealing with the top level file here, or this could be a
|
||||
// compressed file. The flag tells us we really can use it
|
||||
// (e.g. the beagle indexer sets it).
|
||||
// (e.g. the web indexer sets it).
|
||||
if (flags & FIF_doUseInputMimetype) {
|
||||
if (!imime) {
|
||||
LOGERR("FileInterner:: told to use null imime\n");
|
||||
@ -163,8 +164,8 @@ void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf,
|
||||
l_mime = *imime;
|
||||
} else {
|
||||
LOGDEB("FileInterner::init fn [" << f << "] mime [" <<
|
||||
(imime?imime->c_str() : "(null)") << "] preview " << m_forPreview
|
||||
<< "\n" );
|
||||
(imime ? imime->c_str() : "(null)") << "] preview " <<
|
||||
m_forPreview << "\n");
|
||||
|
||||
// Run mime type identification in any case (see comment above).
|
||||
l_mime = mimetype(m_fn, stp, m_cfg, usfci);
|
||||
@ -191,12 +192,13 @@ void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf,
|
||||
if (!m_uncomp.uncompressfile(m_fn, ucmd, m_tfile)) {
|
||||
return;
|
||||
}
|
||||
LOGDEB1("FileInterner:: after ucomp: tfile " << (m_tfile) << "\n" );
|
||||
LOGDEB1("FileInterner:: after ucomp: tfile " << m_tfile <<"\n");
|
||||
m_fn = m_tfile;
|
||||
// Stat the uncompressed file, mainly to get the size
|
||||
struct stat ucstat;
|
||||
if (path_fileprops(m_fn, &ucstat) != 0) {
|
||||
LOGERR("FileInterner: can't stat the uncompressed file[" << (m_fn) << "] errno " << (errno) << "\n" );
|
||||
LOGERR("FileInterner: can't stat the uncompressed file[" <<
|
||||
m_fn << "] errno " << errno << "\n");
|
||||
return;
|
||||
} else {
|
||||
docsize = ucstat.st_size;
|
||||
@ -205,7 +207,8 @@ void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf,
|
||||
if (l_mime.empty() && imime)
|
||||
l_mime = *imime;
|
||||
} else {
|
||||
LOGINFO("FileInterner:: " << (m_fn) << " over size limit " << (maxkbs) << " kbs\n" );
|
||||
LOGINFO("FileInterner:: " << m_fn << " over size limit " <<
|
||||
maxkbs << " kbs\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -213,7 +216,7 @@ void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf,
|
||||
if (l_mime.empty()) {
|
||||
// No mime type. We let it through as config may warrant that
|
||||
// we index all file names
|
||||
LOGDEB0("FileInterner:: no mime: [" << (m_fn) << "]\n" );
|
||||
LOGDEB0("FileInterner:: no mime: [" << m_fn << "]\n");
|
||||
}
|
||||
|
||||
// Look for appropriate handler (might still return empty)
|
||||
@ -222,7 +225,8 @@ void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf,
|
||||
|
||||
if (!df || df->is_unknown()) {
|
||||
// No real handler for this type, for now :(
|
||||
LOGDEB("FileInterner:: unprocessed mime: [" << (l_mime) << "] [" << (f) << "]\n" );
|
||||
LOGDEB("FileInterner:: unprocessed mime: [" << l_mime << "] [" << f <<
|
||||
"]\n");
|
||||
if (!df)
|
||||
return;
|
||||
}
|
||||
@ -242,12 +246,12 @@ void FileInterner::init(const string &f, const struct stat *stp, RclConfig *cnf,
|
||||
df->set_docsize(docsize);
|
||||
if (!df->set_document_file(l_mime, m_fn)) {
|
||||
delete df;
|
||||
LOGERR("FileInterner:: error converting " << (m_fn) << "\n" );
|
||||
LOGERR("FileInterner:: error converting " << m_fn << "\n");
|
||||
return;
|
||||
}
|
||||
|
||||
m_handlers.push_back(df);
|
||||
LOGDEB("FileInterner:: init ok " << (l_mime) << " [" << (m_fn) << "]\n" );
|
||||
LOGDEB("FileInterner:: init ok " << l_mime << " [" << m_fn << "]\n");
|
||||
m_ok = true;
|
||||
}
|
||||
|
||||
@ -276,7 +280,7 @@ void FileInterner::init(const string &data, RclConfig *cnf,
|
||||
if (!df) {
|
||||
// No handler for this type, for now :( if indexallfilenames
|
||||
// is set in the config, this normally wont happen (we get mh_unknown)
|
||||
LOGDEB("FileInterner:: unprocessed mime [" << (m_mimetype) << "]\n" );
|
||||
LOGDEB("FileInterner:: unprocessed mime [" << m_mimetype << "]\n");
|
||||
return;
|
||||
}
|
||||
df->set_property(Dijon::Filter::OPERATING_MODE,
|
||||
@ -297,7 +301,8 @@ void FileInterner::init(const string &data, RclConfig *cnf,
|
||||
}
|
||||
}
|
||||
if (!result) {
|
||||
LOGINFO("FileInterner:: set_doc failed inside for mtype " << (m_mimetype) << "\n" );
|
||||
LOGINFO("FileInterner:: set_doc failed inside for mtype " <<
|
||||
m_mimetype << "\n");
|
||||
delete df;
|
||||
return;
|
||||
}
|
||||
@ -382,12 +387,13 @@ TempFile FileInterner::dataToTempFile(const string& dt, const string& mt)
|
||||
// Create temp file with appropriate suffix for mime type
|
||||
TempFile temp(new TempFileInternal(m_cfg->getSuffixFromMimeType(mt)));
|
||||
if (!temp->ok()) {
|
||||
LOGERR("FileInterner::dataToTempFile: cant create tempfile: " << (temp->getreason()) << "\n" );
|
||||
LOGERR("FileInterner::dataToTempFile: cant create tempfile: " <<
|
||||
temp->getreason() << "\n");
|
||||
return TempFile();
|
||||
}
|
||||
string reason;
|
||||
if (!stringtofile(dt, temp->filename(), reason)) {
|
||||
LOGERR("FileInterner::dataToTempFile: stringtofile: " << (reason) << "\n" );
|
||||
LOGERR("FileInterner::dataToTempFile: stringtofile: " <<reason << "\n");
|
||||
return TempFile();
|
||||
}
|
||||
return temp;
|
||||
@ -398,7 +404,7 @@ TempFile FileInterner::dataToTempFile(const string& dt, const string& mt)
|
||||
// RECFILTERROR HELPERNOTFOUND program1 [program2 ...]
|
||||
void FileInterner::checkExternalMissing(const string& msg, const string& mt)
|
||||
{
|
||||
LOGDEB2("checkExternalMissing: [" << (msg) << "]\n" );
|
||||
LOGDEB2("checkExternalMissing: [" << msg << "]\n");
|
||||
if (m_missingdatap && msg.find("RECFILTERROR") == 0) {
|
||||
vector<string> verr;
|
||||
stringToStrings(msg, verr);
|
||||
@ -490,10 +496,10 @@ static inline bool getKeyValue(const map<string, string>& docdata,
|
||||
it = docdata.find(key);
|
||||
if (it != docdata.end()) {
|
||||
value = it->second;
|
||||
LOGDEB2("getKeyValue: [" << (key) << "]->[" << (value) << "]\n" );
|
||||
LOGDEB2("getKeyValue: [" << key << "]->[" << value << "]\n");
|
||||
return true;
|
||||
}
|
||||
LOGDEB2("getKeyValue: no value for [" << (key) << "]\n" );
|
||||
LOGDEB2("getKeyValue: no value for [" << key << "]\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -618,7 +624,7 @@ void FileInterner::collectIpathAndMT(Rcl::Doc& doc) const
|
||||
|
||||
// Trim empty tail elements in ipath.
|
||||
if (hasipath) {
|
||||
LOGDEB2("IPATH [" << (doc.ipath) << "]\n" );
|
||||
LOGDEB2("IPATH [" << doc.ipath << "]\n");
|
||||
string::size_type sit = doc.ipath.find_last_not_of(cstr_isep);
|
||||
if (sit == string::npos)
|
||||
doc.ipath.erase();
|
||||
@ -748,12 +754,14 @@ void FileInterner::processNextDocError(Rcl::Doc &doc)
|
||||
collectIpathAndMT(doc);
|
||||
m_reason = m_handlers.back()->get_error();
|
||||
checkExternalMissing(m_reason, doc.mimetype);
|
||||
LOGERR("FileInterner::internfile: next_document error [" << (m_fn) << "" << (doc.ipath.empty() ? "" : "|") << "" << (doc.ipath) << "] " << (doc.mimetype) << " " << (m_reason) << "\n" );
|
||||
LOGERR("FileInterner::internfile: next_document error [" << m_fn <<
|
||||
(doc.ipath.empty() ? "" : "|") << doc.ipath << "] " <<
|
||||
doc.mimetype << " " << m_reason << "\n");
|
||||
}
|
||||
|
||||
FileInterner::Status FileInterner::internfile(Rcl::Doc& doc,const string& ipath)
|
||||
{
|
||||
LOGDEB("FileInterner::internfile. ipath [" << (ipath) << "]\n" );
|
||||
LOGDEB("FileInterner::internfile. ipath [" << ipath << "]\n");
|
||||
|
||||
// Get rid of possible image tempfile from older call
|
||||
m_imgtmp.reset();
|
||||
@ -977,13 +985,13 @@ bool FileInterner::topdocToFile(TempFile& otemp, const string& tofile,
|
||||
switch (rawdoc.kind) {
|
||||
case DocFetcher::RawDoc::RDK_FILENAME:
|
||||
if (!copyfile(rawdoc.data.c_str(), filename, reason)) {
|
||||
LOGERR("FileInterner::idocToFile: copyfile: " << (reason) << "\n" );
|
||||
LOGERR("FileInterner::idocToFile: copyfile: " << reason << "\n");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case DocFetcher::RawDoc::RDK_DATA:
|
||||
if (!stringtofile(rawdoc.data, filename, reason)) {
|
||||
LOGERR("FileInterner::idocToFile: stringtofile: " << (reason) << "\n" );
|
||||
LOGERR("FileInterner::idocToFile: stringtofile: " << reason <<"\n");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
@ -1033,7 +1041,7 @@ bool FileInterner::interntofile(TempFile& otemp, const string& tofile,
|
||||
}
|
||||
string reason;
|
||||
if (!stringtofile(doc.text, filename, reason)) {
|
||||
LOGERR("FileInterner::interntofile: stringtofile : " << (reason) << "\n" );
|
||||
LOGERR("FileInterner::interntofile: stringtofile : " << reason << "\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1044,15 +1052,16 @@ bool FileInterner::interntofile(TempFile& otemp, const string& tofile,
|
||||
|
||||
bool FileInterner::isCompressed(const string& fn, RclConfig *cnf)
|
||||
{
|
||||
LOGDEB("FileInterner::isCompressed: [" << (fn) << "]\n" );
|
||||
LOGDEB("FileInterner::isCompressed: [" << fn << "]\n");
|
||||
struct stat st;
|
||||
if (path_fileprops(fn, &st) < 0) {
|
||||
LOGERR("FileInterner::isCompressed: can't stat [" << (fn) << "]\n" );
|
||||
LOGERR("FileInterner::isCompressed: can't stat [" << fn << "]\n");
|
||||
return false;
|
||||
}
|
||||
string l_mime = mimetype(fn, &st, cnf, true);
|
||||
if (l_mime.empty()) {
|
||||
LOGERR("FileInterner::isUncompressed: can't get mime for [" << (fn) << "]\n" );
|
||||
LOGERR("FileInterner::isUncompressed: can't get mime for [" << fn <<
|
||||
"]\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1067,15 +1076,16 @@ bool FileInterner::isCompressed(const string& fn, RclConfig *cnf)
|
||||
bool FileInterner::maybeUncompressToTemp(TempFile& temp, const string& fn,
|
||||
RclConfig *cnf, const Rcl::Doc& doc)
|
||||
{
|
||||
LOGDEB("FileInterner::maybeUncompressToTemp: [" << (fn) << "]\n" );
|
||||
LOGDEB("FileInterner::maybeUncompressToTemp: [" << fn << "]\n");
|
||||
struct stat st;
|
||||
if (path_fileprops(fn.c_str(), &st) < 0) {
|
||||
LOGERR("FileInterner::maybeUncompressToTemp: can't stat [" << (fn) << "]\n" );
|
||||
LOGERR("FileInterner::maybeUncompressToTemp: can't stat [" <<fn<<"]\n");
|
||||
return false;
|
||||
}
|
||||
string l_mime = mimetype(fn, &st, cnf, true);
|
||||
if (l_mime.empty()) {
|
||||
LOGERR("FileInterner::maybeUncompress.: can't id. mime for [" << (fn) << "]\n" );
|
||||
LOGERR("FileInterner::maybeUncompress.: can't id. mime for [" <<
|
||||
fn << "]\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1087,13 +1097,14 @@ bool FileInterner::maybeUncompressToTemp(TempFile& temp, const string& fn,
|
||||
int maxkbs = -1;
|
||||
if (cnf->getConfParam("compressedfilemaxkbs", &maxkbs) &&
|
||||
maxkbs >= 0 && int(st.st_size / 1024) > maxkbs) {
|
||||
LOGINFO("FileInterner:: " << (fn) << " over size limit " << (maxkbs) << " kbs\n" );
|
||||
LOGINFO("FileInterner:: " << fn << " over size limit " << maxkbs <<
|
||||
" kbs\n");
|
||||
return false;
|
||||
}
|
||||
temp =
|
||||
TempFile(new TempFileInternal(cnf->getSuffixFromMimeType(doc.mimetype)));
|
||||
if (!temp->ok()) {
|
||||
LOGERR("FileInterner: cant create temporary file" );
|
||||
LOGERR("FileInterner: cant create temporary file\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1108,7 +1119,8 @@ bool FileInterner::maybeUncompressToTemp(TempFile& temp, const string& fn,
|
||||
// uncompressed file, hopefully staying on the same dev.
|
||||
string reason;
|
||||
if (!renameormove(uncomped.c_str(), temp->filename(), reason)) {
|
||||
LOGERR("FileInterner::maybeUncompress: move [" << (uncomped) << "] -> [" << (temp->filename()) << "] failed: " << (reason) << "\n" );
|
||||
LOGERR("FileInterner::maybeUncompress: move [" << uncomped <<
|
||||
"] -> [" << temp->filename() << "] failed: " << reason << "\n");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user