The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

XLog::File - XLog backend for logging to file

DESCRIPTION

XLog::File is a simple file logging backend. It is written in C++ and is fast.

It periodically checks for file existance by path and recteates it (and all folders) if it's gone.

Also supports autoflush.

METHODS

new(\%params)

Parameters are:

file (required)

Path to log file. If it doesn't exist it will be created including all folders (like mkpath).

If file could not be opened or written, an error message will be written on stderr and logger will be a stub (will do nothing when you log via XLog) until file can be written again.

check_freq [=1000]

Frequency in milliseconds of checking log file. If file is deleted or moved, creates file again, including all folders (if they are gone).

If file can not be created or written, an error message will be written on stderr and logger will be a stub (will do nothing when you log via XLog) until file can be written again.

buffered [=false]

If true will use buffered write. This is more efficient, but does not guarantees that all logs are written in case of application crash (like segfault). Unbuffered is less efficient but stable. Also buffered IO leads to trunkated lines in case of parrallel writes from different processes or threads.

AUTHOR

Pronin Oleg <syber@crazypanda.ru>

Crazy Panda LTD

LICENSE

You may distribute this code under the same terms as Perl itself.