MojoX::Log::DispatchLog::Dispatch For Mojo | |
Download |
MojoX::Log::Dispatch Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Konstantin Kapitanov
- Publisher web site:
- http://search.cpan.org/~kakadu/
MojoX::Log::Dispatch Tags
MojoX::Log::Dispatch Description
Log::Dispatch For Mojo MojoX::Log::Dispatch is a Perl wrapper around Log::Dispatch module. Log::Dispatch manages a set of Log::Dispatch::* objects, allowing you to add and remove output objects as desired.Include log statements at various levels throughout your code. Then when you create the new logging object, set the minimum log level you want to keep track off. Set it low, to 'debug' for development, then higher in production.SYNOPSIS use MojoX::Log::Dispatch; # Create a Log::Dispatch whith logging object that will log to STDERR by default # or to file if exists attribute path my $log = MojoX::Log::Dispatch->new(); $log->add(Log::Dispatch::File->new(name => 'file1', min_level => $self->level, filename => 'logfile' )); #Add some exotic loggers $log->add(Log::Dispatch::Twitter->new( username => "foo", password => "bar", min_level => "critical", name => "twitter", )); #and now as in Mojo::Log $log->debug("Why isn't this working?"); $log->info("FYI: it happened again"); $log->warn("This might be a problem"); $log->error("Garden variety error"); $log->fatal("Boom!"); $log->emergency("Boom! Boom!"); $log->alert("Hello!"); $log->critical("This might be a BIG problem"); $log->warning("This might be a problem");#=warn $log->notice("it happened again"); #OR: $log->log('debug' => 'This should work'); #In your Mojo App # create a custom logger object for Mojo/Mojolicious to use # (this is usually done inside the "startup" sub on Mojolicious). use MojoX::Log::Dispatch; use Log::Dispatch::Syslog; my $dispatch = MojoX::Log::Dispatch->new('path' => '/home/green/tmp/mySupEr.log', 'remove_default_log_obj' => 0); $dispatch->add(Log::Dispatch::Syslog->new( name => 'logsys', min_level => 'debug', ident => 'MyMojo::App', facility => 'local0' ) ); $self->log($dispatch); #and then $self->log->debug("Why isn't this working?"); Requirements: · Perl
MojoX::Log::Dispatch Related Software