sinatraでログ出力
さくっとログはくには
get '/' do logger.info "loading data" # ... end
ファイルにログはくには
require 'sinatra' configure do # logging is enabled by default in classic style applications, # so `enable :logging` is not needed file = File.new("#{settings.root}/log/#{settings.environment}.log", 'a+') file.sync = true use Rack::CommonLogger, file end get '/' do 'Hello World' end
参考
http://www.sinatrarb.com/intro.html#Logging
Sinatra Recipes - Middleware - Rack Commonlogger