| Copyright | (c) Ian Duncan 2021 |
|---|---|
| License | BSD-3 |
| Maintainer | Ian Duncan |
| Stability | internal |
| Portability | non-portable (GHC extensions) |
| Safe Haskell | None |
| Language | Haskell2010 |
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
- data OTelLogLevel
- otelLogError :: String -> IO ()
- otelLogWarning :: String -> IO ()
- otelLogInfo :: String -> IO ()
- otelLogDebug :: String -> IO ()
- getOTelLogLevel :: IO OTelLogLevel
- setGlobalErrorHandler :: (String -> IO ()) -> IO ()
- getGlobalErrorHandler :: IO (String -> IO ())
Documentation
data OTelLogLevel Source #
Since: 0.4.0.0
Constructors
| OTelLogNone | |
| OTelLogError | |
| OTelLogWarning | |
| OTelLogInfo | |
| OTelLogDebug |
Instances
| Show OTelLogLevel Source # | |
Defined in OpenTelemetry.Internal.Logging Methods showsPrec :: Int -> OTelLogLevel -> ShowS # show :: OTelLogLevel -> String # showList :: [OTelLogLevel] -> ShowS # | |
| Eq OTelLogLevel Source # | |
Defined in OpenTelemetry.Internal.Logging | |
| Ord OTelLogLevel Source # | |
Defined in OpenTelemetry.Internal.Logging Methods compare :: OTelLogLevel -> OTelLogLevel -> Ordering # (<) :: OTelLogLevel -> OTelLogLevel -> Bool # (<=) :: OTelLogLevel -> OTelLogLevel -> Bool # (>) :: OTelLogLevel -> OTelLogLevel -> Bool # (>=) :: OTelLogLevel -> OTelLogLevel -> Bool # max :: OTelLogLevel -> OTelLogLevel -> OTelLogLevel # min :: OTelLogLevel -> OTelLogLevel -> OTelLogLevel # | |
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