From f6f88cc78839c3140b7911ce67bcf0b2c9001904 Mon Sep 17 00:00:00 2001 From: Jacob Dufault Date: Mon, 27 Nov 2017 18:00:08 -0800 Subject: [PATCH] Better logging in when iterating files. --- src/utils.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/utils.cc b/src/utils.cc index 128a10b0..8be2cd78 100644 --- a/src/utils.cc +++ b/src/utils.cc @@ -127,14 +127,15 @@ static void GetFilesInFolderHelper( const std::function& handler) { tinydir_dir dir; if (tinydir_open(&dir, folder.c_str()) == -1) { - // perror("Error opening file"); + LOG_S(WARNING) << "Unable to open directory " << folder; goto bail; } while (dir.has_next) { tinydir_file file; if (tinydir_readfile(&dir, &file) == -1) { - // perror("Error getting file"); + LOG_S(WARNING) << "Unable to read file " << file.name + << " when reading directory " << folder; goto bail; } @@ -159,7 +160,8 @@ static void GetFilesInFolderHelper( } if (tinydir_next(&dir) == -1) { - perror("Error getting next file"); + LOG_S(WARNING) << "Unable to fetch next file when reading directory " + << folder; goto bail; } }