Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: Balancing Logging and Code Readability

by saberworks (Curate)
on Sep 15, 2009 at 15:36 UTC ( #795411=note: print w/ replies, xml ) Need Help??


in reply to Re: Balancing Logging and Code Readability
in thread Balancing Logging and Code Readability

Another common thing to accomplish something similar is to declare a vprint() or vwarn() function and have the check for DEBUG only occur there (instead of all over the place in your code). Then you just vprint("debug stuff") everywhere. Still doesn't get rid of the clutter but it ends up being a bit less than trailing if DEBUG everywhere.


Comment on Re^2: Balancing Logging and Code Readability
Re^3: Balancing Logging and Code Readability
by ack (Deacon) on Sep 17, 2009 at 02:39 UTC

    Very good suggestion and straegy. That strategy can be extended to several other challenges I've encountered with logging...and with debugging, too. In fact, whether one uses logging or (as I noted to Marshall) just straight prints for debugging, gathering the frequently repeated code(s) into subroutines always makes my code much more readable and much less "cluttered."

    Excellent observation and suggestion. Thanks, saberworks.

    ack Albuquerque, NM

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://795411]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2014-10-01 23:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (41 votes), past polls