FAQ
The following module was proposed for inclusion in the Module List:

modid: Log::Debug
DSLIP: Mdpfp
description: Implement multiple level of debug messages
userid: ERWAN (Erwan Lemonnier)
chapterid: 3 (Development_Support)
communities:

similar:
Log::Dispatch, Log::Log4perl

rationale:

Most logging modules follow the standard syslog hierarchy of
message types: INFO, WARNING, ERROR, DEBUG, etc. This is the case in
for example Log::Log4perl.

But what a developer often needs in larger projects is a special
logging function only for debug messages, that accept more than one
level of debug verbosity, and that can be triggered from a
configuration file in a fashion similar to Log4perl. There are no
such modules on CPAN, as far as I could see.

Hence the creation of Log::Debug.

Synopsis:

hack.pl: use Log::Debug;

sub hack { debug(2,"printing naph"); print "not another perl
hacker.\n"; }

debug(1,"starting code"); hack();

When running ./hack.pl with a debug verbosity of 0, you'll get no
debug message. > ./hack.pl not another perl hacker.

When running ./hack.pl with a debug verbosity of 1, you'll get: >
./hack.pl # [main::main() l.10] [DEBUG 1]: starting code not another
perl hacker.

When running ./hack.pl with a debug verbosity of 2 or more, you'll
get: > ./hack.pl # [main::main() l.10] [DEBUG 1]: starting code #
[main::hack() l.6] [DEBUG 2]: printing naph not another perl hacker.

That's the basic idea.

Add to that the possibility of defining debug verbosity systemwide,
or per file, per module or function, via a configuration file. Then
add Log::Dispatch to handle the destination and formatting of debug
messages. What you'll get is something pretty powerfull :)

enteredby: ERWAN (Erwan Lemonnier)
enteredon: Fri Sep 9 13:10:35 2005 GMT

The resulting entry would be:

Log::
::Debug Mdpfp Implement multiple level of debug messages ERWAN


Thanks for registering,

Search Discussions

  • Erwan Lemonnier at Sep 9, 2005 at 4:00 pm
    After discussing the module's name offline with Claes Jacobsson from
    Stockholm.pm <http://Stockholm.pm>, we concluded that the name Log::Debug is
    not acceptable.

    Hence, please reconsider the previous module submission but replace all
    occurences of Log::Debug with Log::Verbosity.

    Why calling this module Log::Verbosity?

    First, it has nothing to do with debugging. It can be used for debugging,
    but it's only one usage among many others.

    Second, what the module really does is to define a scale of logging
    *verbosity*, in which messages are logged if their own verbosity level is
    equal or less than the current logging verbosity in the file/module/function
    currently executing.

    Comments and critics are welcome!

    /Erwan



    On 9/9/05, Perl Authors Upload Server wrote:


    The following module was proposed for inclusion in the Module List:

    modid: Log::Debug
    DSLIP: Mdpfp
    description: Implement multiple level of debug messages
    userid: ERWAN (Erwan Lemonnier)
    chapterid: 3 (Development_Support)
    communities:

    similar:
    Log::Dispatch, Log::Log4perl

    rationale:

    Most logging modules follow the standard syslog hierarchy of
    message types: INFO, WARNING, ERROR, DEBUG, etc. This is the case in
    for example Log::Log4perl.

    But what a developer often needs in larger projects is a special
    logging function only for debug messages, that accept more than one
    level of debug verbosity, and that can be triggered from a
    configuration file in a fashion similar to Log4perl. There are no
    such modules on CPAN, as far as I could see.

    Hence the creation of Log::Debug.

    Synopsis:

    hack.pl: use Log::Debug;

    sub hack { debug(2,"printing naph"); print "not another perl
    hacker.\n"; }

    debug(1,"starting code"); hack();

    When running ./hack.pl with a debug verbosity of 0, you'll get no
    debug message. > ./hack.pl not another perl hacker.

    When running ./hack.pl with a debug verbosity of 1, you'll get: >
    ./hack.pl # [main::main() l.10] [DEBUG 1]: starting code not another
    perl hacker.

    When running ./hack.pl with a debug verbosity of 2 or more, you'll
    get: > ./hack.pl # [main::main() l.10] [DEBUG 1]: starting code #
    [main::hack() l.6] [DEBUG 2]: printing naph not another perl hacker.

    That's the basic idea.

    Add to that the possibility of defining debug verbosity systemwide,
    or per file, per module or function, via a configuration file. Then
    add Log::Dispatch to handle the destination and formatting of debug
    messages. What you'll get is something pretty powerfull :)

    enteredby: ERWAN (Erwan Lemonnier)
    enteredon: Fri Sep 9 13:10:35 2005 GMT

    The resulting entry would be:

    Log::
    ::Debug Mdpfp Implement multiple level of debug messages ERWAN


    Thanks for registering,
    --
    The PAUSE

    PS: The following links are only valid for module list maintainers:

    Registration form with editing capabilities:

    https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=40b00000_c45ff5928c90756b&SUBMIT_pause99_add_mod_preview=1
    Immediate (one click) registration:

    https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=40b00000_c45ff5928c90756b&SUBMIT_pause99_add_mod_insertit=1

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupmodules @
categoriesperl
postedSep 9, '05 at 1:11p
activeSep 9, '05 at 4:00p
posts2
users2
websitecpan.org...

People

Translate

site design / logo © 2019 Grokbase