.layout_json_custom {azlogr}R Documentation

Customized logging layout

Description

This is an extended function of layout_json function from 'logger' package. Objective is to add additional component in the logging layout in JSON format so that they can also be reported while logging along with the components collected by .add_meta_variables.

Usage

.layout_json_custom(
  log_fields = c("time", "level", "ns", "ans", "topenv", "fn", "node", "arch", "os_name",
    "os_release", "os_version", "pid", "user", "msg"),
  additional_fields = NULL,
  enforce_ascii_msg = TRUE,
  enforce_tz_utc = TRUE
)

Arguments

log_fields

Vector of components which are collected in get_logger_meta_variables function. Converting time component to UTC additionally.

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

enforce_ascii_msg

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.

enforce_tz_utc

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.

Value

Returns a generator function typically to be used by log_layout function.


[Package azlogr version 0.0.6 Index]