dar verbose output

"gulikoza" <[email protected]> Fri, 25 Dec 2015 10:25:23 +0100
Newsgroups gmane.comp.sysutils.backup.dar.general
Message-ID <[email protected]>
Hello,

Merry Xmas everyone! :-)

For some time now, I've been compiling my own dar build simply because of 1
change - verbose output.
For every entity (file, dir, symlink...) saved to dar archive, dar will
print "Saving file to archive:" when verbose output is set even when that is
actually not a file, but a directory or a symlink for example. I like to
parse the output to get a better understanding of what has actually been
stored (I guess the catalogue could be parsed later as well, but that is 1
additional step of reading the resulting archive after the operation is
done). With many files, the log will be large and some of the information
inside I don't care for - directories will mostly be stored when new files
are added; restoring symlinks changes link time so it will be saved again
when doing diff, even if the link itself hasn't changed. That's why I
modified the output to print different warnings based on entity type. This
way, the output can be filtered to include only entities I care for...

Denis, have you considered something like this before...or why does dar
include only a single type of message?
I'm attaching my patch for reference, but I guess you could do it better ;-)

diff --git a/src/libdar/filtre.cpp b/src/libdar/filtre.cpp
index 87648ee..74cedbe 100644
--- a/src/libdar/filtre.cpp
+++ b/src/libdar/filtre.cpp
@@ -2873,8 +2873,23 @@ namespace libdar
 		    else
 			if(delta_sig_ref != nullptr)
 			    dialog.warning(string(gettext("Delta saving file
to archive: ")) + info_quoi);
-			else
-			    dialog.warning(string(gettext("Saving file to
archive: ")) + info_quoi);
+			else {
+			    if (typeid(*ino) == typeid(cat_file)) {
+				dialog.warning(string(gettext("Saving file
to archive: ")) + info_quoi);
+			    } else if(typeid(*ino) == typeid(cat_lien)) {
+				dialog.warning(string(gettext("Saving
symlink to archive: ")) + info_quoi);
+			    } else if(typeid(*ino) == typeid(cat_directory))
{
+				dialog.warning(string(gettext("Saving folder
to archive: ")) + info_quoi);
+			    } else if(typeid(*ino) == typeid(cat_device)) {
+				dialog.warning(string(gettext("Saving device
to archive: ")) + info_quoi);
+			    } else if(typeid(*ino) == typeid(cat_tube)) {
+				dialog.warning(string(gettext("Saving pipe
to archive: ")) + info_quoi);
+			    } else if(typeid(*ino) == typeid(cat_prise)) {
+				dialog.warning(string(gettext("Saving socket
to archive: ")) + info_quoi);
+			    } else {
+				dialog.warning(string(gettext("Saving inode
to archive: ")) + info_quoi);
+			    }
+			}
 		}
 
 		if(fic != nullptr)

Regards,
gulikoza


------------------------------------------------------------------------------