lib/timber/log_entry.rb in timber-2.1.1 vs lib/timber/log_entry.rb in timber-2.1.2
- old
+ new
@@ -6,11 +6,12 @@
module Timber
# Represents a new log entry into the log. This is an intermediary class between
# `Logger` and the log device that you set it up with.
class LogEntry #:nodoc:
DT_PRECISION = 6.freeze
- SCHEMA = "https://raw.githubusercontent.com/timberio/log-event-json-schema/v2.0.4/schema.json".freeze
+ MESSAGE_MAX_BYTES = 8192.freeze
+ SCHEMA = "https://raw.githubusercontent.com/timberio/log-event-json-schema/v3.0.7/schema.json".freeze
attr_reader :context_snapshot, :event, :level, :message, :progname, :tags, :time, :time_ms
# Creates a log entry suitable to be sent to the Timber API.
# @param level [Integer] the log level / severity
@@ -29,9 +30,10 @@
# 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
+ @message = @message.byteslice(0, MESSAGE_MAX_BYTES)
@tags = options[:tags]
@time_ms = options[:time_ms]
@context_snapshot = context_snapshot
@event = event
end
\ No newline at end of file