hs-opentelemetry-api
Copyright(c) Ian Duncan 2021
LicenseBSD-3
MaintainerIan Duncan
Stabilityinternal
Portabilitynon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

OpenTelemetry.Internal.Logging

Description

The OpenTelemetry specification mandates that the SDK produces self-diagnostic output controllable via OTEL_LOG_LEVEL (error, warn, info, debug) and that users can plug a custom error handler.

Output goes to stderr by default so it never interferes with application stdout. The log level is read once from the environment on first use and cached for the process lifetime. Users can override the output sink via setGlobalErrorHandler.

This module is internal. Library authors should not depend on it.

Since: 0.4.0.0

Synopsis

Documentation

otelLogError :: String -> IO () Source #

Log at ERROR level. Always emitted unless OTEL_LOG_LEVEL=none.

Since: 0.4.0.0

otelLogWarning :: String -> IO () Source #

Log at WARNING level.

Since: 0.4.0.0

otelLogInfo :: String -> IO () Source #

Log at INFO level.

Since: 0.4.0.0

otelLogDebug :: String -> IO () Source #

Log at DEBUG level.

Since: 0.4.0.0

getOTelLogLevel :: IO OTelLogLevel Source #

Retrieve the currently configured log level.

Since: 0.4.0.0

setGlobalErrorHandler :: (String -> IO ()) -> IO () Source #

Replace the global error handler used by all OTel SDK diagnostic output. The default writes to stderr. The OTel spec requires that the SDK allow users to plug a custom error handler.

The handler receives a pre-formatted message string including the severity prefix (e.g. "OpenTelemetry [ERROR] ...").

Since: 0.4.0.0

getGlobalErrorHandler :: IO (String -> IO ()) Source #

Retrieve the current global error handler.

Since: 0.4.0.0