logger | R Documentation |
Optionally creates a new logger or returns a logger stored in the racas namespace. Most inputs are passed through to createLogger
.
The default call 'logger()' will compare the field racas::racasLogger$envir with the current list of frames in the call stack.
If the environment in the racasLogger matches one of the environments in the current call stack, then the racasLogger is returned.
logger(racas = TRUE, reset = FALSE, envir = parent.frame(), ...)
racas |
Boolean marking if racasLogger should be used, or if it is just passed to |
reset |
Boolean marking if racasLogger should be reset. Ignored if |
envir |
name of the log file to write to (default: "acas.log") |
... |
further arguments to be passed to |
object of class Logger
#From a fresh logger (myLogger <- createLogger())
#Will write
myLogger$error("a warn statement")
myLogger$warn("a warn statement")
#Won't write items that are below "WARN" in names(logging::loglevels)
myLogger$debug("a debug statement")
myLogger$info("a warn statement")
#Creating a logger with logLevel = "DEBUG"
myLogger <- createLogger(logName = "com.mycompany.newprocessor",
logFileName = "newprocessor.log",
logLevel = "DEBUG")
#Now it will log debug and info statements
myLogger$debug("a debug statement")
myLogger$info("a warn statement")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.