| log_setup | R Documentation |
Several R-level functions can access the spdlog logging facilties. As spdlog
is a C++-level logging library, these are R function permit concurrent logging from both
R and C++.
log_setup(name = "default", level = "warn")
log_init(level = "warn")
log_filesetup(filename, name = "default", level = "warn")
log_drop(name)
log_set_pattern(s)
log_set_level(s)
log_trace(s)
log_debug(s)
log_info(s)
log_warn(s)
log_error(s)
log_critical(s)
name |
A character variable with the logging instance name, default value is ‘default’. |
level |
A character variable with the default logging level, default value is ‘warn’. |
filename |
A character variable with the logging filename if a file-based logger is instantiated. |
s |
A character variable with the logging pattern, level or message. |
Several functions are provided:
log_setupInitializes a logger (which becomes the default logger).
log_filesetupInitializes a file-based logger (which becomes the default).
log_dropRemoves logger (which in general should not be needed).
log_set_patternChanges the default logging message pattern.
log_set_levelSets the logging level threshold.
log_traceLogs a trace-level message.
log_debugLogs a debug-level message.
log_infoLogs a info-level message.
log_warnLogs a warn-level message.
log_errorLogs a error-level message.
log_criticalLogs a critical-level message.
Supported logging levels are, in order of increasing threshold values, ‘trace’, ‘debug’, ‘info’, ‘warn’, ‘error’, and ‘critical’. A message issued below the current threshold is not displayed whereas a message at or above the current threshold is displayed. The default level is ‘warn’.
Nothing is returned from these functions as they are invoked for their side-effects.
The logging pattern format is described in at the repo in the page https://github.com/gabime/spdlog/wiki/3.-Custom-formatting.
log_setup("demo") # at default level 'warn'
log_info("this message is NOT seen")
log_set_level("debug")
log_info("this message is seen")
log_warn("as is this message")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.