set_log_config {azlogr}R Documentation

Set logging configuration


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).


  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"



Character vector of field names to be included in the JSON. These field names are automatically collected by get_logger_meta_variables function, please refer to that function's documentation to see which fields are collected.


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 log_fields. The respective value of each key is expected to be of length 1. It is NULL by default.


If TRUE (default), the logging message is guaranteed to have all non-ASCII characters escaped. If FALSE, the characters will be logged as-is. Please note, it is better to ensure ASCII, otherwise there might be error while sending the HTTP POST request to 'Azure Log Analytics' workspace.


If TRUE (default), the logging time field is converted to UTC timezone while sending the logging dump to 'Azure Log Analytics' workspace. If FALSE, then the local time captured by Sys.time is recorded in the time field.


If TRUE (default), then logs will be sent to 'Azure Log Analytics' workspace and console. Else if FALSE then logs will not be sent to 'Azure Log Analytics' workspace, it will only be displayed on console, which is the default layout of 'logger' package.


Single element character vector is expected. Logs will be posted to this event on 'Azure Log Analytics'. For details, check this: . Default value is "log_from_r".


The name of the environment variable (default is AZ_LOG_ID) which stores the workspace ID of the 'Azure Log Analytics' workspace. Please refer to see how you may get the required workspace ID.


The name of the environment variable (default is AZ_LOG_KEY) which stores the shared key of the 'Azure Log Analytics' workspace. Please refer to see how you may get the required shared key.


It saves the configuration in an environment enclosed within this package. Returns nothing explicitly.


  set_log_config(log_fields = c("level", "time", "msg", "user", "pid"))
  set_log_config(enforce_tz_utc = FALSE, log_to_azure = FALSE)

[Package azlogr version 0.0.4 Index]