logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Log::Dispatch::FileWriteRotate - Log to files that archive/rotate themselves, w/ File::Write::Rotate

Author

       perlancar <perlancar@cpan.org>

Bugs

       Please report any bugs or feature requests on the bugtracker website
       <https://rt.cpan.org/Public/Dist/Display.html?Name=Log-Dispatch-FileWriteRotate>

       When submitting a bug or request, please include a test-file or a patch to an existing test-file that
       illustrates the bug or desired feature.

Contributor

       Steven Haryanto <sharyanto@cpan.org>

Description

       This module functions similarly to Log::Dispatch::FileRotate, but uses File::Write::Rotate as backend,
       thus interoperates more easily with other modules which use File::Write::Rotate as backend, e.g.
       Tie::Handle::FileWriteRotate or Process::Govern.

Homepage

       Please visit the project's homepage at <https://metacpan.org/release/Log-Dispatch-FileWriteRotate>.

Methods

new(%args)
       Constructor. This method takes a hash of parameters. The following options are valid: "min_level" and
       "max_level" (see Log::Dispatch documentation); "dir", "prefix", "suffix", "period", "size", and
       "histories" (see File::Write::Rotate).

   log_message(message=>STR)
       Send a message to the appropriate output. Generally this shouldn't be called directly but should be
       called through the "log()" method (in LLog::Dispatch::Output>).

   fwr
       Expose File::Write::Rotate object. You can do access this object e.g. to compress logfiles:

        $file->fwd->compress;

Name

       Log::Dispatch::FileWriteRotate - Log to files that archive/rotate themselves, w/ File::Write::Rotate

See Also

       Log::Dispatch

       File::Write::Rotate

       Log::Dispatch::FileRotate

Source

       Source repository is at <https://github.com/perlancar/perl-Log-Dispatch-FileWriteRotate>.

Synopsis

        use Log::Dispatch::FileWriteRotate;

        my $file = Log::Dispatch::FileWriteRotate(
            min_level => 'info',

            # will be passed to File::Write::Rotate
            dir       => '/var/log',
            prefix    => 'myapp',
            suffix    => '.log',
            period    => 'monthly',
            size      => 25*1024*1024,
            histories => 12,
        );

        $file->log(level => 'info', message => "Your comment\n");

Version

       This document describes version 0.062 of Log::Dispatch::FileWriteRotate (from Perl distribution Log-
       Dispatch-FileWriteRotate), released on 2021-07-21.

See Also