From: Alan Kennedy Date: Tue, 26 Oct 2004 03:09:41 +0000 (+0000) Subject: Log homogeneo con afimonio y aficonf, plus fix en logeo de fecha X-Git-Tag: svn_import~14 X-Git-Url: https://git.llucax.com/z.facultad/75.08/llamadas.git/commitdiff_plain/85873e667e45ed214269cf0a05ee276ea624e7f0?hp=ec02bd554847b98105a85e0e737ca0182692168d Log homogeneo con afimonio y aficonf, plus fix en logeo de fecha --- diff --git a/inst/antifraude.pl b/inst/antifraude.pl index f41ee21..6583252 100644 --- a/inst/antifraude.pl +++ b/inst/antifraude.pl @@ -76,13 +76,17 @@ sub logEntry { my $log = "$CONFDATA{logdir}/$CONFDATA{logfile}"; # Fetch date and Format it ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); - $year += 1900; $year = sprintf("%02d", $year % 100); ++$mon; - $user = getlogin || "Unidentified"; - $commonstring = "[$mday/$mon/$year $hour:$min:$sec|$user|antifraude]"; + $mon =~ s/^(\d)$/0$1/; + $mday =~ s/^(\d)$/0$1/; + $hour =~ s/^(\d)$/0$1/; + $min =~ s/^(\d)$/0$1/; + $year += 1900; ++$mon; + $user = "$ENV{USER}"; + $commonstring = "$mday/$mon/$year-$hour:$min $user antifraude:"; # Append to log open(LOGFILE,">>$log") or die "No se pudo abrir el archivo de log"; seek(LOGFILE,0,2); - print LOGFILE "$commonstring - $logentry\n"; + print LOGFILE "$commonstring \"$logentry\"\n"; $filesize = tell(LOGFILE); close(LOGFILE); @@ -133,13 +137,19 @@ sub checkUmbrales { if ($matchedUmbral > 0) { # Obtengo algunos datos ($central = $callsfile) =~ s/^.*\.//; - $user = getlogin || 'Unidentified'; + $user = "$ENV{USER}"; # Fetch date and Format it ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $year += 1900; ++$mon; - $date = "$year$mon$mday"; - $time = "$hour$min$sec"; + $mon =~ s/^(\d)$/0$1/; + $mday =~ s/^(\d)$/0$1/; + $hour =~ s/^(\d)$/0$1/; + $min =~ s/^(\d)$/0$1/; + $sec =~ s/^(\d)$/0$1/; + $user = "$ENV{USER}"; + $date = "${year}${mon}${mday}"; + $time = "${hour}${min}${sec}"; # Preparo el registro de alarma $alarmEntry = "$callfields[7];$central;$callfields[0];$callfields[1];$regid;$callfields[2];$callfields[3];$user;$date;$time";