Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
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


Comment on Re: RFC: A simple and badly-named logging module
Select or Download Code
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?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2014-09-18 06:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (108 votes), past polls