| 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
- tryLog :: MonadUnliftIO m => LogConfig -> LogLevel -> Text -> m ()
- warnEx :: MonadUnliftIO m => LogConfig -> Text -> SomeException -> m ()
- recoveryLevel :: LogConfig -> LogLevel -> LogLevel
- hubLogFor :: 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)
- data FailureGates
- newFailureGates :: MonadIO m => m FailureGates
- tryReportedOn :: MonadUnliftIO m => LogConfig -> LogLevel -> FailureGates -> Text -> m a -> m (Either SomeException a)
- type Pair = (Key, Value)
- (.=) :: (KeyValue e kv, ToJSON v) => Key -> v -> kv
Log Configuration
How the worker emits its own logs.
Constructors
| LogConfig | |
Fields
| |
Source #data LogDestination
Where Arbiter writes log output.
Constructors
| LogStdout | Log to stdout (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 (silent mode) |
Source #defaultLogConfig :: LogConfig
Default log configuration: Info level to stdout, no additional context.
Source #silentLogConfig :: LogConfig
Silent log configuration: discards all logs.
Log Levels
Log severity levels.
Instances
| Eq LogLevel Source # | |
| Ord LogLevel Source # | |
Defined in Arbiter.Worker.Logger | |
| Bounded LogLevel Source # | |
| Enum LogLevel Source # | |
| Read LogLevel Source # | |
| Show LogLevel Source # | |
Emitting
Source #tryLog :: MonadUnliftIO m => LogConfig -> LogLevel -> Text -> m ()
Log a message, swallowing any exceptions from the logging infrastructure.
Source #warnEx :: MonadUnliftIO m => LogConfig -> Text -> SomeException -> m ()
Source #recoveryLevel :: LogConfig -> LogLevel -> LogLevel
The gentlest level a recovery can take and still reach a log that showed the failure.
Source #hubLogFor :: LogConfig -> HubLog
Hub loggers over cfg. The hub's own events drop the identityContext.
Repeat suppression
#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.
Source #reportOutcome :: MonadUnliftIO m => LogConfig -> LogLevel -> FailureGate -> Text -> Either SomeException a -> m ()
Log an attempt only when it changes the gate. subject reads with both
failed and recovered.
Source #tryReported :: MonadUnliftIO m => LogConfig -> LogLevel -> FailureGate -> Text -> m a -> m (Either SomeException a)
reportOutcome over a run of action.
Source #data FailureGates
Gates addressed by subject. Every subject holds its gate for the life of the store.
Source #newFailureGates :: MonadIO m => m FailureGates
An empty gate store.
Source #tryReportedOn :: MonadUnliftIO m => LogConfig -> LogLevel -> FailureGates -> Text -> m a -> m (Either SomeException a)
tryReported against the gate subject names, created on first use.