Sha256: f01d67b2f5308bf87affdb86fe6bd7e1da1e2a382e22202b545200cabee38a1e

Contents?: true

Size: 642 Bytes

Versions: 1

Compression:

Stored size: 642 Bytes

Contents

require 'rails'
require 'lograge'

module Metova
  module Logger
    class Railtie < ::Rails::Railtie
      initializer 'metova.logger' do |app|
        app.config.log_tags = [
          ->(req) { req.uuid[0..15] }
        ]
      end

      config.lograge.enabled = true

      config.lograge.custom_options = lambda do |event|
        params = event.payload[:params].reject do |k|
          %w(controller action format).include? k
        end

        {
          time: event.time,
          user: event.payload[:user],
          ip: event.payload[:ip],
          params: "<PARAMS>#{params}</PARAMS>"
        }
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
metova-logger-0.1.0 lib/metova/logger/railtie.rb