diff options
author | Chris Wilson <chris+github@qwirx.com> | 2008-03-28 22:18:44 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2008-03-28 22:18:44 +0000 |
commit | 4fca88ed02c1f0b5208abf2420f73023de54c23e (patch) | |
tree | 51e882893d283f05b569bd27f7efab7b041c4548 /bin/bbackupquery | |
parent | 74bfdebe02405f7847fded96e42c1ccd297c9b9f (diff) |
Improve logging with macros that consistently output strerror(errno) and
errno, replacing almost all use of strerror() in the main code.
Log a more detailed error message before throwing an exception for some
more system call failures.
Make FileStream store its filename on all platforms, not just Windows.
Wrap some long lines at less than 80 characters to improve readability.
Fix some minor violations of coding standard (white space) and a typo
in a comment.
Diffstat (limited to 'bin/bbackupquery')
-rw-r--r-- | bin/bbackupquery/BackupQueries.cpp | 20 | ||||
-rw-r--r-- | bin/bbackupquery/bbackupquery.cpp | 4 |
2 files changed, 11 insertions, 13 deletions
diff --git a/bin/bbackupquery/BackupQueries.cpp b/bin/bbackupquery/BackupQueries.cpp index b6984641..197cd3b7 100644 --- a/bin/bbackupquery/BackupQueries.cpp +++ b/bin/bbackupquery/BackupQueries.cpp @@ -810,8 +810,8 @@ void BackupQueries::CommandChangeLocalDir(const std::vector<std::string> &args) } else { - BOX_ERROR("Error changing to directory '" << - args[0] << ": " << strerror(errno)); + BOX_LOG_SYS_ERROR("Failed to change to directory " + "'" << args[0] << "'"); } SetReturnCode(COMMAND_RETURN_ERROR); @@ -822,8 +822,7 @@ void BackupQueries::CommandChangeLocalDir(const std::vector<std::string> &args) char wd[PATH_MAX]; if(::getcwd(wd, PATH_MAX) == 0) { - BOX_ERROR("Error getting current directory: " << - strerror(errno)); + BOX_LOG_SYS_ERROR("Error getting current directory"); SetReturnCode(COMMAND_RETURN_ERROR); return; } @@ -1399,9 +1398,8 @@ void BackupQueries::Compare(int64_t DirID, const std::string &rStoreDir, const s } else { - BOX_WARNING("Failed to access local directory '" << - localDirDisplay << ": " << strerror(errno) << - "'."); + BOX_LOG_SYS_WARNING("Failed to access local directory " + "'" << localDirDisplay << "'"); rParams.mUncheckedFiles ++; } return; @@ -1449,8 +1447,8 @@ void BackupQueries::Compare(int64_t DirID, const std::string &rStoreDir, const s DIR *dirhandle = ::opendir(rLocalDir.c_str()); if(dirhandle == 0) { - BOX_WARNING("Failed to open local directory '" << - localDirDisplay << "': " << strerror(errno)); + BOX_LOG_SYS_WARNING("Failed to open local directory '" << + localDirDisplay << "'"); rParams.mUncheckedFiles ++; return; } @@ -1518,8 +1516,8 @@ void BackupQueries::Compare(int64_t DirID, const std::string &rStoreDir, const s // Close directory if(::closedir(dirhandle) != 0) { - BOX_ERROR("Failed to close local directory '" << - localDirDisplay << "': " << strerror(errno)); + BOX_LOG_SYS_ERROR("Failed to close local directory " + "'" << localDirDisplay << "'"); } dirhandle = 0; diff --git a/bin/bbackupquery/bbackupquery.cpp b/bin/bbackupquery/bbackupquery.cpp index 4b97409f..342969c2 100644 --- a/bin/bbackupquery/bbackupquery.cpp +++ b/bin/bbackupquery/bbackupquery.cpp @@ -174,8 +174,8 @@ int main(int argc, const char *argv[]) logFile = ::fopen(optarg, "w"); if(logFile == 0) { - BOX_ERROR("Failed to open log file '" << - optarg << "': " << strerror(errno)); + BOX_LOG_SYS_ERROR("Failed to open log file " + "'" << optarg << "'"); } break; |