atlas-cardano
Copyright(c) 2023 GYELD GMBH
LicenseApache 2.0
Maintainer[email protected]
Stabilitydevelop
Safe HaskellNone
LanguageGHC2021

GeniusYield.Types.Logging

Description

 
Synopsis

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"

Constructors

GYDebug 
GYInfo 
GYWarning 
GYError 

Instances

Instances details
FromJSON GYLogSeverity #
>>> Aeson.eitherDecode @GYLogSeverity "\"Debug\""
Right GYDebug
>>> Aeson.eitherDecode @GYLogSeverity "\"Info\""
Right GYInfo
>>> Aeson.eitherDecode @GYLogSeverity "\"Warning\""
Right GYWarning
>>> Aeson.eitherDecode @GYLogSeverity "\"Error\""
Right GYError
>>> Aeson.eitherDecode @GYLogSeverity "\"Fatal\""
Left "Error in $: unknown GYLogSeverity: Fatal"
Instance details

Defined in GeniusYield.Types.Logging

ToJSON GYLogSeverity # 
Instance details

Defined in GeniusYield.Types.Logging

Bounded GYLogSeverity # 
Instance details

Defined in GeniusYield.Types.Logging

Enum GYLogSeverity # 
Instance details

Defined in GeniusYield.Types.Logging

Read GYLogSeverity # 
Instance details

Defined in GeniusYield.Types.Logging

Show GYLogSeverity # 
Instance details

Defined in GeniusYield.Types.Logging

Eq GYLogSeverity # 
Instance details

Defined in GeniusYield.Types.Logging

Ord GYLogSeverity # 
Instance details

Defined in GeniusYield.Types.Logging

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

Instances details
FromJSON GYLogVerbosity # 
Instance details

Defined in GeniusYield.Types.Logging

ToJSON GYLogVerbosity # 
Instance details

Defined in GeniusYield.Types.Logging

Bounded GYLogVerbosity # 
Instance details

Defined in GeniusYield.Types.Logging

Enum GYLogVerbosity # 
Instance details

Defined in GeniusYield.Types.Logging

Read GYLogVerbosity # 
Instance details

Defined in GeniusYield.Types.Logging

Show GYLogVerbosity # 
Instance details

Defined in GeniusYield.Types.Logging

Eq GYLogVerbosity # 
Instance details

Defined in GeniusYield.Types.Logging

Ord GYLogVerbosity # 
Instance details

Defined in GeniusYield.Types.Logging

Namespace

data GYLogNamespace #

>>> "My" <> "Namespace" :: GYLogNamespace
GYLogNamespace (Namespace {unNamespace = ["My","Namespace"]})

Instances

Instances details
PrintfArg GYLogNamespace #
>>> printf "%s" ("My" <> "Namespace" :: GYLogNamespace)
My.Namespace
Instance details

Defined in GeniusYield.Types.Logging

Monoid GYLogNamespace # 
Instance details

Defined in GeniusYield.Types.Logging

Semigroup GYLogNamespace # 
Instance details

Defined in GeniusYield.Types.Logging

IsString GYLogNamespace # 
Instance details

Defined in GeniusYield.Types.Logging

Read GYLogNamespace # 
Instance details

Defined in GeniusYield.Types.Logging

Show GYLogNamespace # 
Instance details

Defined in GeniusYield.Types.Logging

Eq GYLogNamespace # 
Instance details

Defined in GeniusYield.Types.Logging

Ord GYLogNamespace # 
Instance details

Defined in GeniusYield.Types.Logging

Log contexts

addContext :: LogItem i => i -> GYLogContexts -> GYLogContexts #

Add a context to the log contexts. See sl.

sl :: 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

data GYLogEnv #

closeScribes :: GYLogEnv -> IO GYLogEnv #

Calls closeScribes from Katip.

Log configuration

data GYRawLog #

Constructors

GYRawLog 

newtype RawLogger #

Constructors

RawLogger 

