0
我正在使用Sinatra 1.3
,它是一個Sinatra::Application
。
我有一個方法,提取一個Web服務。
我想登錄時該服務有成功,它已經失敗,因爲它在後臺(cron作業)運行用於Web服務錯誤的Sinatra記錄器
def fetch_some_web_service
begin
#if successful
log.info "Success"
rescue SocketError => e
log.info "Failed"
end
end
我似乎無法使用Sinatra
logger instance
。它爲我生成錯誤,我假設它是這樣做的,因爲我登錄的方法,而不是在一個路線內?
什麼是使用Sinatra::Application
是前6行代碼,我會放在我的'helpers'或'do do'中嗎? – alenm 2012-01-04 17:16:07
沒有此代碼將作爲文件的一部分,在任何方法之外。如果您正在使用模塊化的Sinatra風格,請將其作爲課程的一部分。 – randomuser 2012-01-05 08:46:00