Skip to content

otel_logger_provider -> otel_logger

Value

Not applicable.

Details

The logger provider defines how logs are exported when collecting telemetry data. It is unlikely that you need to use logger provider objects directly.

Usually there is a single logger provider for an R app or script.

Typically the logger provider is created automatically, at the first log() call. otel decides which logger provider class to use based on Environment Variables.

Implementations

Note that this list is updated manually and may be incomplete.

Methods

logger_provider$get_logger()

Get or create a new logger object.

Usage

logger_provider$get_logger(
 name = NULL,
 version = NULL,
 schema_url = NULL,
 attributes = NULL
)

Arguments

  • name Logger name. It makes sense to reuse the tracer name as the logger name. See get_logger() and default_tracer_name().

  • version: Optional. Specifies the version of the instrumentation scope if the scope has a version (e.g. R package version). Example value: "1.0.0".

  • schema_url: Optional. Specifies the Schema URL that should be recorded in the emitted telemetry.

  • attributes: Optional. Specifies the instrumentation scope attributes to associate with emitted telemetry. See as_attributes() for allowed values. You can also use as_attributes() to convert R objects to OpenTelemetry attributes.

Value

An OpenTelemetry logger (otel_logger) object.

logger_provider$flush()

Force any buffered logs to flush. Logger providers might not implement this method.

Usage

logger_provider$flush()

Value

Nothing.

See also

Examples

lp <- otel::get_default_logger_provider()
lgr <- lp$get_logger()
lgr$is_enabled()
#> [1] FALSE