about summary refs log tree commit homepage
path: root/lib/unicorn.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-06-17 08:54:37 +0000
committerEric Wong <normalperson@yhbt.net>2011-06-17 08:54:37 +0000
commit5f478f5a9a58f72c0a844258b8ee614bf24ea9f7 (patch)
tree4f54eeda882fa23e957e10a9484d07bca7cd9582 /lib/unicorn.rb
parentfa7ce0a6a755cb71a30417478fb797ee7b8d94b5 (diff)
downloadunicorn-5f478f5a9a58f72c0a844258b8ee614bf24ea9f7.tar.gz
Backtraces are now formatted properly (with timestamps) and
exceptions will be logged more consistently and similar to
Logger defaults:

  "#{exc.message} (#{e.class})"
  backtrace.each { |line| ... }

This may break some existing monitoring scripts, but errors
will be more standardized and easier to check moving forward.
Diffstat (limited to 'lib/unicorn.rb')
-rw-r--r--lib/unicorn.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/unicorn.rb b/lib/unicorn.rb
index 9349e49..9a5eb6f 100644
--- a/lib/unicorn.rb
+++ b/lib/unicorn.rb
@@ -77,6 +77,11 @@ module Unicorn
       Unicorn::SocketHelper.sock_name(io)
     end
   end
+
+  def self.log_error(logger, message, exc)
+    logger.error "#{message}: #{exc.message} (#{exc.class})"
+    exc.backtrace.each { |line| logger.error(line) }
+  end
   # :startdoc:
 end
 # :enddoc: