Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: RFC: A simple and badly-named logging module

by YuckFoo (Abbot)
on Feb 17, 2006 at 21:56 UTC ( #531085=note: print w/replies, xml ) Need Help??


in reply to RFC: A simple and badly-named logging module

radiantmatrix,

I like it, but here is a wish list:

* Default log file permissions 666. Setting umask in the main program doesn't seem to affect the log file permissions, not sure why.

* strftime string configurable. ISO 8601 be damned, the 'T' between date and time is annoying.

* PID logged instead of sequence number. This would allow me to unravel multiple simultaneous runs of the program. The sequence numbers can be derived later by the log parser.

* Record $0 and @ARGV in the 'Logging started' message.

* Line header shorter. Golf it a bit to leave more space for the good stuff. The colons do nothing for me and a single character T, D, I, W, X is as good as TRCE, DBUG, INFO, WARN, XCPT. How about:

20060217 155643 12345 I Logging started ./tryl -this -that other 20060217 155643 12345 W hello at ./tryl line 8. 20060217 155643 12345 I this is an information statement 20060217 155643 12345 X Game over, man: game over! at ./tryl line 12.
instead of:
2006-02-17T15:56:43 0: INFO: Logging started 2006-02-17T15:56:43 1: WARN: hello at ./tryl line 8. 2006-02-17T15:56:43 2: INFO: this is an information statement 2006-02-17T15:56:43 3: XCPT: Game over, man: game over! at ./tryl + line 12.

LogFoo

Replies are listed 'Best First'.
Re^2: RFC: A simple and badly-named logging module
by radiantmatrix (Parson) on Feb 22, 2006 at 17:43 UTC

    I've put most of these on my todo list, excellent suggestions! Some points...

    1. I agree that the TDIWX set is better than the longer versions, though I think I might make that configurable.
    2. Using $0 and @ARGV are good ideas, but if this is used in a module, not a script, that isn't useful. And, since it's very easy for a script author to simply info 'Started '.$0.join(' '.@ARGV);, I have a hard time justifying that as default module behavior. I'd be interested in opposing arguments if I'm missing something.
    3. PID logging is a good idea, but I will be keeping the sequence numbers as an option (appended to the PID).
    4. I see your points about the ISO8601 format. Enough, in fact, to make the strftime format param configurable. However, I'm leaving 8601 as the default because its a standard, and I think standards make the most reasonable default. Hopefully, with the configurable format, everyone wins.

    Thanks so much for the feedback! Extremely useful.

    <-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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://531085]
help
Chatterbox?
erix eat the rich!
[1nickt]: I do think it is sad that roho has received 3 downvotes for his polite request, as did I when I objected to the profanity in stonecolddevin's sig. I upvoted both him and Karl for the discussion. Way too much downvoting for inappropriate reasons here!
Discipulus learn that 'argue' has a little negative sense, he thought was a neutral sense, 'vox media'
[1nickt]: argue == discuss && argue == be contentious
[Discipulus]: you are right 1nickt i didnt voted nor downvoted; I just upvote perl content i like
[1nickt]: In Spanish, to argue (like a fight) is discutir -- does not mean to discuss !
[1nickt]: Sigh, this is why I gave up human-only languages and became a Perl linguist :-)
[Discipulus]: i just, rarely, downvote unpolite posts and spam, and wrong advices
[Discipulus]: discutere in eatalian is neutral: but discutere with wife sounds implicitly negative..
[erix]: what's the offending signature?

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2017-06-22 12:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (519 votes). Check out past polls.