]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Display the period covered by the logs even if no records were found
authorFrederic Marchal <fmarchal@users.sourceforge.net>
Tue, 30 Sep 2014 18:15:19 +0000 (20:15 +0200)
committerFrederic Marchal <fmarchal@users.sourceforge.net>
Tue, 30 Sep 2014 18:15:19 +0000 (20:15 +0200)
Displaying the start and end dates found in the log helps in diagnosing
why the requested date was not found.

log.c

diff --git a/log.c b/log.c
index 4b36bd48bb3ad73c255912666db61a551a3fc522..186e0148ee080508b0d336dd920922b4f61e7f67 100644 (file)
--- a/log.c
+++ b/log.c
@@ -704,6 +704,17 @@ int main(int argc,char *argv[])
        free_excludecodes();
        free_exclude();
 
+       if (debug) {
+               char date0[30], date1[30];
+               struct tm Start,End;
+
+               GetLogPeriod(&Start,&End);
+               strftime(date0,sizeof(date0),"%x",&Start);
+               strftime(date1,sizeof(date1),"%x",&End);
+               // TRANSLATORS: The %s are the start and end dates in locale format.
+               debuga(_("Period covered by log files: %s-%s\n"),date0,date1);
+       }
+
        if (!LogStatus){
                debuga(_("No records found\n"));
                debuga(_("End\n"));
@@ -715,13 +726,7 @@ int main(int argc,char *argv[])
 
        if (debug) {
                char date0[30], date1[30];
-               struct tm Start,End;
 
-               GetLogPeriod(&Start,&End);
-               strftime(date0,sizeof(date0),"%x",&Start);
-               strftime(date1,sizeof(date1),"%x",&End);
-               // TRANSLATORS: The %s are the start and end dates in locale format.
-               debuga(_("Period covered by log files: %s-%s\n"),date0,date1);
                strftime(date0,sizeof(date0),"%x",&period.start);
                strftime(date1,sizeof(date1),"%x",&period.end);
                // TRANSLATORS: The %s are the start and end dates in locale format.