Permalink
Browse files

Fixes bug where block was never executed even if message was nil

  • Loading branch information...
1 parent 5f6c932 commit 5a6fefffe0aa6481c512f4bbac3c08a223abe899 @runix runix committed Mar 2, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 lib/better_logging.rb
@@ -117,6 +117,12 @@ def update_pid
def add_with_extra_info(severity, message = nil, progname = nil, &block)
update_pid
time = @@verbose ? "#{Time.now.iso8601(@@fraction_digits)} " : ""
+
+ if message.nil?
+ if block_given?
+ message = yield
+ end
+ end
message = "#{time}#{ActiveSupport::BufferedLogger.severity_name(severity)} #{message}"
# Make sure every line has the PID and hostname and custom string

0 comments on commit 5a6feff

Please sign in to comment.