Sha256: e2ac22992d98405f7355b21183f3e0e99b25769b12df9e5b7a38a7d257788bfd

Contents?: true

Size: 923 Bytes

Versions: 3

Compression:

Stored size: 923 Bytes

Contents

require 'lograge'

Rails.application.configure do
  config.lograge.logger = ActiveSupport::Logger.new(STDOUT)
  config.lograge.enabled = true
  config.lograge.keep_original_rails_log = false
  config.lograge.formatter = Lograge::Formatters::Json.new

  config.lograge.custom_options = lambda do |event|
    data = {
      timestamp: event.payload[:timestamp],
      hostname: event.payload[:hostname],
      uuid: event.payload[:uuid],
      url: event.payload[:url],
      remote_ip: event.payload[:remote_ip],
      referer: event.payload[:referer],
      user_agent: event.payload[:user_agent]
    }

    data[:session_id] = event.payload[:session_id] if event.payload[:session_id].present?

    if event.payload[:exception]
      e = event.payload[:exception_object]
      data[:exception_class] = e.class.to_s
      data[:exception_message] = e.message
      data[:backtrace] = e.backtrace
    end

    data
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
docker-fluent-logger-1.0.2 lib/docker-fluent-logger/generator/templates/lograge.rb
docker-fluent-logger-1.0.1 lib/docker-fluent-logger/generator/templates/lograge.rb
docker-fluent-logger-1.0.0 lib/docker-fluent-logger/generator/templates/lograge.rb