Created
June 4, 2013 15:06
-
-
Save FUT/5706623 to your computer and use it in GitHub Desktop.
Sinatra logging
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
before do | |
# if using shotgun, create a custom log format | |
!settings.shotgun || begin | |
logger.class_eval do | |
cattr_accessor :format | |
self.format = <<-TEXT | |
#{Time.now} | |
#{request.request_method} #{request.fullpath} | |
Content-Length: #{request.content_length} | |
Params: #{request.params} | |
TEXT | |
end | |
logger.info logger.format | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment