powered by
This is useful for avoiding computation when logging is inactive.
is_logging_enabled(severity = "info", logger = NULL)
TRUE is OpenTelemetry logging is active, FALSE otherwise.
TRUE
FALSE
Check if logs are emitted at this severity level.
Logger object (otel_logger), or a logger name, the instrumentation scope, to pass to get_logger().
get_logger()
It calls get_logger() with name and then it calls the logger's $is_enabled() method.
name
$is_enabled()
Other OpenTelemetry logs API: log(), log_severity_levels
log()
log_severity_levels
fun <- function() { if (otel::is_logging_enabled()) { xattr <- calculate_some_extra_attributes() otel::log("Starting fun", attributes = xattr) } # ... }
Run the code above in your browser using DataLab