From 91a3e21857d7daebb6c382da8a098a968fa5b826 Mon Sep 17 00:00:00 2001 From: gcontini <1121667+gcontini@users.noreply.github.com> Date: 周六, 24 10月 2020 21:11:02 +0800 Subject: [PATCH] better logging --- src/library/os/linux/os_linux.cpp | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/library/os/linux/os_linux.cpp b/src/library/os/linux/os_linux.cpp index d4c7cd7..b23d1af 100644 --- a/src/library/os/linux/os_linux.cpp +++ b/src/library/os/linux/os_linux.cpp @@ -22,10 +22,10 @@ #ifdef USE_DISK_MODEL #define PARSE_ID_FUNC parse_disk_id -#define ID_FOLDER "/dev/disk/by-id/" +#define ID_FOLDER "/dev/disk/by-id" #else #define PARSE_ID_FUNC parseUUID -#define ID_FOLDER "/dev/disk/by-uuid/" +#define ID_FOLDER "/dev/disk/by-uuid" #endif #ifdef USE_DBUS #include <dbus-1.0/dbus/dbus.h> @@ -148,7 +148,7 @@ DIR *disk_by_uuid_dir = opendir(ID_FOLDER); if (disk_by_uuid_dir == nullptr) { - LOG_DEBUG("Open " ID_FOLDER " fail"); + LOG_DEBUG("Open " ID_FOLDER " fail: %s", std::strerror(errno)); } else { const std::string base_dir(ID_FOLDER "/"); while ((dir = readdir(disk_by_uuid_dir)) != nullptr && diskInfos.size() < MAX_UNITS) { @@ -176,6 +176,8 @@ } } if (!found) { + LOG_DEBUG("Found disk inode %d device %s, sn %s", sym_stat.st_ino, tmpDiskInfo.device, + dir->d_name); diskInfos.push_back(tmpDiskInfo); } } else { @@ -207,12 +209,12 @@ } } } else { - LOG_DEBUG("Stat %s for fail:F %s", cur_disk_label, std::strerror(errno)); + LOG_DEBUG("Stat %s for fail:F %s", cur_disk_label.c_str(), std::strerror(errno)); } } closedir(disk_by_label); } else { - LOG_DEBUG("Open %s for reading disk labels fail", label_dir); + LOG_DEBUG("Open %s for reading disk labels fail: %s", label_dir.c_str(), std::strerror(errno)); } return result; -- Gitblit v1.9.1