Skip to content

Instantly share code, notes, and snippets.

@neomatrix369
Created October 18, 2013 16:34
Show Gist options
  • Select an option

  • Save neomatrix369/7044178 to your computer and use it in GitHub Desktop.

Select an option

Save neomatrix369/7044178 to your computer and use it in GitHub Desktop.
R script - basic logging functions [Refactored]
MSG_TYPE_INFO <- "[INFO]"
MSG_TYPE_WARNING <- "[WARNING]"
MSG_TYPE_DEBUG <- "[DEBUG]"
MSG_TYPE_ERROR <- "[ERROR]"
log.ANY <- function(typeOfMessage, message) {
print(paste(date(), typeOfMessage, message))
}
log.INFO <- function(message) {
log.ANY(MSG_TYPE_INFO, message)
}
log.WARNING <- function(message) {
log.ANY(MSG_TYPE_WARNING, message)
}
log.DEBUG <- function(message) {
log.ANY(MSG_TYPE_DEBUG, message)
}
log.ERROR <- function(message) {
log.ANY(MSG_TYPE_ERROR, message)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment