NAME

DebugLogger::File - logging debug information to a file


SYNOPSIS

 use DebugLogger::File;
 my $logger = DebugLogger::File->new;
 ...
 $logger
        ->set_safe_append(1)  # reopen the file on every write
        ->use_html(1)        # default is 0
        ->show_header(1)     # default is 0
        ->show_ident(1)      # default is 0
        ->show_time(1)
        ->show_times(1)
        ->times_format("%5.2f, %5.2f, %5.2f, %5.2f")
        ->monitor(":all")
        ->start
 ;
 ...
 $logger->stop;
 ...


DESCRIPTION

This module is used to actually log the provided debug information to the specified file. See documentation of the inherited module the DebugLogger manpage.

By default the file name is unique, containing date/time string in its name and in the $Podius::PROJECT_HOME/log directory (if it is not defined - in the current directory).

There is an option to safely append to a file. In this case, instead of opening the file once on start and closing it on stop, the file will be opened on every write. This ensures that the debug information is not lost on dies in the operational systems, which requires closing the file.


SEE ALSO

the Debug manpage, the DebugLogger manpage, the DebugLogger::Stdout manpage, the DebugLogger::PackageGroups manpage.


REQUIREMENTS

the Exception manpage, the Date::TimeFormat manpage, the File::Operations manpage, the IO::File manpage.


OPTION MODIFIERS

[option]($value)

 use_html    - default: 0
 show_header - default: 0
 show_ident  - default: 0

Other options and their defaults are the same as in the DebugLogger manpage.

Example: $logger->show_time(1)->use_html(1);


MODIFIERS (in addition to SUPER)

set_dirname

Sets the log file directory, while leaving the base file name untouched. The default directory is ``$Podius::PROJECT_HOME/log'' (if $Podius::PROJECT_HOME defined) or current working directory.

set_filename

Sets the log file name, if it does not contain directory part, the default directory or the one set by set_dirname will be used. The default file name is ``debug-%Y_%m_%d-%H_%M_%S.txt''.

set_save_append

Sets the save-append flag. If enabled on every write the log file is opened, additional content is appended and the file then closed again. This is needed for some systems, where not closed files are lost, and on program termination files are not always closed.

By default this feature is disable, since it takes an additional time to open and close the log file again and again.