Class: Sapience::Formatters::Default
- Defined in:
- lib/sapience/formatters/default.rb
Instance Attribute Summary
Attributes inherited from Base
#log_application, #log_host, #precision, #time_format
Instance Method Summary collapse
-
#call(log, _logger) ⇒ Object
Default text log format Generates logs of the form: 2011-07-19 14:36:15.660235 D [1149:ScriptThreadProcess] Rails – Hello World.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Sapience::Formatters::Base
Instance Method Details
#call(log, _logger) ⇒ Object
Default text log format
Generates logs of the form:
2011-07-19 14:36:15.660235 D [1149:ScriptThreadProcess] Rails -- Hello World
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/sapience/formatters/default.rb', line 8 def call(log, _logger) # rubocop:disable AbcSize, PerceivedComplexity, CyclomaticComplexity # Date & time = time_format.nil? ? "" : "#{format_time(log.time)} " # Log level and process info += "#{log.level_to_s} [#{log.process_info}]" # Tags += " " + log..collect { |tag| "[#{tag}]" }.join(" ") if log. && !log..empty? # Duration += " (#{log.duration_human})" if log.duration # Class / app name += " #{log.name}" # Log message += " -- #{log.}" if log. # Payload if (payload = log.payload_to_s) += " -- " + payload end # Exceptions if log.exception += " -- Exception: #{log.exception.class}: #{log.exception.}\n" += log.backtrace_to_s end end |