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

NAME

App::CLI::Plugin::Log::Dispatch::Configurator::YAML - for App::CLI::Extension easy Log::Dispatch module

VERSION

1.1

SYNOPSIS

  # MyApp.pm
  package MyApp;
  
  use strict;
  use base qw(App::CLI::Extension);
  
  # extension method
  __PACKAGE__->load_plugins(qw(Log::Dispatch::Configurator::YAML));
  
  __PACKAGE__->config(log_dispatch_configurator_yaml => "/path/to/log.yml");
  
  1;
  
  # /path/to/log.yml
  dispatchers:
    - file
    - screen

  file:
    class: Log::Dispatch::File
    min_level: debug
    filename: /path/to/log
    mode: append
    newline: 1
    close_after_write: 1
    format: '[%d] [%p] %m'

  screen:
    class: Log::Dispatch::Screen
    min_level: debug
    stderr: 1
    newline: 1
    format: '%m'
  
  # MyApp/Hello.pm
  package MyApp::Hello;
  use strict;
  use feature ":5.10.0";
  use base qw(App::CLI::Command);
  
  sub run {
  
        my($self, @args) = @_;
        $self->log->info("hello");
        $self->log->error("fatal error");
        $self->log->debug("debug");
  }
  
  1;
  
  # execute
  cat /path/to/log
  [Tue Apr  6 00:58:05 2010] [info] hello
  [Tue Apr  6 00:58:05 2010] [error] fatal error
  [Tue Apr  6 00:58:05 2010] [debug] debug
  

DESCRIPTION

App::CLI::Plugin::Log::Dispatch::Configurator::YAML is App::CLI::Extension easy Log::Dispatch module

AUTHOR

Akira Horimoto <kurt0027@gmail.com>

SEE ALSO

App::CLI::Extension Log::Dispatch::Configurator::YAML

LICENSE

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

COPYRIGHT

Copyright (C) 2010 Akira Horimoto