From 90a8af04bba813e8828aa9f7687c89c37a885567 Mon Sep 17 00:00:00 2001 From: Rico Date: Mon, 23 Aug 2021 00:48:14 +0200 Subject: [PATCH] refactor: implement better error logging in writeTar and writeZip --- archiver/archive.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/archiver/archive.go b/archiver/archive.go index 380d6bc..f98efa5 100644 --- a/archiver/archive.go +++ b/archiver/archive.go @@ -74,7 +74,7 @@ func writeTar(archiveFile *os.File, filesToBackup []BackupFileMetadata) { pathInArchive := getPathInArchive(filePath, fileMetadata.BackupBasePath) if err := addFileToTar(tw, filePath, pathInArchive); err != nil { - log.Println(err) + log.Printf("Error while adding %s to the archive. %s", filePath, err) } bar.Increment() @@ -98,7 +98,7 @@ func writeZip(archiveFile *os.File, filesToBackup []BackupFileMetadata) { pathInArchive := getPathInArchive(filePath, fileMetadata.BackupBasePath) if err := addFileToZip(zw, filePath, pathInArchive); err != nil { - log.Println(err) + log.Printf("Error while adding %s to the archive. %s", filePath, err) } bar.Increment()