From 9d2aaf12f244631168e104fc46a1c87a979f61ee Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Tue, 20 Aug 2024 01:21:05 +0300 Subject: [PATCH] Convert cfile to use new logging facility --- cfile/CMakeLists.txt | 1 + cfile/cfile.cpp | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/cfile/CMakeLists.txt b/cfile/CMakeLists.txt index 31535729..a249fdcf 100644 --- a/cfile/CMakeLists.txt +++ b/cfile/CMakeLists.txt @@ -13,6 +13,7 @@ target_link_libraries(cfile PRIVATE ddio mem misc + plog::plog ) target_include_directories(cfile PUBLIC $name.u8string().c_str(), "rb"); if (!fp) { - mprintf(1, "Error opening library <%s> when opening file <%s>; errno=%d.", - lib->name.u8string().c_str(), filename.u8string().c_str(), errno); + LOG_ERROR.printf("Error opening library <%s> when opening file <%s>; errno=%d.", + lib->name.u8string().c_str(), filename.u8string().c_str(), errno); Int3(); return nullptr; } @@ -328,8 +329,8 @@ CFILE *open_file_in_lib(const char *filename) { } else { fp = fopen(lib->name.u8string().c_str(), "rb"); if (!fp) { - mprintf(1, "Error opening library <%s> when opening file <%s>; errno=%d.", lib->name.u8string().c_str(), - filename, errno); + LOG_ERROR.printf("Error opening library <%s> when opening file <%s>; errno=%d.", + lib->name.u8string().c_str(), filename, errno); Int3(); return nullptr; } @@ -657,7 +658,8 @@ int cf_ReadBytes(uint8_t *buf, int count, CFILE *cfp) { if (!feof(cfp->file)) error_msg = strerror(errno); } - mprintf(1, "Error reading %d bytes from position %d of file <%s>; errno=%d.", count, cfp->position, cfp->name, errno); + LOG_ERROR.printf("Error reading %d bytes from position %d of file <%s>; errno=%d.", + count, cfp->position, cfp->name, errno); return 0; } // The following functions read numeric vales from a CFILE. All values are