I am using Sinatra 1.3
and it's a Sinatra::Application
.
I have a method that fetches a web service.
I want to log when this service has succeed and what it has failed as it runs in the background (cron job)
def fetch_some_web_service
begin
#if successful
log.info "Success"
rescue SocketError => e
log.info "Failed"
end
end
I can't seem to use the Sinatra
logger instance
. It's generating errors for me and I'm assuming it's doing this because I'm logging in a method and not within a route?
What is the best way to capture the errors
and success
in some log file using Sinatra::Application
I use the following code in Sinatra for logging
Then use logger to log.