Items RollFileHandle - hollie/misterhouse GitHub Wiki
RollFileHandle
See original
SYNOPSIS
use RollFileHandle;
my $dl=new RollFileHandle(">> /tmp/$0.stdout.%m%d");
$dl->trap_stdxxx(); # install as default for stdout
while($event_loop){
$dl->roll_logfile(); # re-open log file when date rolls.
print("1","2","3\n"); # use vanilla print syntax.
DESCRIPTION
This package is intended to give the caller the ability to create a "rolling" log file of its output, so that a single output log doesn't grow unrestricted.
If the process is dropped and restarted, the log file will be appended onto instead of truncated.
INHERITS
INI PARAMETERS
METHODS
Method | Description |
---|---|
roll_logfile |
Open the correct logfile for the current time. if there is no work to do, exit without making any changes. |
midnite_time |
Calculate the time for midnight tonight, when we'll need to roll the log (again), |