Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Adapter module to the actual logging framework. All Hydra node components implements Structured logging via contra-tracer generic logging framework. All logs are output in JSON in a format which is documented in a JSON-Schema.
Synopsis
- newtype Tracer (m :: Type -> Type) a = Tracer {
- runTracer :: a -> m ()
- natTracer :: (forall x. m x -> n x) -> Tracer m s -> Tracer n s
- nullTracer :: forall (m :: Type -> Type) a. Applicative m => Tracer m a
- traceWith :: Tracer m a -> a -> m ()
- class ToObject a where
- toObject :: TracingVerbosity -> a -> Object
- textTransformer :: a -> Object -> Text
- data TracingVerbosity
- data Verbosity
- data Envelope a = Envelope {}
- withTracer :: forall m msg a. (MonadIO m, MonadFork m, MonadTime m, ToJSON msg) => Verbosity -> (Tracer m msg -> IO a) -> IO a
- withTracerOutputTo :: forall m msg a. (MonadIO m, MonadFork m, MonadTime m, ToJSON msg) => Handle -> Text -> (Tracer m msg -> IO a) -> IO a
- showLogsOnFailure :: (MonadSTM m, MonadCatch m, MonadFork m, MonadTime m, MonadSay m, ToJSON msg) => Text -> (Tracer m msg -> m a) -> m a
- traceInTVar :: (MonadFork m, MonadTime m, MonadSTM m) => TVar m [Envelope msg] -> Text -> Tracer m msg
- contramap :: Contravariant f => (a' -> a) -> f a -> f a'
Tracer
newtype Tracer (m :: Type -> Type) a #
Instances
Contravariant (Tracer m) | |
Applicative m => Monoid (Tracer m s) | |
Applicative m => Semigroup (Tracer m s) | |
nullTracer :: forall (m :: Type -> Type) a. Applicative m => Tracer m a #
Nothing
toObject :: TracingVerbosity -> a -> Object #
textTransformer :: a -> Object -> Text #
Instances
ToObject Value | |
Defined in Cardano.BM.Data.Tracer toObject :: TracingVerbosity -> Value -> Object # textTransformer :: Value -> Object -> Text # | |
ToObject Text | |
Defined in Cardano.BM.Data.Tracer toObject :: TracingVerbosity -> Text -> Object # textTransformer :: Text -> Object -> Text # | |
ToObject String | |
Defined in Cardano.BM.Data.Tracer toObject :: TracingVerbosity -> String -> Object # textTransformer :: String -> Object -> Text # | |
ToObject () | |
Defined in Cardano.BM.Data.Tracer toObject :: TracingVerbosity -> () -> Object # textTransformer :: () -> Object -> Text # | |
ToJSON a => ToObject (LOContent a) | |
Defined in Cardano.BM.Data.Tracer toObject :: TracingVerbosity -> LOContent a -> Object # textTransformer :: LOContent a -> Object -> Text # | |
ToJSON a => ToObject (LogObject a) | |
Defined in Cardano.BM.Data.Tracer toObject :: TracingVerbosity -> LogObject a -> Object # textTransformer :: LogObject a -> Object -> Text # |
data TracingVerbosity #
Instances
FromJSON TracingVerbosity | |
Defined in Cardano.BM.Data.Tracer parseJSON :: Value -> Parser TracingVerbosity parseJSONList :: Value -> Parser [TracingVerbosity] | |
Read TracingVerbosity | |
Defined in Cardano.BM.Data.Tracer | |
Show TracingVerbosity | |
Defined in Cardano.BM.Data.Tracer | |
Eq TracingVerbosity | |
Defined in Cardano.BM.Data.Tracer (==) :: TracingVerbosity -> TracingVerbosity -> Bool Source # (/=) :: TracingVerbosity -> TracingVerbosity -> Bool Source # | |
Ord TracingVerbosity | |
Defined in Cardano.BM.Data.Tracer compare :: TracingVerbosity -> TracingVerbosity -> Ordering Source # (<) :: TracingVerbosity -> TracingVerbosity -> Bool Source # (<=) :: TracingVerbosity -> TracingVerbosity -> Bool Source # (>) :: TracingVerbosity -> TracingVerbosity -> Bool Source # (>=) :: TracingVerbosity -> TracingVerbosity -> Bool Source # max :: TracingVerbosity -> TracingVerbosity -> TracingVerbosity Source # min :: TracingVerbosity -> TracingVerbosity -> TracingVerbosity Source # |
Using it
Instances
Arbitrary Verbosity Source # | |
FromJSON Verbosity Source # | |
Defined in Hydra.Logging parseJSON :: Value -> Parser Verbosity parseJSONList :: Value -> Parser [Verbosity] | |
ToJSON Verbosity Source # | |
Defined in Hydra.Logging toEncoding :: Verbosity -> Encoding toJSONList :: [Verbosity] -> Value toEncodingList :: [Verbosity] -> Encoding | |
Generic Verbosity Source # | |
Show Verbosity Source # | |
Eq Verbosity Source # | |
type Rep Verbosity Source # | |
Defined in Hydra.Logging type Rep Verbosity = D1 ('MetaData "Verbosity" "Hydra.Logging" "hydra-node-0.20.0-5pXAEiXeWsXH8K4KfwlMxW" 'False) (C1 ('MetaCons "Quiet" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Verbose" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))) |
Provides logging metadata for entries.
Instances
withTracer :: forall m msg a. (MonadIO m, MonadFork m, MonadTime m, ToJSON msg) => Verbosity -> (Tracer m msg -> IO a) -> IO a Source #
withTracerOutputTo :: forall m msg a. (MonadIO m, MonadFork m, MonadTime m, ToJSON msg) => Handle -> Text -> (Tracer m msg -> IO a) -> IO a Source #
showLogsOnFailure :: (MonadSTM m, MonadCatch m, MonadFork m, MonadTime m, MonadSay m, ToJSON msg) => Text -> (Tracer m msg -> m a) -> m a Source #
Capture logs and output them to stdout when an exception was raised by the
given action
. This tracer is wrapping msg
into an Envelope
with
metadata.
traceInTVar :: (MonadFork m, MonadTime m, MonadSTM m) => TVar m [Envelope msg] -> Text -> Tracer m msg Source #
contramap :: Contravariant f => (a' -> a) -> f a -> f a' Source #