From 2429b5aa4b5eefc70738f41db4c1ee5b686fcdbe Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Tue, 11 Apr 2006 14:01:23 +0000 Subject: [PATCH] Kosmetik am Dateiformat --- LogRotate/StateFile.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/LogRotate/StateFile.pm b/LogRotate/StateFile.pm index a06d747..d501e2b 100644 --- a/LogRotate/StateFile.pm +++ b/LogRotate/StateFile.pm @@ -359,7 +359,7 @@ sub write_logfile($$;$) { } my ( @Date ); - my ( $f, $d ); + my ( $f, $d, $max ); my $file = $self->{'file'}; my $files = $self->read(); @@ -367,6 +367,12 @@ sub write_logfile($$;$) { $files->{$logfile} = $timestamp; + $max = 1; + foreach $f ( keys %$files ) { + $max = length($f) if length($f) > $max; + } + $max += 2; + print $p . "Schreibe Statusdatei '$file' ...\n" if verbose(); unless ( $self->test() ) { @@ -382,7 +388,7 @@ sub write_logfile($$;$) { } else { $d = strftime( '%Y-%m-%d_%H:%M:%S', @Date ); } - print FILE '"' . $f . '" ' . $d . "\n"; + printf FILE "%-*s %s\n", $max, ('"' . $f . '"' ), $d; } close FILE; } -- 2.39.5