ibanix has asked for the wisdom of the Perl Monks concerning the following question:
This works well enough for me, but there are probally better ways to do it. Now to the real question:# Uncomment to enable writing debuging info to logfile my $debug = 1; # Open a debug logfile if ($debug) { my $logfile = "movelog.debug.log"; open(DEBUG, ">>$logfile"); print DEBUG localtime().": Startup.\n"; } if ($debug) { print DEBUG locasltime." : This is some example line...\ +n"; }
Where setting level 'n' would trigger all level 'n' and lower, from n-1 to level 0, debug output.my $debug = 2; # This is level 2 information if (something) { print DEBUG "LEVEL 2: foo\n"; } # This is level 1 information if (something) { print DEBUG "LEVEL 1: moo\n": }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Making debug a little more intelligent
by adrianh (Chancellor) on Dec 10, 2002 at 23:58 UTC | |
|
Re: Making debug a little more intelligent
by elusion (Curate) on Dec 10, 2002 at 23:35 UTC | |
|
Re: Making debug a little more intelligent
by traveler (Parson) on Dec 10, 2002 at 22:57 UTC | |
|
Re: Making debug a little more intelligent
by Mr. Muskrat (Canon) on Dec 10, 2002 at 23:00 UTC | |
by ibanix (Hermit) on Dec 10, 2002 at 23:08 UTC | |
by Aristotle (Chancellor) on Dec 11, 2002 at 15:29 UTC | |
|
Re: Making debug a little more intelligent
by vek (Prior) on Dec 11, 2002 at 13:57 UTC |