Class: Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/rawk_log/patch_logger.rb

Instance Method Summary collapse

Instance Method Details

#format_message(severity, timestamp, progname, msg) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/rawk_log/patch_logger.rb', line 4

def format_message(severity, timestamp, progname, msg)
  # If a newline is necessary then create a new message ending with a newline.
  # Ensures that the original message is not mutated.
  msg = "#{msg}\n" unless msg[-1,1] == "\n"
  if msg !~ /\(pid\:/
    msg.gsub(/(\S.)$/, "\\1 (pid:#{$$})")
  else
    msg
  end
end