diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-10-11 06:29:16 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-10-11 06:29:16 +0000 |
commit | 370612370973110963075ab6a8a08a7558b9761c (patch) | |
tree | 5b16a6e87ee2915c89357e9f15b3d0b1a21b8d93 /lib/tracer.rb | |
parent | 79e755892ab74bb81842c0a62d8efd9d02bbd870 (diff) | |
download | ruby-370612370973110963075ab6a8a08a7558b9761c.tar.gz ruby-370612370973110963075ab6a8a08a7558b9761c.tar.xz ruby-370612370973110963075ab6a8a08a7558b9761c.zip |
matz
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/tracer.rb')
-rw-r--r-- | lib/tracer.rb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/tracer.rb b/lib/tracer.rb index 78bada9a6..859a6d524 100644 --- a/lib/tracer.rb +++ b/lib/tracer.rb @@ -16,9 +16,11 @@ class Tracer @RCS_ID='-$Id: tracer.rb,v 1.8 1998/05/19 03:42:49 keiju Exp keiju $-' + @stdout = STDOUT class << self attr :verbose, true alias verbose? verbose + attr :stdout, true end verbose = true @@ -44,6 +46,10 @@ class Tracer @filters = [] end + def stdout + Tracer.stdout + end + def on if block_given? on @@ -56,13 +62,13 @@ class Tracer set_trace_func proc{|event, file, line, id, binding, klass| trace_func event, file, line, id, binding } - print "Trace on\n" if Tracer.verbose? + stdout.print "Trace on\n" if Tracer.verbose? end end def off set_trace_func nil - print "Trace off\n" if Tracer.verbose? + stdout.print "Trace off\n" if Tracer.verbose? end def add_filter(p = proc) @@ -79,7 +85,7 @@ class Tracer end unless list = LINES__[file] -# print file if $DEBUG +# stdout.print file if $DEBUG begin f = open(file) begin @@ -108,14 +114,14 @@ class Tracer def trace_func(event, file, line, id, binding) return if file == MY_FILE_NAME - #printf "Th: %s\n", Thread.current.inspect + #stdout.printf "Th: %s\n", Thread.current.inspect for p in @filters return unless p.call event, file, line, id, binding end Thread.critical = true - printf("#%d:%s:%d:%s: %s", + stdout.printf("#%d:%s:%d:%s: %s", get_thread_no, file, line, |