lib/timber/log_entry.rb in timber-2.0.16 vs lib/timber/log_entry.rb in timber-2.0.17

- old
+ new

@@ -21,10 +21,14 @@ # @return [LogEntry] the resulting LogEntry object def initialize(level, time, progname, message, context_snapshot, event, options = {}) @level = level @time = time.utc @progname = progname - @message = message + + # If the message is not a string we call inspect to ensure it is a string. + # This follows the default behavior set by ::Logger + # See: https://github.com/ruby/ruby/blob/trunk/lib/logger.rb#L615 + @message = message.is_a?(String) ? message : message.inspect @tags = options[:tags] @time_ms = options[:time_ms] context_snapshot = {} if context_snapshot.nil? hostname = Socket.gethostname \ No newline at end of file