From 40c86e8ca778c058528786a685a0e9d81e0b144e Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 3 Jul 2009 13:41:29 +0200 Subject: added :file option to debug setup --- code/debug.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'code') diff --git a/code/debug.rb b/code/debug.rb index d7614aaf..16481b67 100644 --- a/code/debug.rb +++ b/code/debug.rb @@ -26,9 +26,12 @@ module Debug ## 3: log everything def self.setup(name=nil, stream=nil, level=nil) if name.is_a? Hash - stream = name[:stream] - level = name[:level] - name = name[:name] + if name[:file] + stream = File.open(name[:file], 'a') rescue nil + end + stream ||= name[:stream] + level = name[:level] + name = name[:name] end @@name = name || 'debug' -- cgit 1.4.1-2-gfad0