Skip to content

Instantly share code, notes, and snippets.

@leosoto
Last active December 24, 2015 16:59
Show Gist options
  • Save leosoto/6832677 to your computer and use it in GitHub Desktop.
Save leosoto/6832677 to your computer and use it in GitHub Desktop.
class Foo
def logger
if Application.production?
$logfile
elsif Application.development?
$stdout
end
end
def important_activity
do_important_thing or logger.puts('Warning: important thing was unsuccessful.')
rescue StandardError => e
logger.puts("Exception: important thing raised an exception. Error: #{e.message}")
raise if $reraise_exceptions
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment