Git Product home page Git Product logo

mojo-log-che's Introduction

Доброго в�ем

Mojo::Log::Che

¡ ¡ ¡ ALL GLORY TO GLORIA ! ! !

VERSION

0.8121 (up to Mojolicious version/10+child minor)

NAME

Mojo::Log::Che - Little child of great parent Mojo::Log.

SYNOPSIS

Parent Mojo::Log behavior just works

use Mojo::Log::Che;
my $log = Mojo::Log::Log->new(path => '/var/log/mojo.log', level => 'warn');
$log->debug(...);

EXTENDED THINGS

# 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

DESCRIPTION

This Mojo::Log::Che is a extended logger module for Mojo projects.

EVENTS

Mojo::Log::Che inherits all events from Mojo::Log and override following ones.

message

See also parent "message" in Mojo::Log. Extends parent module logics for switching handlers.

ATTRIBUTES

Mojo::Log::Che inherits all attributes from "Mojo::Log and implements the following new ones."

handlers

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();

path

See parent "path" in Mojo::Log. Can set to folder and file path.

paths

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

trace

An trace level, defaults to 4, 0 value will disable trace log. This value pass to caller().

METHODS

Mojo::Log::Che inherits all methods from Mojo::Log and implements the following new ones.

handler($level)

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.

AUTOLOAD

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.

SEE ALSO

Mojo::Log, Mojolicious, Mojolicious::Guides, http://mojolicious.org.

AUTHOR

Михаил Че (Mikhail Che), <mche[-at-]cpan.org>

BUGS / CONTRIBUTING

Please report any bugs or feature requests at https://github.com/mche/Mojo-Log-Che/issues. Pull requests also welcome.

COPYRIGHT

Copyright 2017 Mikhail Che.

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

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 214:

Unterminated L<...> sequence

mojo-log-che's People

Contributors

mche avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.