Skip to content

Instantly share code, notes, and snippets.

@verajosemanuel
Last active November 14, 2017 09:41
Show Gist options
  • Save verajosemanuel/25cc3f5dd13948efcc32722fc3eca68c to your computer and use it in GitHub Desktop.
Save verajosemanuel/25cc3f5dd13948efcc32722fc3eca68c to your computer and use it in GitHub Desktop.
python style logging in #R with #py_logging #logs
source('py_logging.R')
# Set up logging
logger.setup(debugLog = "debug.log", infoLog = "info.log", errorLog = "error.log")
# Silence other warning messages
options(warn = -1) # -1=ignore, 0=save/print, 1=print, 2=error
err_msg <- geterrmessage()
logger.error('Error on running some scripts: %s')
logger.info('Using my favourite function %s')
logger.fatal('System crashed due to: %s')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment