Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I'd love to use constants instead of 0/1/2, but since I'm doing configuration during import, the constants wouldn't be available during the configuration. I could accept string values, something like:

use Log ( warn => 'BOTH', info => 'LOG', debug => 'QUIET' );

In this particular case, I don't think the 0/1/2 division is all that unintuitive. At its core, it's boolean: should I log warnings? yes=>1, no=>0. I admit the '2' is more of a stretch, but considering any mode set to 2 logs to 2 places (STDERR and logfile), I don't think it's very far-fetched. So, I'm undecided about that one.

Your other suggestions are all good, but they suggest, to me, that you'd want one of the already-existing log modules rather than this one.

For syslog-style logging, if you need or want that, you're better off with one of the existing log modules anyhow (like Sys::Syslog or the mother of them all, Log::Log4Perl), so I'm not sure it's worth the work to implement properly.

The globals suggestion is interesting, but I'm worried about a functionality trade. One of the original reasons for the decision I made was to easily allow configuration of logging for the entire application in one place. I can see the argument for letting modules log differently, but I can't grok how to do that while still allowing the choice of how it works today. That is, all modules simply use Log, and the calling program does the configuration.

Besides, when I need that level of control, I'm probably already in the realm of wanting all that Log::Log4Perl provides anyhow, so I'd move to that point. Unless I'm missing something? I'd be open to suggestions on how I could have it both ways, in which case it would go on my todo list.

<-radiant.matrix->
A collection of thoughts and links from the minds of geeks
The Code that can be seen is not the true Code
I haven't found a problem yet that can't be solved by a well-placed trebuchet

In reply to Re^2: RFC: A simple and badly-named logging module by radiantmatrix
in thread RFC: A simple and badly-named logging module by radiantmatrix

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others imbibing at the Monastery: (5)
    As of 2020-02-21 12:16 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      What numbers are you going to focus on primarily in 2020?










      Results (95 votes). Check out past polls.

      Notices?