Learn R Programming

logging (version 0.10-108)

setMsgComposer: Sets message composer for logger.

Description

Message composer is used to compose log message out of formating string and arguments. It is function with signature function(msg, ...). Formating message is passed under msg and formating arguments are passed as ....

Usage

setMsgComposer(composer_f, container = "")

Arguments

composer_f

message composer function (type: function(msg, ...))

container

name of logger to reser message composer for (type: character)

Details

If message composer is not set default is in use (realized with sprintf). If message composer is not set for sub-logger, parent's message composer will be used.

Examples

Run this code
# NOT RUN {
setMsgComposer(function(msg, ...) paste0("s-", msg, "-e"))
loginfo("a message") # will log '<TS> INFO::s-a message-e'
resetMsgComposer()
loginfo("a message") # will log '<TS> INFO::a message'

# }

Run the code above in your browser using DataLab