set_log_config {azlogr} | R Documentation |
Set logging configuration
Description
Set the logging configuration once by executing this function. There won't be
any need to set them every time while logging something via
logger_level
or any wrapper of that, e.g.
logger_info
function(s).
Usage
set_log_config(
log_fields = c("level", "time", "msg"),
additional_fields = NULL,
enforce_ascii_msg = TRUE,
enforce_tz_utc = TRUE,
log_to_azure = TRUE,
log_type = "log_from_r",
customer_id_env = "AZ_LOG_ID",
shared_key_env = "AZ_LOG_KEY"
)
Arguments
log_fields |
Character vector of field names to be included in the JSON.
These field names are automatically collected by
|
additional_fields |
A named vector of type list with key-value pairs of
additional meta data which needs to be added in logging context on top of
|
enforce_ascii_msg |
If |
enforce_tz_utc |
If |
log_to_azure |
If |
log_type |
Single element character vector is expected. Logs will be
posted to this event on 'Azure Log Analytics'. For details, check this:
https://learn.microsoft.com/en-us/azure/azure-monitor/logs/data-collector-api?tabs=python/
. Default value is |
customer_id_env |
The name of the environment variable (default is
|
shared_key_env |
The name of the environment variable (default is
|
Value
It saves the configuration in an environment enclosed within this package. Returns nothing explicitly.
Examples
set_log_config(log_fields = c("level", "time", "msg", "user", "pid"))
set_log_config(enforce_tz_utc = FALSE, log_to_azure = FALSE)