App-Elog
view release on metacpan or search on metacpan
close $fh;
}
sub show_list {
for my $log (@logs) {
my $selected = $log->{selected} ? "*" : " ";
my $size = "-";
my $updated = "";
if (-e $log->{file}) {
$size = human_readable(-s $log->{file});
my $mtime = (stat($log->{file}))[9];
$updated = time_diff_str($mtime, $now);
}
my $file = $log->{file};
my $line = sprintf "%s %-60s %-10s %s", $selected, $file, $size, $updated;
print "$line\n";
}
}
sub show_detailed_list {
for my $log (@logs) {
my $size = "-";
my $updated = "";
if (-e $log->{file}) {
$size = human_readable(-s $log->{file});
my $mtime = (stat($log->{file}))[9];
$updated = datestr($mtime) . " (" . time_diff_str($mtime, $now) . ")";
}
my $vhost = $log->{vhost};
print "$log->{file}\n";
if ($log->{selected}) {
print " selected\n";
}
print " size $size\n";
if ($updated) {
}
if ($log->{fname}) {
print " fname $log->{fname}\n";
}
if ($log->{format}) {
print " format $log->{format}\n";
}
my $rotations = get_rotations($log->{file});
for my $r (@$rotations) {
my $size = human_readable(-s $r->{file});
my $mtime = (stat($r->{file}))[9];
my $updated = datestr($mtime) . " (" . time_diff_str($mtime, $now) . ")";
print " rotation $r->{name} $size $updated\n";
}
}
}
sub human_readable {
my ($size) = @_;
$size ||= 0;
my @power = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB");
}
}
sub show_list {
for my $log (@logs) {
my $selected = $log->{selected} ? "*" : " ";
my $size = "-";
my $updated = "";
if (-e $log->{file}) {
$size = human_readable(-s $log->{file});
my $mtime = (stat($log->{file}))[9];
$updated = time_diff_str($mtime, $now);
}
my $file = $log->{file};
my $line = sprintf "%s %-60s %-10s %s", $selected, $file, $size, $updated;
print "$line\n";
}
}
sub show_detailed_list {
for my $log (@logs) {
my $size = "-";
my $updated = "";
if (-e $log->{file}) {
$size = human_readable(-s $log->{file});
my $mtime = (stat($log->{file}))[9];
$updated = datestr($mtime) . " (" . time_diff_str($mtime, $now) . ")";
}
my $vhost = $log->{vhost};
print "$log->{file}\n";
if ($log->{selected}) {
print " selected\n";
}
print " size $size\n";
if ($updated) {
print " updated $updated\n";
if ($vhost->{docroot}) {
print " docroot $vhost->{docroot}\n";
}
if ($vhost->{absdocroot}) {
print " absdocroot $vhost->{absdocroot}\n";
}
}
my $rotations = get_rotations($log->{file});
for my $r (@$rotations) {
my $size = human_readable(-s $r->{file});
my $mtime = (stat($r->{file}))[9];
my $updated = datestr($mtime) . " (" . time_diff_str($mtime, $now) . ")";
print " rotation $r->{name} $size $updated\n";
}
}
}
sub human_readable {
my ($size) = @_;
my @power = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB");
my $i = 0;
( run in 0.594 second using v1.01-cache-2.11-cpan-49f99fa48dc )