| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Arbiter.Worker.Logger
Description
The worker's own structured JSON logging: its level, its destination, and the
context every message carries. Application-level job logging belongs on
ObservabilityHooks.
Synopsis
- data LogConfig = LogConfig {}
- data LogDestination
- = LogStdout
- | LogStderr
- | LogFastLogger LoggerSet
- | LogCallback (LogLevel -> Text -> [Pair] -> IO ())
- | LogTee LogDestination LogDestination
- | LogDiscard
- defaultLogConfig :: LogConfig
- silentLogConfig :: LogConfig
- data LogLevel
- data FailureGates
- newFailureGates :: MonadIO m => m FailureGates
- type Pair = (Key, Value)
- (.=) :: (KeyValue e kv, ToJSON v) => Key -> v -> kv
- tryLog :: MonadUnliftIO m => LogConfig -> LogLevel -> Text -> m ()
- warnEx :: MonadUnliftIO m => LogConfig -> Text -> SomeException -> m ()
- withIdentity :: Pair -> LogConfig -> LogConfig
- toHubLog :: LogConfig -> HubLog
- data FailureGate
- newFailureGate :: MonadIO m => m FailureGate
- reportOutcome :: MonadUnliftIO m => LogConfig -> LogLevel -> FailureGate -> Text -> Either SomeException a -> m ()
- tryReported :: MonadUnliftIO m => LogConfig -> LogLevel -> FailureGate -> Text -> m a -> m (Either SomeException a)
- tryReportedOn :: MonadUnliftIO m => LogConfig -> LogLevel -> FailureGates -> Text -> m a -> m (Either SomeException a)
Log configuration
Worker log level, destination, and context.
Constructors
| LogConfig | |
Fields
| |
data LogDestinationSource #
Where Arbiter writes log output.
Constructors
| LogStdout | Log to stdout. The default. |
| LogStderr | Log to stderr. |
| LogFastLogger LoggerSet | Log to a custom fast-logger |
| LogCallback (LogLevel -> Text -> [Pair] -> IO ()) | Log to a user-provided callback. The callback receives the let cb level msg ctx = myLogger level msg ctx
in defaultLogConfig { logDestination = LogCallback cb }
|
| LogTee LogDestination LogDestination | Emit every message to both destinations, the first one before the second. |
| LogDiscard | Discard all logs. |
defaultLogConfig :: LogConfigSource #
Default log configuration: Info level to stdout, no additional context.
silentLogConfig :: LogConfigSource #
Silent log configuration: discards all logs.
Log levels
Log severity levels.
Constructors
| Debug | Detail for diagnosis. |
| Info | Normal events. |
| Warning | Problems that do not stop work. |
| Error | Failed operations. |
Instances
| Eq LogLevel Source # | |
| Ord LogLevel Source # | |
Defined in Arbiter.Worker.Logger | |
| Bounded LogLevel Source # | |
| Enum LogLevel Source # | |
| Read LogLevel Source # | |
| Show LogLevel Source # | |
Failure gates
data FailureGatesSource #
Gates addressed by subject. Every subject holds its gate for the life of the store.
newFailureGates :: MonadIO m => m FailureGatesSource #
An empty gate store.
Re-exports for structured context
Internal
Emitting and repeat suppression for the arbiter packages. Not covered by the PVP.
tryLog :: MonadUnliftIO m => LogConfig -> LogLevel -> Text -> m ()Source #
Log a message, swallowing any exceptions from the logging infrastructure.
warnEx :: MonadUnliftIO m => LogConfig -> Text -> SomeException -> m ()Source #
toHubLog :: LogConfig -> HubLogSource #
Hub loggers over cfg. The hub's own events drop the identityContext.
data FailureGate#
The last failure a repeating action reported and its time. Empty while healthy.
newFailureGate :: MonadIO m => m FailureGate#
A gate for one repeating action, starting healthy.
reportOutcome :: MonadUnliftIO m => LogConfig -> LogLevel -> FailureGate -> Text -> Either SomeException a -> m ()Source #
Log an attempt only when it changes the gate. subject reads with both
failed and recovered.
tryReported :: MonadUnliftIO m => LogConfig -> LogLevel -> FailureGate -> Text -> m a -> m (Either SomeException a)Source #
reportOutcome over a run of action.
tryReportedOn :: MonadUnliftIO m => LogConfig -> LogLevel -> FailureGates -> Text -> m a -> m (Either SomeException a)Source #
tryReported against the gate subject names, created on first use.