Sha256: 39228075000cf37c7064ba7bc5199698045edbaf8ec3a504791c1f7363315d37
Contents?: true
Size: 614 Bytes
Versions: 4
Compression:
Stored size: 614 Bytes
Contents
class CustomFormatter def call(severity, datetime, _, data) res = { severity: severity, type: data.class == String ? "query" : "response", date: datetime, data: JSON.parse(data.to_json) } application = Application.find_by(code: ENV['LOG_APP_CODE']) application.application_logs.create(res) "#{res.to_json}\n" end end Rails.application.configure do $log_file = File.open("log/#{ENV['RAILS_ENV']}.log", 'a') $log_file.sync = true ActiveRecord::Base.logger = Logger.new(GrapeLogging::MultiIO.new($log_file, STDERR), formatter: CustomFormatter.new) end
Version data entries
4 entries across 4 versions & 1 rubygems