Class: Technologic::Logger
- Inherits:
-
Object
- Object
- Technologic::Logger
- Defined in:
- lib/technologic/logger.rb
Class Method Summary collapse
Class Method Details
.format_value_for_log(value) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/technologic/logger.rb', line 14 def format_value_for_log(value) # `#to_log_string` is idiomatic to Technologic and is the most explicit way to specify how an object is logged. return value.to_log_string if value.respond_to?(:to_log_string) return value if value.is_a?(Numeric) return value.id if value.respond_to?(:id) return value.map { |mappable_value| format_value_for_log(mappable_value) } if value.respond_to?(:map) value.to_s end |
.log(severity, event) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/technologic/logger.rb', line 6 def log(severity, event) return unless defined?(Rails) Rails.logger.public_send(severity) do event.data.transform_values { |value| format_value_for_log(value) } end end |