Method: Appstats::Logger.entry_to_s

Defined in:
lib/appstats/logger.rb

.entry_to_s(action, contexts = {}) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/appstats/logger.rb', line 40

def self.entry_to_s(action,contexts = {})
  contexts = contexts.merge(default_contexts)
  section_delimiter, assign_delimiter, newline_delimiter = determine_delimiters(contexts.merge(:action => action))
  answer = "#{Appstats::VERSION} setup[#{section_delimiter},#{assign_delimiter},#{newline_delimiter}] "
  answer += "#{now} action#{assign_delimiter}#{format_input(action,newline_delimiter)}"
  contexts.keys.sort.each do |key|
    all_val = contexts[key].kind_of?(Array) ? contexts[key] : [contexts[key]]
    all_val.each do |value|
      answer += " #{section_delimiter} #{key}#{assign_delimiter}#{format_input(value,newline_delimiter)}"
    end
  end
  answer
end