Add PID to log lines

This commit is contained in:
Raphael Sofaer 2011-04-25 11:54:25 -07:00
parent 670d4d91bf
commit ba3b4f7d60

View file

@ -5,7 +5,9 @@ module SplunkLogging
end end
end end
def add_with_splunk(arg1, log_hash = nil, arg3 = nil, &block) def add_with_splunk(arg1, log_hash = nil, arg3 = nil, &block)
add_without_splunk(arg1, format_hash(log_hash), arg3, &block) string = format_hash(log_hash)
string << "pid=#{Process.pid} "
add_without_splunk(arg1, string, arg3, &block)
end end
def format_hash(hash) def format_hash(hash)
if hash.respond_to?(:keys) if hash.respond_to?(:keys)