Include `request.remote_ip` and `current_username` in lograge logs.

This commit is contained in:
Guo Xiang Tan 2017-12-05 11:51:03 +08:00
parent ef0f6f5b97
commit dc858ec120
1 changed files with 7 additions and 0 deletions

View File

@ -8,6 +8,13 @@ if (Rails.env.production? && SiteSetting.logging_provider == 'lograge') || ENV["
Rails.application.configure do
config.lograge.enabled = true
config.lograge.custom_payload do |controller|
{
ip: controller.request.remote_ip,
current_username: controller.current_user&.username,
}
end
config.lograge.custom_options = lambda do |event|
exceptions = %w(controller action format id)