Created
March 6, 2012 14:04
-
-
Save samchandra/1986447 to your computer and use it in GitHub Desktop.
logger gem usage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'logger' | |
# setup | |
$LOG = Logger.new("log_file_path") | |
$LOG.level = Logger::DEBUG | |
$LOG.debug "What ever you want to log" | |
# more elaborate, will log all params that | |
# go through your route/controller, use it | |
# as helper method | |
def debug_on | |
$LOG.debug("#{Time.now} - START") | |
$LOG.debug("URL: #{request.url}") | |
$LOG.debug("Params:") | |
params.each do |k,v| | |
$LOG.debug("#{k} => #{v}") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment