From 840901c0a8eed9725fc06fb34169e0259d837b5e Mon Sep 17 00:00:00 2001 From: Raphael Sofaer Date: Tue, 9 Aug 2011 11:43:10 -0700 Subject: [PATCH] Allow logging with blocks so that hoptoad works. --- lib/splunk_logging.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/splunk_logging.rb b/lib/splunk_logging.rb index 9f9d7d1fc..5c654aa5e 100644 --- a/lib/splunk_logging.rb +++ b/lib/splunk_logging.rb @@ -5,9 +5,13 @@ module SplunkLogging end end def add_with_splunk(arg1, log_hash = nil, arg3 = nil, &block) - string = format_hash(log_hash).dup - string << " pid=#{Process.pid} " - string << " time=#{Time.now.to_i} " + if log_hash + string = format_hash(log_hash).dup + string << " pid=#{Process.pid} " + string << " time=#{Time.now.to_i} " + else + string = log_hash + end add_without_splunk(arg1, string, arg3, &block) end def format_hash(hash)