[Dancer-users] Logging and "info"
Ovid
curtis_ovid_poe at yahoo.com
Tue Mar 27 16:37:58 CEST 2012
Pull request submitted:
https://github.com/sukria/Dancer/pull/765
The only open question is this bit in Dancer::Logger::Abstract:
my $levels = {
# levels < 0 are for core only
core => -10,
# levels > 0 are for end-users only
debug => 1,
warn => 2,
warning => 2,
error => 3,
info => 4,
};
I put info at level 4 under the premise that these messages should always be in the logs. I am using this branch at work and so far it works fine.
Full docs and tests included.
Also, in Dancer.pm, the list of FUNCTIONS (https://metacpan.org/module/Dancer#FUNCTIONS) is huge and could stand to have some organization. For example, the debug, warning, error and info log functions could stand to be grouped under a "Logging Functions" label. I did not bother to do this because if some are grouped, everything should be grouped and I don't yet know Dancer well enough to know all of of the logical groupings. Plus, I have a day job :)
Cheers,
Ovid
--
Live and work overseas - http://overseas-exile.blogspot.com/
Buy the book - http://www.oreilly.com/catalog/perlhks/
Tech blog - http://blogs.perl.org/users/ovid/
Twitter - http://twitter.com/OvidPerl/
>________________________________
> From: sawyer x <xsawyerx at gmail.com>
>To:
>Cc: Perl Dancer <dancer-users at perldancer.org>
>Sent: Tuesday, 27 March 2012, 14:39
>Subject: Re: [Dancer-users] Logging and "info"
>
>
>Agreed.
>
>
>On Tue, Mar 27, 2012 at 2:38 PM, damien krotkine <dkrotkine at gmail.com> wrote:
>
>Hi,
>>
>>I agree with that, info sounds good. We don't want to have too many levels, to be able to stay simple, but info seems to be missing indeed
>>
>>
>>
>>On 27 March 2012 13:05, Ovid <curtis_ovid_poe at yahoo.com> wrote:
>>
>>Hi all,
>>>
>>>
>>>I noticed that when I'm trying to log information, I have several log levels (core() apparently reserved for the core, as one might expect):
>>>
>>>
>>>* debug
>>>* warning
>>>* error
>>>
>>>I have a case where I would like to log informational data that is neither a warning or error. However, I don't want to log it as debug because I still want this logged in production.
>>>
>>>
>>>I propose adding an "info" log level that has a log level of 4 and thus should always be logged if logging is enabled. It would behave like other log levels:
>>>
>>>
>>> info "All bid requests were denied for auction $auction_id";
>>>
>>>
>>>Does this make sense or am I missing something obvious?
>>>
>>>
>>>Here are the log levels from Log::Log4perl (http://search.cpan.org/~mschilli/Log-Log4perl-1.36/lib/Log/Log4perl.pm#Log_Levels)
>>>
>>>
>>> $logger->trace("..."); # Log a trace message
>>> $logger->debug("..."); # Log a debug message
>>> $logger->info("..."); # Log a info message
>>> $logger->warn("..."); # Log a warn message
>>> $logger->error("..."); # Log a error message
>>> $logger->fatal("..."); # Log a fatal message
>>>
>>>
>>>Cheers,
>>>Ovid
>>>--
>>>Live and work overseas - http://overseas-exile.blogspot.com/
>>>Buy the book - http://www.oreilly.com/catalog/perlhks/
>>>Tech blog - http://blogs.perl.org/users/ovid/
>>>Twitter - http://twitter.com/OvidPerl/
>>>_______________________________________________
>>>Dancer-users mailing list
>>>Dancer-users at perldancer.org
>>>http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>>>
>>>
>>
>>_______________________________________________
>>Dancer-users mailing list
>>Dancer-users at perldancer.org
>>http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>>
>>
>
>_______________________________________________
>Dancer-users mailing list
>Dancer-users at perldancer.org
>http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>
>
>
More information about the Dancer-users
mailing list