summaryrefslogtreecommitdiff
path: root/lib/tracer.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-10-11 06:29:16 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-10-11 06:29:16 +0000
commit6c11709d4c2ca083d0c1f7c7041b5aec4efd9361 (patch)
tree5b16a6e87ee2915c89357e9f15b3d0b1a21b8d93 /lib/tracer.rb
parenta86f6a00df5c97e1e6c64d96e39e11e2df3d9053 (diff)
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/tracer.rb')
-rw-r--r--lib/tracer.rb16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/tracer.rb b/lib/tracer.rb
index 78bada9..859a6d5 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,