diff options
author | Chris Wilson <chris+github@qwirx.com> | 2007-01-11 23:01:30 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2007-01-11 23:01:30 +0000 |
commit | ecd8635aecde4841daaa447cddcc395894859774 (patch) | |
tree | 2c61a5c0394e9be3a4eef734ae2128879a8c7b21 /bin | |
parent | 4201fdff12c3aea7d65b17ee2a0319c81fc41799 (diff) |
Added logging of directory scans and excluded files. (refs #3)
Diffstat (limited to 'bin')
-rw-r--r-- | bin/bbackupd/BackupClientDirectoryRecord.cpp | 21 | ||||
-rw-r--r-- | bin/bbackupd/BackupClientDirectoryRecord.h | 9 | ||||
-rw-r--r-- | bin/bbackupd/BackupDaemon.h | 24 |
3 files changed, 54 insertions, 0 deletions
diff --git a/bin/bbackupd/BackupClientDirectoryRecord.cpp b/bin/bbackupd/BackupClientDirectoryRecord.cpp index 6651598a..b9780fed 100644 --- a/bin/bbackupd/BackupClientDirectoryRecord.cpp +++ b/bin/bbackupd/BackupClientDirectoryRecord.cpp @@ -199,6 +199,9 @@ void BackupClientDirectoryRecord::SyncDirectory(BackupClientDirectoryRecord::Syn DIR *dirHandle = 0; try { + rParams.GetProgressNotifier().NotifyScanDirectory( + this, rLocalPath); + dirHandle = ::opendir(rLocalPath.c_str()); if(dirHandle == 0) { @@ -288,6 +291,11 @@ void BackupClientDirectoryRecord::SyncDirectory(BackupClientDirectoryRecord::Syn // Exclude it? if(rParams.mrContext.ExcludeFile(filename)) { + rParams.GetProgressNotifier() + .NotifyFileExcluded( + this, + filename); + // Next item! continue; } @@ -302,6 +310,11 @@ void BackupClientDirectoryRecord::SyncDirectory(BackupClientDirectoryRecord::Syn // Exclude it? if(rParams.mrContext.ExcludeDir(filename)) { + rParams.GetProgressNotifier() + .NotifyDirExcluded( + this, + filename); + // Next item! continue; } @@ -316,6 +329,9 @@ void BackupClientDirectoryRecord::SyncDirectory(BackupClientDirectoryRecord::Syn "%d (%s)", type, filename.c_str()); #endif + rParams.GetProgressNotifier() + .NotifyUnsupportedFileType( + this, filename); SetErrorWhenReadingFilesystemObject( rParams, filename.c_str()); continue; @@ -329,6 +345,11 @@ void BackupClientDirectoryRecord::SyncDirectory(BackupClientDirectoryRecord::Syn // but now we need the information. if(::lstat(filename.c_str(), &st) != 0) { + rParams.GetProgressNotifier() + .NotifyFileStatFailed(this, + filename, + strerror(errno)); + // Report the error (logs and // eventual email to administrator) SetErrorWhenReadingFilesystemObject( diff --git a/bin/bbackupd/BackupClientDirectoryRecord.h b/bin/bbackupd/BackupClientDirectoryRecord.h index 96afde1c..d7673920 100644 --- a/bin/bbackupd/BackupClientDirectoryRecord.h +++ b/bin/bbackupd/BackupClientDirectoryRecord.h @@ -52,6 +52,15 @@ class ProgressNotifier const BackupClientDirectoryRecord* pDirRecord, const std::string& rLocalPath, const std::string& rErrorMsg) = 0; + virtual void NotifyFileExcluded( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) = 0; + virtual void NotifyDirExcluded( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) = 0; + virtual void NotifyUnsupportedFileType( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) = 0; virtual void NotifyFileReadFailed( const BackupClientDirectoryRecord* pDirRecord, const std::string& rLocalPath, diff --git a/bin/bbackupd/BackupDaemon.h b/bin/bbackupd/BackupDaemon.h index 9d1eab6c..275603fc 100644 --- a/bin/bbackupd/BackupDaemon.h +++ b/bin/bbackupd/BackupDaemon.h @@ -224,6 +224,30 @@ public: BOX_WARNING("Failed to list directory: " << rLocalPath << ": " << rErrorMsg); } + virtual void NotifyFileExcluded( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) + { + if (mLogAllFileAccess) + { + BOX_INFO("Skipping excluded file: " << rLocalPath); + } + } + virtual void NotifyDirExcluded( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) + { + if (mLogAllFileAccess) + { + BOX_INFO("Skipping excluded directory: " << rLocalPath); + } + } + virtual void NotifyUnsupportedFileType( + const BackupClientDirectoryRecord* pDirRecord, + const std::string& rLocalPath) + { + BOX_WARNING("Ignoring file of unknown type: " << rLocalPath); + } virtual void NotifyFileReadFailed( const BackupClientDirectoryRecord* pDirRecord, const std::string& rLocalPath, |