Sinatra error logging middleware