Copyright | (c) 2023 GYELD GMBH |
---|---|
License | Apache 2.0 |
Maintainer | [email protected] |
Stability | develop |
Safe Haskell | Safe-Inferred |
Language | GHC2021 |
Synopsis
- data GYLogSeverity
- logSeverityToKatip ∷ GYLogSeverity → Severity
- newtype GYLogVerbosity = GYLogVerbosity Verbosity
- logVerbosityToKatip ∷ GYLogVerbosity → Verbosity
- data GYLogNamespace
- logNamespaceFromKatip ∷ Namespace → GYLogNamespace
- logNamespaceToKatip ∷ GYLogNamespace → Namespace
- data GYLogContexts
- logContextsFromKatip ∷ LogContexts → GYLogContexts
- logContextsToKatip ∷ GYLogContexts → LogContexts
- addContext ∷ LogItem i ⇒ i → GYLogContexts → GYLogContexts
- sl ∷ ∀ a. ToJSON a ⇒ Text → a → SimpleLogPayload
- logContextsToS ∷ StringConv ByteString a ⇒ GYLogContexts → a
- data GYLogEnv
- logEnvFromKatip ∷ LogEnv → GYLogEnv
- logEnvToKatip ∷ GYLogEnv → LogEnv
- closeScribes ∷ GYLogEnv → IO GYLogEnv
- data GYLogConfiguration = GYLogConfiguration {}
- data GYRawLog = GYRawLog {
- rawLogRun ∷ RawLogger
- rawLogCleanUp ∷ IO ()
- newtype RawLogger = RawLogger {
- unRawLogger ∷ GYLogContexts → GYLogNamespace → GYLogSeverity → Text → IO ()
- unitRawLogger ∷ RawLogger
- simpleRawLogger ∷ GYLogSeverity → (Text → IO ()) → RawLogger
- cfgAddNamespace ∷ GYLogNamespace → GYLogConfiguration → GYLogConfiguration
- cfgAddContext ∷ LogItem i ⇒ i → GYLogConfiguration → GYLogConfiguration
- logRun ∷ (HasCallStack, MonadIO m, StringConv a Text) ⇒ GYLogConfiguration → GYLogSeverity → a → m ()
- data GYLogScribeType
- data GYLogScribeConfig = GYLogScribeConfig {}
- newtype LogSrc = LogSrc URI
- prettyNamespace ∷ GYLogNamespace → String
- mkLogEnv ∷ GYLogNamespace → [GYLogScribeConfig] → IO GYLogEnv
Severity
data GYLogSeverity #
>>>
LBS8.putStrLn $ Aeson.encode GYDebug
"Debug"
>>>
LBS8.putStrLn $ Aeson.encode GYInfo
"Info"
>>>
LBS8.putStrLn $ Aeson.encode GYWarning
"Warning"
>>>
LBS8.putStrLn $ Aeson.encode GYError
"Error"
Instances
Verbosity
newtype GYLogVerbosity #
>>>
Aeson.eitherDecode @GYLogVerbosity "\"V0\""
Right (GYLogVerbosity V0)
>>>
Aeson.eitherDecode @GYLogVerbosity "\"V1\""
Right (GYLogVerbosity V1)
>>>
Aeson.eitherDecode @GYLogVerbosity "\"V2\""
Right (GYLogVerbosity V2)
>>>
Aeson.eitherDecode @GYLogVerbosity "\"V3\""
Right (GYLogVerbosity V3)
>>>
Aeson.eitherDecode @GYLogVerbosity "\"V4\""
Left "Error in $: Invalid Verbosity V4"
Instances
Namespace
data GYLogNamespace #
>>>
"My" <> "Namespace" :: GYLogNamespace
GYLogNamespace (Namespace {unNamespace = ["My","Namespace"]})
Instances
Log contexts
data GYLogContexts #
Instances
Monoid GYLogContexts # | |
Defined in GeniusYield.Types.Logging | |
Semigroup GYLogContexts # | |
Defined in GeniusYield.Types.Logging (<>) ∷ GYLogContexts → GYLogContexts → GYLogContexts # sconcat ∷ NonEmpty GYLogContexts → GYLogContexts # stimes ∷ Integral b ⇒ b → GYLogContexts → GYLogContexts # |
addContext ∷ LogItem i ⇒ i → GYLogContexts → GYLogContexts #
Add a context to the log contexts. See sl
.
sl ∷ ∀ a. ToJSON a ⇒ Text → a → SimpleLogPayload #
Construct a simple log payload.
>>>
Aeson.encode $ logContextsToKatip $ addContext (sl "key" "value") mempty
"{\"key\":\"value\"}"
logContextsToS ∷ StringConv ByteString a ⇒ GYLogContexts → a #
Get textual representation of log contexts.
>>>
logContextsToS @Text $ addContext (sl "key" "value") mempty
"{\"key\":\"value\"}"
Log environment
logEnvToKatip ∷ GYLogEnv → LogEnv #
closeScribes ∷ GYLogEnv → IO GYLogEnv #
Calls closeScribes
from Katip.
Log configuration
data GYLogConfiguration #
RawLogger | |
|
A logger that does ignores the logs.
simpleRawLogger ∷ GYLogSeverity → (Text → IO ()) → RawLogger #
A logger that ignores context and namespace and filters messages based on severity.
cfgAddContext ∷ LogItem i ⇒ i → GYLogConfiguration → GYLogConfiguration #
logRun ∷ (HasCallStack, MonadIO m, StringConv a Text) ⇒ GYLogConfiguration → GYLogSeverity → a → m () #
Scribe Configuration
data GYLogScribeType #
Instances
FromJSON GYLogScribeType # |
|
Defined in GeniusYield.Types.Logging | |
ToJSON GYLogScribeType # |
|
Defined in GeniusYield.Types.Logging | |
Show GYLogScribeType # | |
Defined in GeniusYield.Types.Logging showsPrec ∷ Int → GYLogScribeType → ShowS # show ∷ GYLogScribeType → String # showList ∷ [GYLogScribeType] → ShowS # | |
Eq GYLogScribeType # | |
Defined in GeniusYield.Types.Logging (==) ∷ GYLogScribeType → GYLogScribeType → Bool # (/=) ∷ GYLogScribeType → GYLogScribeType → Bool # | |
Ord GYLogScribeType # | |
Defined in GeniusYield.Types.Logging compare ∷ GYLogScribeType → GYLogScribeType → Ordering # (<) ∷ GYLogScribeType → GYLogScribeType → Bool # (<=) ∷ GYLogScribeType → GYLogScribeType → Bool # (>) ∷ GYLogScribeType → GYLogScribeType → Bool # (>=) ∷ GYLogScribeType → GYLogScribeType → Bool # |
data GYLogScribeConfig #
Instances
FromJSON GYLogScribeConfig # |
|
Defined in GeniusYield.Types.Logging | |
ToJSON GYLogScribeConfig # |
|
Defined in GeniusYield.Types.Logging | |
Show GYLogScribeConfig # | |
Defined in GeniusYield.Types.Logging showsPrec ∷ Int → GYLogScribeConfig → ShowS # show ∷ GYLogScribeConfig → String # showList ∷ [GYLogScribeConfig] → ShowS # | |
Eq GYLogScribeConfig # | |
Defined in GeniusYield.Types.Logging | |
Ord GYLogScribeConfig # | |
Defined in GeniusYield.Types.Logging compare ∷ GYLogScribeConfig → GYLogScribeConfig → Ordering # (<) ∷ GYLogScribeConfig → GYLogScribeConfig → Bool # (<=) ∷ GYLogScribeConfig → GYLogScribeConfig → Bool # (>) ∷ GYLogScribeConfig → GYLogScribeConfig → Bool # (>=) ∷ GYLogScribeConfig → GYLogScribeConfig → Bool # max ∷ GYLogScribeConfig → GYLogScribeConfig → GYLogScribeConfig # min ∷ GYLogScribeConfig → GYLogScribeConfig → GYLogScribeConfig # |
Utilities
mkLogEnv ∷ GYLogNamespace → [GYLogScribeConfig] → IO GYLogEnv #