unitRawLogger :: 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.

Scribe Configuration

data GYLogScribeType #

Instances

Instances details
FromJSON GYLogScribeType #
>>> Aeson.eitherDecode @GYLogScribeType "{\"tag\":\"stderr\"}"
Right GYStdErrScribe
>>> Aeson.eitherDecode @GYLogScribeType "{\"tag\":\"gySource\",\"source\":\"log.txt\"}"
Right (GYCustomSourceScribe (LogSrc log.txt))
>>> Aeson.eitherDecode @GYLogScribeType "{\"tag\":\"gySource\",\"source\":\"https://pub:[email protected]:8443/sentry/example_project\"}"
Right (GYCustomSourceScribe (LogSrc https://pub:[email protected]:8443/sentry/example_project))
>>> Aeson.eitherDecode @GYLogScribeType "{\"tag\":\"fancy-scribe\"}"
Left "Error in $: unknown GYLogScribe tag: fancy-scribe"
Instance details

Defined in GeniusYield.Types.Logging

ToJSON GYLogScribeType #
>>> LBS8.putStrLn $ Aeson.encode GYStdErrScribe
{"tag":"stderr"}
>>> LBS8.putStrLn $ Aeson.encode $ GYCustomSourceScribe "https://pub:[email protected]:8443/sentry/example_project"
{"tag":"gySource","source":"https://pub:[email protected]:8443/sentry/example_project"}
>>> LBS8.putStrLn $ Aeson.encode $ GYCustomSourceScribe "log.txt"
{"tag":"gySource","source":"log.txt"}
Instance details

Defined in GeniusYield.Types.Logging

Show GYLogScribeType # 
Instance details

Defined in GeniusYield.Types.Logging

Eq GYLogScribeType # 
Instance details

Defined in GeniusYield.Types.Logging

Ord GYLogScribeType # 
Instance details

Defined in GeniusYield.Types.Logging

data GYLogScribeConfig #

Instances

Instances details
FromJSON GYLogScribeConfig #
>>> Aeson.decode @GYLogScribeConfig "{\"severity\":\"Warning\",\"verbosity\":\"V1\",\"type\":{\"tag\":\"gySource\",\"source\":\"log.txt\"}}"
Just (GYLogScribeConfig {cfgLogType = GYCustomSourceScribe (LogSrc log.txt), cfgLogSeverity = GYWarning, cfgLogVerbosity = GYLogVerbosity V1})
Instance details

Defined in GeniusYield.Types.Logging

ToJSON GYLogScribeConfig #
>>> LBS8.putStrLn $ Aeson.encode $ GYLogScribeConfig (GYCustomSourceScribe "log.txt") GYWarning (read "GYLogVerbosity V1")
{"type":{"tag":"gySource","source":"log.txt"},"severity":"Warning","verbosity":"V1"}
Instance details

Defined in GeniusYield.Types.Logging

Show GYLogScribeConfig # 
Instance details

Defined in GeniusYield.Types.Logging

Eq GYLogScribeConfig # 
Instance details

Defined in GeniusYield.Types.Logging

Ord GYLogScribeConfig # 
Instance details

Defined in GeniusYield.Types.Logging

newtype LogSrc #

Constructors

LogSrc URI 

Instances

Instances details
FromJSON LogSrc # 
Instance details

Defined in GeniusYield.Types.Logging

ToJSON LogSrc # 
Instance details

Defined in GeniusYield.Types.Logging

IsString LogSrc # 
Instance details

Defined in GeniusYield.Types.Logging

Methods

fromString :: String -> LogSrc #

Show LogSrc # 
Instance details

Defined in GeniusYield.Types.Logging

Eq LogSrc # 
Instance details

Defined in GeniusYield.Types.Logging

Methods

(==) :: LogSrc -> LogSrc -> Bool #

(/=) :: LogSrc -> LogSrc -> Bool #

Ord LogSrc # 
Instance details

Defined in GeniusYield.Types.Logging

Utilities