templates/rails_app/config/initializers/log_formatting.rb in railman-0.6.18 vs templates/rails_app/config/initializers/log_formatting.rb in railman-0.6.19
- old
+ new
@@ -1,7 +1,7 @@
-# Logger Formatter mit Timestamp und in Farbe
-# übernommen von hier: https://cbpowell.wordpress.com/2013/08/09/beautiful-logging-for-ruby-on-rails-4
+# Logger formatter with timestamp and color
+# source: https://cbpowell.wordpress.com/2013/08/09/beautiful-logging-for-ruby-on-rails-4
#
class ActiveSupport::Logger::SimpleFormatter
SEVERITY_TO_COLOR_MAP = { 'DEBUG'=>'0;37', 'INFO'=>'32', 'WARN'=>'33', 'ERROR'=>'31', 'FATAL'=>'31', 'UNKNOWN'=>'37' }
@@ -9,6 +9,15 @@
formatted_severity = sprintf("%-5s",severity)
formatted_time = time.strftime("%d.%m.%Y %H:%M:%S.") << time.usec.to_s[0..2].rjust(3)
color = SEVERITY_TO_COLOR_MAP[severity]
"\033[0;37m#{formatted_time}\033[0m [\033[#{color}m#{formatted_severity}\033[0m] #{msg.strip} (pid:#{$$})\n"
end
+end
+
+# Use lograge to log single line per request
+Rails.application.config.lograge.enabled = true
+Rails.application.config.lograge.custom_options = lambda do |event|
+ exceptions = %w(controller action format id)
+ {
+ params: event.payload[:params].except(*exceptions)
+ }
end