[ rails ] log level

:debug
SQL
request details
render details
deprecations
errors

logger.debug("test")

:info
request details
render details
deprecations
errors

logger.info("test")

:warn
deprecations
errors

logger.warn("test")

:error
errors

logger.error("test")

:fatal
errors

logger.fatal("test")

filter_parameter_logging.rb

Rails.application.config.filter_parameters += [:password, :token]

tagged

Rails.logger.tagged("whatever tag") do
Rails.logger.debug "whatever message"
end

result 

[whatever tag] whatever message

NOTE : we can tag caller

caller[0].split('/').last.split(':in').first

ref : http://www.justinweiss.com/articles/keeping-your-logs-from-becoming-an-unreadable-mess/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s