Mercurial > repos > prog > lcmsmatching
diff MsDbLogger.R @ 6:f86fec07f392 draft default tip
planemo upload commit c397cd8a93953798d733fd62653f7098caac30ce
author | prog |
---|---|
date | Fri, 22 Feb 2019 16:04:22 -0500 |
parents | fb9c0409d85c |
children |
line wrap: on
line diff
--- a/MsDbLogger.R Wed Apr 19 10:00:05 2017 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -if ( ! exists('MsDbLogger')) { # Do not load again if already loaded - - source('MsDbObserver.R') - - ##################### - # CLASS DECLARATION # - ##################### - - MsDbLogger <- setRefClass("MsDbLogger", contains = 'MsDbObserver', fields = list(.verbose = 'numeric', .file = 'ANY' )) - - ############### - # CONSTRUCTOR # - ############### - - MsDbLogger$methods( initialize = function(verbose = 1, file = NULL, ...) { - - .verbose <<- if ( ! is.null(verbose) && ! is.na(verbose)) verbose else 1 - .file <<- if ( ! is.null(file) && ! is.na(file)) file else stderr() - - callSuper(...) # calls super-class initializer with remaining parameters - }) - - ############ - # PROGRESS # - ############ - - MsDbLogger$methods( progress = function(msg, level = 1) { - if (.self$.verbose >= level) - cat(msg, "\n", sep = '', file = .self$.file) - }) - -} # end of load safe guard