Доброго всем
¡ ¡ ¡ ALL GLORY TO GLORIA ! ! !
0.04
Mojo::Log::Che - Little child of great parent Mojo::Log.
use Mojo::Log::Che; # Parent Mojo::Log behavior just works my $log = Mojo::Log::Log->new(path => '/var/log/mojo.log', level => 'warn'); $log->debug(...);
# Set "path" to folder + have default "paths" for levels (be sure that mkdir /var/log/mojo) my $log = Mojo::Log::Log->new(path => '/var/log/mojo'); $log->warn(...);# log to /var/log/mojo/warn.log $log->error(...); # log to /var/log/mojo/error.log $log->foo(...);# log to /var/log/mojo/foo.log # set "path" to folder + set custom relative "paths" (be sure that mkdir /var/log/mojo) my $log = Mojo::Log::Log->new(path => '/var/log/mojo', paths=>{debug=>'dbg.log', foo=>'myfoo.log'}); $log->debug(...); # log to /var/log/mojo/dbg.log $log->warn(...);# log to /var/log/mojo/warn.log $log->foo(...);# log to /var/log/mojo/myfoo.log # set "path" to file + have default "paths" for levels # this is standard Mojo::Log behavior + custom level/method also my $log = Mojo::Log::Log->new(path => '/var/log/mojo.log'); $log->debug(...); # log to /var/log/mojo.log $log->warn(...);# log to /var/log/mojo.log $log->foo(...);# log to /var/log/mojo.log # set "path" to file + set custom absolute "paths" my $log = Mojo::Log::Log->new(path => '/var/log/mojo.log', paths => {error=>'/var/log/mojo.error.log'}); $log->debug(...); # log to /var/log/mojo.log $log->foo(...);# log to /var/log/mojo.log $log->error(...); # log to /var/log/mojo.error.log # Log to STDERR + set custom absolute "paths" $log->path(undef); # none path $log->level('info'); $log->paths->{'error'} = '/var/log/error.log'; # absolute file only for error level $log->error(...); # log to /var/log/error.log $log->info(...); # log to STDERR $log->debug(...); # no log $log->foo(...); # anyway log to STDERR
This Mojo::Log::Che is a extended logger module for Mojo projects.
Mojo::Log::Che inherits all events from Mojo::Log and override following ones.
See also parent "message" in Mojo::Log. Extends parent module logics for switching handlers.
Mojo::Log::Che inherits all attributes from "Mojo::Log and implements the following new ones."
Hashref of created file handlers for standard and custom levels. For standard parent Mojo::Log logic none handlers but "handle" in Mojo::Log will be in the scene.
$log->handlers->{'foo'} = IO::Handle->new();
See parent "path" in Mojo::Log. Can set to folder and file path.
Hashref map level names to absolute or relative to "path"
$log->path('/var/log'); # folder relative $log->paths->{'error'} = 'err.log'; $log->error(...);# /var/log/err.log $log->info(...); # log to filename as level name /var/log/info.log $log->path(undef); # none $log->paths->{'error'} = '/var/log/error.log'; # absolute path only error level $log->error(...); # log to /var/log/error.log $log->info(...); # log to STDERR
Mojo::Log::Che inherits all methods from Mojo::Log and implements the following new ones.
Return undef when "path" undefined or "path" is file or has not defined "paths" for $level. In this case "handle" in Mojo::Log will return default handler.
Return file handler overwise.
Autoloads nonstandard/custom levels excepts already defined keywords of this and parent modules Mojo::Log, Mojo::EventEmitter, Mojo::Base:
qw(message _message format _format handle handler handlers history level max_history_size path paths append debug error fatal info is_level new warn catch emit has_subscribers on once subscribers unsubscribe has attr tap _monkey_patch import)
and maybe anymore!
$log->foo('bar here');
That custom levels log always without reducing log output outside of level.
Mojo::Log, Mojolicious, Mojolicious::Guides, http://mojolicious.org.
Михаил Че (Mikhail Che), <mche[-at-]cpan.org>
<mche[-at-]cpan.org>
Please report any bugs or feature requests at https://github.com/mche/Mojo-Log-Che/issues. Pull requests also welcome.
Copyright 2017 Mikhail Che.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
Unterminated L<...> sequence
To install Mojo::Log::Che, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojo::Log::Che
CPAN shell
perl -MCPAN -e shell install Mojo::Log::Che
For more information on module installation, please visit the detailed CPAN module installation guide.