From: Frederic Marchal Date: Tue, 30 Sep 2014 18:15:19 +0000 (+0200) Subject: Display the period covered by the logs even if no records were found X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c4a702b4a2dc5961e70233a19af56a2b32219089;p=thirdparty%2Fsarg.git Display the period covered by the logs even if no records were found Displaying the start and end dates found in the log helps in diagnosing why the requested date was not found. --- diff --git a/log.c b/log.c index 4b36bd4..186e014 100644 --- 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.