ruby -dn; levels for $DEBUG

G

Gavin Kistner

I would find it convenient if:
ruby -d foo.rb
set $DEBUG to true, while
ruby -d1 foo.rb
set $DEBUG to 1
ruby -d3 foo.rb
set $DEBUG to 3, and possibly even
ruby -dALL foo.rb
set $DEBUG to "ALL". (I'm willing to give up that last, though.)

This would break any existing code that did something silly like:
if $DEBUG == true
instead of
if $DEBUG
but would provide the ability to set verbosity level for debugging.

In debugging JavaScript in HTML, I wrote my own DebugOut function
which took a string and a verbosity level, and by changing one
numeric at the top of the file could easily see more or less verbose
traces of the code execution. It's a poor substitute for a debugging
IDE, but at the same time quite helpful.

What do people think?
 
A

Ara.T.Howard

I would find it convenient if:
ruby -d foo.rb
set $DEBUG to true, while
ruby -d1 foo.rb
set $DEBUG to 1
ruby -d3 foo.rb
set $DEBUG to 3, and possibly even
ruby -dALL foo.rb
set $DEBUG to "ALL". (I'm willing to give up that last, though.)

This would break any existing code that did something silly like:
if $DEBUG == true
instead of
if $DEBUG
but would provide the ability to set verbosity level for debugging.

In debugging JavaScript in HTML, I wrote my own DebugOut function which took
a string and a verbosity level, and by changing one numeric at the top of the
file could easily see more or less verbose traces of the code execution. It's
a poor substitute for a debugging IDE, but at the same time quite helpful.

What do people think?

i just do this

~ > DEBUG=2 ruby a.rb

and in a.rb

$DEBUG = Integer(ENV['DEBUG']) rescue true

hth.

-a
--
===============================================================================
| email :: ara [dot] t [dot] howard [at] noaa [dot] gov
| phone :: 303.497.6469
| My religion is very simple. My religion is kindness.
| --Tenzin Gyatso
===============================================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,141
Messages
2,570,817
Members
47,365
Latest member
BurtonMeec

Latest Threads

Top