{-# LANGUAGE TemplateHaskell #-}
module Tendermint.SDK.BaseApp.Logger
(
Logger(..)
, Tendermint.SDK.BaseApp.Logger.log
, Select(..)
, addContext
, LogSelect(..)
, Severity(..)
, Verbosity(..)
) where
import Data.Aeson (ToJSON (..))
import Data.Text (Text)
import Polysemy (makeSem)
data Severity = Debug | Info | Warning | Error | Exception deriving (Severity -> Severity -> Bool
(Severity -> Severity -> Bool)
-> (Severity -> Severity -> Bool) -> Eq Severity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Severity -> Severity -> Bool
$c/= :: Severity -> Severity -> Bool
== :: Severity -> Severity -> Bool
$c== :: Severity -> Severity -> Bool
Eq, Eq Severity
Eq Severity =>
(Severity -> Severity -> Ordering)
-> (Severity -> Severity -> Bool)
-> (Severity -> Severity -> Bool)
-> (Severity -> Severity -> Bool)
-> (Severity -> Severity -> Bool)
-> (Severity -> Severity -> Severity)
-> (Severity -> Severity -> Severity)
-> Ord Severity
Severity -> Severity -> Bool
Severity -> Severity -> Ordering
Severity -> Severity -> Severity
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Severity -> Severity -> Severity
$cmin :: Severity -> Severity -> Severity
max :: Severity -> Severity -> Severity
$cmax :: Severity -> Severity -> Severity
>= :: Severity -> Severity -> Bool
$c>= :: Severity -> Severity -> Bool
> :: Severity -> Severity -> Bool
$c> :: Severity -> Severity -> Bool
<= :: Severity -> Severity -> Bool
$c<= :: Severity -> Severity -> Bool
< :: Severity -> Severity -> Bool
$c< :: Severity -> Severity -> Bool
compare :: Severity -> Severity -> Ordering
$ccompare :: Severity -> Severity -> Ordering
$cp1Ord :: Eq Severity
Ord)
data LogSelect = All | Some [Text]
data Verbosity = V0 | V1 | V2 | V3
class Select a where
select :: Verbosity -> a -> LogSelect
default select :: Verbosity -> a -> LogSelect
select _ _ = LogSelect
All
data Logger m a where
Log :: Severity -> Text -> Logger m ()
AddContext :: (Select x, ToJSON x) => x -> m a -> Logger m a
makeSem ''Logger