-
Notifications
You must be signed in to change notification settings - Fork 130
Items RollFileHandle
ggodart edited this page Jan 6, 2021
·
1 revision
See original
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.
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.
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), |