The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

MouseX::Log::Dispatch::Config

SYNOPSIS

    package MyLogger;
    use MouseX::Log::Dispatch::Config;

    # file-based (AppConfig style)
    has '+config' => (default => '/path/to/log.cfg');

    package HashLogger;
    use MouseX::Log::Dispatch::Config;

    # hash-based
    has '+config' => (default => sub {
        {
            class     => 'Log::Dispatch::Screen',
            min_level => 'debug',
            stderr    => 1,
            format    => '[%p] %m at %F line %L%n',
        }
    });

    package CustomLogger;
    use MouseX::Log::Dispatch::Config;
    use Log::Dispatch::Configurator::YAML;

    # custom configurator
    has '+config' => (default => sub {
        Log::Dispatch::Configurator::YAML->new('/path/to/log.yml');
    });

    package main;

    my $log = MyLogger->new;

    $log->debug('foo');
    $log->logger->debug('bar'); # also works

    $log->info('baz');
    $log->error('error');

DESCRIPTION

This is a role which provides a Log::Dispatch::Config logger.

METHODS

log

debug

info

notice

warning

error

critical

alert

emergency

PROPERTIES

logger

Returns a Log::Dispatch::Config object.

config

AUTHOR

NAKAGAWA Masaki <masaki@cpan.org>

THANKS TO

Ash Berlin, and "AUTHOR" in MooseX::LogDispatch

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Mouse, Mouse::Role, MouseX::Types::Log::Dispatch::Configurator,

Log::Dispatch::Config, Log::Dispatch::Configurator, Log::Dispatch,

MooseX::LogDispatch