Created
January 4, 2010 08:26
-
-
Save kastner/268403 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# sometimes you really _do_ want a global... | |
# alternately, stick it as a method on a Module somewhere, App.logger or whatever, but it's still just as much of a smell. | |
# replace STDERR with your filename of choice. | |
$logger = Logger.new(STDERR) | |
$logger.formatter = proc { |severity, datetime, progname, msg| | |
"#{severity} - #{progname} - [#{datetime.strftime("%d/%m/%Y %H:%M:%S")}] #{msg}\n" | |
} | |
run(Rack::Builder.new { | |
use Rack::CommonLogger, $logger | |
# ... | |
}) | |
# and then just $logger.debug('hi there!') from wherever you need to debug shit. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment