lib/semantic_logger/appender/graylog.rb in semantic_logger-4.6.0.beta1 vs lib/semantic_logger/appender/graylog.rb in semantic_logger-4.6.0

- old
+ new

@@ -1,10 +1,10 @@ require 'uri' begin require 'gelf' rescue LoadError - raise 'Gem gelf is required for logging to Graylog. Please add the gem "gelf" to your Gemfile.' + raise LoadError.new('Gem gelf is required for logging to Graylog. Please add the gem "gelf" to your Gemfile.') end # Forward log entries to a Graylog server. # # Example: @@ -116,10 +116,13 @@ # Returns [Hash] of parameters to send def call(log, logger) h = default_formatter.call(log, logger) - h[:short_message] = h.delete(:message) || log.exception.message + h[:short_message] = h.delete(:message) + if h[:short_message].nil? + h[:short_message] = log.exception.nil? ? '<no-exception-message>' : log.exception.message + end h[:level] = logger.level_map[log.level] h[:level_str] = log.level.to_s h[:duration_str] = h.delete(:duration) h end