about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-07-03 13:41:29 +0200
committerhut <hut@lavabit.com>2009-07-03 13:41:29 +0200
commit40c86e8ca778c058528786a685a0e9d81e0b144e (patch)
tree7e093ff7cfb22e1a911dcf874a7d47b7bd135152
parenta67fd7b8b0cfe8d6c1a3f8b0e4e3731175c4cb94 (diff)
downloadranger-40c86e8ca778c058528786a685a0e9d81e0b144e.tar.gz
added :file option to debug setup
-rw-r--r--code/debug.rb9
-rwxr-xr-xranger.rb2
2 files changed, 7 insertions, 4 deletions
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'
diff --git a/ranger.rb b/ranger.rb
index 78c40ca8..26e1b79f 100755
--- a/ranger.rb
+++ b/ranger.rb
@@ -36,7 +36,7 @@ load 'data/screensaver/clock.rb'
 include Debug
 
 Debug.setup( :name   => 'nyuron',
-             :stream => File.open('/tmp/errorlog', 'a'),
+             :file   => '/tmp/errorlog',
              :level  => 3 )
 
 ERROR_STREAM = File.open('/tmp/errorlog', 'a')