SET(sarg_VERSION 2)
SET(sarg_REVISION "3.2-pre2")
SET(sarg_BUILD "")
-SET(sarg_BUILDDATE "Sep-14-2011")
+SET(sarg_BUILDDATE "Oct-30-2011")
INCLUDE(AddFileDependencies)
INCLUDE(CheckIncludeFile)
if(authfail_count == 0) {
unlink(tmp4);
+ if (debugz) debugaz(_("Authentication failures report not produced because it is empty\n"));
return;
}
debuga(_("Maybe you have a broken record or garbage in your %s file\n"),DansGuardianConf);
exit(EXIT_FAILURE);
}
+ if (debug) debuga(_("Using the dansguardian log file \"%s\" found in your configuration file \"%s\"\n"),
+ loglocation,DansGuardianConf);
break;
}
}
snprintf(dansguardian_in,sizeof(dansguardian_in),"%s/dansguardian.log",tmp);
if(!dansguardian_count) {
unlink(dansguardian_in);
+ if (debugz) debugaz(_("Dansguardian report not generated because it is empty\n"));
return;
}
sprintf(denied_in,"%s/denied.log",tmp);
if (!denied_count) {
unlink(denied_in);
+ if (debugz) debugaz(_("Denied report not produced because it is empty\n"));
return;
}
-/*! \fn void debuga(const char *msg,...)
-Write a debug message to stderr. The message is prefixed by "SARG:" to identify its origin.
-
-\param msg The printf like message to format.
-\param ... The arguments to format in the message.
-
-*/
-
-
-
-
-
-/*! \fn void debugaz(const char *head, const char *msg)
-Write a debug message to stderr with the value of a parameter. The message is prefixed by "SARG: (util)".
-
-\param head The name of the parameter.
-\param msg The value of the parameter.
-*/
-
-
-
-
-
/*! \fn char *fixnum(long long int value, int n)
Rewrite a number to make it more readable. The number may be written
with the suffix K, M, G or T depending on its magnitude or the digits
ouser2[0]='\0';
snprintf(report_in,sizeof(report_in),"%s/download.log",tmp);
- if(access(report_in, R_OK) != 0)
+ if(access(report_in, R_OK) != 0) {
+ if (debugz) debugaz(_("Downloaded files report not generated as it is empty\n"));
return;
+ }
snprintf(report,sizeof(report),"%s/download.html",outdirname);
const struct userinfostruct *uinfo;
userscan uscan;
- if((ReportType & REPORT_TYPE_USERS_SITES) == 0) return;
-
if (snprintf(tmp2,sizeof(tmp2),"%s/sargtmp.unsort",tmp)>=sizeof(tmp2)) {
debuga(_("File name too long: %s/sargtmp.unsort\n"),tmp);
exit(EXIT_FAILURE);
void output_html_url(FILE *fp_ou,const char *url);
void output_html_link(FILE *fp_ou,const char *url,int maxlen);
void debuga(const char *msg,...) __attribute__((format(printf,1,2)));
-void debugaz(const char *head, const char *msg);
+void debugaz(const char *msg,...) __attribute__((format(printf,1,2)));
void my_lltoa(unsigned long long int n, char *s, int ssize, int len);
char *get_size(const char *path, const char *file);
void url_module(const char *url, char *w2);
-#define VERSION PACKAGE_VERSION" Sep-14-2011"
+#define VERSION PACKAGE_VERSION" Oct-30-2011"
#define PGM PACKAGE_NAME
#define URL "http://sarg.sourceforge.net"
}
if(debugz){
- debugaz("data",dia);
- debugaz("period",period.text);
+ debugaz(_("date=%s\n"),dia);
+ debugaz(_("period=%s\n"),period.text);
}
if(debug)
str2 = user;
- if(SquidGuardConf[0] == '\0' && NRedirectorLogs == 0)
+ if(SquidGuardConf[0] == '\0' && NRedirectorLogs == 0) {
+ if (debugz) debugaz(_("No redirector logs provided to produce that kind of report\n"));
return;
+ }
sprintf(guard_in,"%s/redirector.unsort",tmp);
sprintf(guard_ou,"%s/redirector.log",tmp);
sprintf(squidguard_in,"%s/redirector.log",tmp);
if(!redirector_count) {
unlink(squidguard_in);
+ if (debugz) debugaz(_("Redirector report not generated because it is empty\n"));
return;
}
}
if(debugz){
- debugaz("outdirname",outdirname);
+ debugaz(_("outdirname=%s\n"),outdirname);
}
if(UserAgentLog[0] != '\0' && email[0] == '\0') useragent();
fclose(fp_gen);
if (puinfo && !indexonly) day_totalize(tmp,puinfo);
- if (!indexonly) tmpsort();
+ if (!indexonly)
+ tmpsort();
+ else if (debugz)
+ debugaz(_("Only the index is generated as requested\n"));
if(email[0] == '\0') {
if (!indexonly) {
- if((ReportType & REPORT_TYPE_DOWNLOADS) != 0) download_report();
+ if((ReportType & REPORT_TYPE_DOWNLOADS) != 0)
+ download_report();
+ else if (debugz)
+ debugaz(_("Downloaded files report not requested in report_type\n"));
- if(DansGuardianConf[0] != '\0') {
+ if(DansGuardianConf[0] != '\0')
dansguardian_log();
- }
+ else if (debugz)
+ debugaz(_("Dansguardian report not produced because no dansguardian configuration file was provided\n"));
redirector_log();
}
topuser();
if (!indexonly) {
- if((ReportType & REPORT_TYPE_TOPSITES) != 0) topsites();
-
- if((ReportType & REPORT_TYPE_SITES_USERS) != 0) siteuser();
+ if((ReportType & REPORT_TYPE_TOPSITES) != 0)
+ topsites();
+ else if (debugz)
+ debugaz(_("Top sites report not requested in report_type\n"));
+
+ if((ReportType & REPORT_TYPE_SITES_USERS) != 0)
+ siteuser();
+ else if (debugz)
+ debugaz(_("Sites & users report not requested in report_type\n"));
if ((ReportType & REPORT_TYPE_DENIED) != 0)
gen_denied_report();
+ else if (debugz)
+ debugaz(_("Denied accesses report not requested in report_type\n"));
if ((ReportType & REPORT_TYPE_AUTH_FAILURES) != 0)
authfail_report();
+ else if (debugz)
+ debugaz(_("Authentication failures report not requested in report_type\n"));
if(smartfilter) smartfilter_report();
- if(DansGuardianConf[0] != '\0') dansguardian_report();
+ if(DansGuardianConf[0] != '\0')
+ dansguardian_report();
redirector_report();
- if((ReportType & REPORT_TYPE_USERS_SITES) != 0) htmlrel();
+ if((ReportType & REPORT_TYPE_USERS_SITES) != 0)
+ htmlrel();
+ else if (debugz)
+ debugaz(_("User's detailed report not requested in report_type\n"));
}
make_index();
struct generalitemstruct item;
const struct userinfostruct *uinfo;
- if(Privacy)
+ if(Privacy) {
+ if (debugz) debugaz(_("Sites and users report not generated because privacy option is on\n"));
return;
+ }
nsitesusers = 0;
sprintf(general,"%s/sarg-general",outdirname);
longline line;
struct generalitemstruct item;
- if(Privacy)
+ if(Privacy) {
+ if (debugz) debugaz(_("Top sites report not produced because privacy option is on\n"));
return;
+ }
sprintf(general,"%s/sarg-general",outdirname);
sprintf(sites,"%s/sarg-sites",outdirname);
if ((ReportType & REPORT_TYPE_TOPUSERS) == 0) {
fputs("</body>\n</html>\n",fp_top3);
fclose (fp_top3);
+ if (debugz) debugaz(_("No top users report because it is not configured in report_type\n"));
return;
}
}
+/*!
+Write a debug message to stderr. The message is prefixed by "SARG:" to identify its origin.
+
+\param msg The printf like message to format.
+\param ... The arguments to format in the message.
+*/
void debuga(const char *msg,...)
{
va_list ap;
}
-void debugaz(const char *head, const char *msg)
+/*!
+Write a debug message to stderr. The message is prefixed by "SARG: (info)".
+
+\param msg The printf like message to format.
+\param ... The arguments to format in the message.
+*/
+void debugaz(const char *msg,...)
{
- fprintf(stderr, "SARG: (util) %s=%s\n",head, msg);
+ va_list ap;
+
+ fputs(_("SARG: (info) "),stderr);
+ va_start(ap,msg);
+ vfprintf(stderr,msg,ap);
+ va_end(ap);
}