lib/logster/base_store.rb in logster-2.6.3 vs lib/logster/base_store.rb in logster-2.7.0
- old
+ new
@@ -150,10 +150,12 @@
def report(severity, progname, msg, opts = {})
return if (!msg || (String === msg && msg.empty?)) && skip_empty
return if level && severity < level
+ msg = msg.inspect unless String === msg
+ msg = truncate_message(msg)
message = Logster::Message.new(severity, progname, msg, opts[:timestamp], count: opts[:count])
env = opts[:env] || {}
backtrace = opts[:backtrace]
if Hash === env && env[:backtrace]
@@ -242,9 +244,14 @@
def clear_patterns_cache(key)
@patterns_cache.clear(key)
end
private
+
+ def truncate_message(msg)
+ cap = Logster.config.maximum_message_length
+ msg.size <= cap ? msg : msg[0...cap] + "..."
+ end
def not_implemented
raise "Not Implemented"
end
end