scripted-diff: Replace error() with LogError()

This fixes the log output when -logsourcelocations is used.

Also, instead of 'ERROR:', the log will now say '[error]', like other
errors logged with LogError.

-BEGIN VERIFY SCRIPT-
 sed -i --regexp-extended 's!  error\("([^"]+)"!  LogError("\1\\n"!g' $( git grep -l '  error(' ./src/ )
-END VERIFY SCRIPT-
This commit is contained in:
MarcoFalke
2024-01-11 19:43:27 +01:00
parent fa808fb749
commit fad0335517
13 changed files with 97 additions and 97 deletions

View File

@@ -44,7 +44,7 @@ bool SerializeDB(Stream& stream, const Data& data)
hashwriter << Params().MessageStart() << data;
stream << hashwriter.GetHash();
} catch (const std::exception& e) {
error("%s: Serialize or I/O error - %s", __func__, e.what());
LogError("%s: Serialize or I/O error - %s\n", __func__, e.what());
return false;
}
@@ -65,7 +65,7 @@ bool SerializeFileDB(const std::string& prefix, const fs::path& path, const Data
if (fileout.IsNull()) {
fileout.fclose();
remove(pathTmp);
error("%s: Failed to open file %s", __func__, fs::PathToString(pathTmp));
LogError("%s: Failed to open file %s\n", __func__, fs::PathToString(pathTmp));
return false;
}
@@ -78,7 +78,7 @@ bool SerializeFileDB(const std::string& prefix, const fs::path& path, const Data
if (!FileCommit(fileout.Get())) {
fileout.fclose();
remove(pathTmp);
error("%s: Failed to flush file %s", __func__, fs::PathToString(pathTmp));
LogError("%s: Failed to flush file %s\n", __func__, fs::PathToString(pathTmp));
return false;
}
fileout.fclose();
@@ -86,7 +86,7 @@ bool SerializeFileDB(const std::string& prefix, const fs::path& path, const Data
// replace existing file, if any, with new file
if (!RenameOver(pathTmp, path)) {
remove(pathTmp);
error("%s: Rename-into-place failed", __func__);
LogError("%s: Rename-into-place failed\n", __func__);
return false;
}
@@ -144,7 +144,7 @@ bool CBanDB::Write(const banmap_t& banSet)
}
for (const auto& err : errors) {
error("%s", err);
LogError("%s\n", err);
}
return false;
}