Skip to content

Rails logger

May 10, 2012

In views , controllers and models you can call something like

logger.<severity level> “message”

example

logger.warn “hey this is a warning”

logger.debug “this is the value of test variable: #{@test}”

outside of models, views and controllers we can use the constant:

RAILS_DEFAULT_LOGGER.debug “this is the debug message”

The severity levels are: debug, info, warn, error, fatal (in decreasing order of severity)

http://railscasts.com/episodes/56-the-logger

Advertisements

From → Uncategorized

Leave a Comment

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

%d bloggers like this: