diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-04-11 17:32:26 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-04-11 17:32:26 +0000 |
commit | a9b32eae21a10254f67653c8ce92076300ba670b (patch) | |
tree | d57eb4880b67c79ab7d03a148a9712e12914926d /lib/rbot/core/utils | |
parent | 51cd66a19fe4b1a3a3cd1dedd5b1f37ab08ccdc8 (diff) |
use pretty printing with Logger (debug, info, warning and error messages)
Diffstat (limited to 'lib/rbot/core/utils')
-rw-r--r-- | lib/rbot/core/utils/httputil.rb | 19 | ||||
-rw-r--r-- | lib/rbot/core/utils/utils.rb | 2 |
2 files changed, 8 insertions, 13 deletions
diff --git a/lib/rbot/core/utils/httputil.rb b/lib/rbot/core/utils/httputil.rb index 9b58b3a6..e0f93953 100644 --- a/lib/rbot/core/utils/httputil.rb +++ b/lib/rbot/core/utils/httputil.rb @@ -18,7 +18,7 @@ require 'iconv' begin require 'net/https' rescue LoadError => e - error "Couldn't load 'net/https': #{e.inspect}" + error "Couldn't load 'net/https': #{e.pretty_inspect}" error "Secured HTTP connections will fail" end @@ -230,8 +230,7 @@ class HttpUtil self.revalidate self.response.raw_body rescue Exception => e - error e.message - error e.backtrace.join("\n") + error e raise e end end @@ -463,8 +462,7 @@ class HttpUtil begin cached.revalidate(resp) rescue Exception => e - error e.message - error e.backtrace.join("\n") + error e end debug "reusing cached" resp = cached.response @@ -498,8 +496,7 @@ class HttpUtil Net::HTTPPartialContent === resp return resp.body rescue Exception => e - error e.message - error e.backtrace.join("\n") + error e end return nil end @@ -512,8 +509,7 @@ class HttpUtil Net::HTTPServerError == resp return resp rescue Exception => e - error e.message - error e.backtrace.join("\n") + error e end return nil end @@ -525,8 +521,7 @@ class HttpUtil raise 'http error' unless Net::HTTPOK === resp return resp rescue Exception => e - error e.message - error e.backtrace.join("\n") + error e end return nil end @@ -547,7 +542,7 @@ class HttpUtil (now - val.last_used > max_last) || (now - val.first_used > max_first) } rescue => e - error "Failed to remove stale cache: #{e.inspect}" + error "Failed to remove stale cache: #{e.pretty_inspect}" end debug "#{@cache.size} pages after" end diff --git a/lib/rbot/core/utils/utils.rb b/lib/rbot/core/utils/utils.rb index 1c27aa02..71b4c8d4 100644 --- a/lib/rbot/core/utils/utils.rb +++ b/lib/rbot/core/utils/utils.rb @@ -374,7 +374,7 @@ module ::Irc $stderr.reopen($stdout) exec(command, *args) rescue Exception => e - puts "exec of #{command} led to exception: #{e.inspect}" + puts "exec of #{command} led to exception: #{e.pretty_inspect}" Kernel::exit! 0 end puts "exec of #{command} failed" |