trace-dispatcher-2.5.2: Tracers for Cardano
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cardano.Logging

Synopsis

Documentation

class Contravariant (f :: Type -> Type) where Source #

The class of contravariant functors.

Whereas in Haskell, one can think of a Functor as containing or producing values, a contravariant functor is a functor that can be thought of as consuming values.

As an example, consider the type of predicate functions a -> Bool. One such predicate might be negative x = x < 0, which classifies integers as to whether they are negative. However, given this predicate, we can re-use it in other situations, providing we have a way to map values to integers. For instance, we can use the negative predicate on a person's bank balance to work out if they are currently overdrawn:

newtype Predicate a = Predicate { getPredicate :: a -> Bool }

instance Contravariant Predicate where
  contramap :: (a' -> a) -> (Predicate a -> Predicate a')
  contramap f (Predicate p) = Predicate (p . f)
                                         |   `- First, map the input...
                                         `----- then apply the predicate.

overdrawn :: Predicate Person
overdrawn = contramap personBankBalance negative

Any instance should be subject to the following laws:

Identity
contramap id = id
Composition
contramap (g . f) = contramap f . contramap g

Note, that the second law follows from the free theorem of the type of contramap and the first law, so you need only check that the former condition holds.

Minimal complete definition

contramap

Methods

contramap :: (a' -> a) -> f a -> f a' Source #

(>$) :: b -> f b -> f a infixl 4 Source #

Replace all locations in the output with the same value. The default definition is contramap . const, but this may be overridden with a more efficient version.

Instances

Instances details
Contravariant ToJSONKeyFunction 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

contramap :: (a' -> a) -> ToJSONKeyFunction a -> ToJSONKeyFunction a' Source #

(>$) :: b -> ToJSONKeyFunction b -> ToJSONKeyFunction a Source #

Contravariant Comparison

A Comparison is a Contravariant Functor, because contramap can apply its function argument to each input of the comparison function.

Instance details

Defined in Data.Functor.Contravariant

Methods

contramap :: (a' -> a) -> Comparison a -> Comparison a' Source #

(>$) :: b -> Comparison b -> Comparison a Source #

Contravariant Equivalence

Equivalence relations are Contravariant, because you can apply the contramapped function to each input to the equivalence relation.

Instance details

Defined in Data.Functor.Contravariant

Methods

contramap :: (a' -> a) -> Equivalence a -> Equivalence a' Source #

(>$) :: b -> Equivalence b -> Equivalence a Source #

Contravariant Predicate

A Predicate is a Contravariant Functor, because contramap can apply its function argument to the input of the predicate.

Without newtypes contramap f equals precomposing with f (= (. f)).

contramap :: (a' -> a) -> (Predicate a -> Predicate a')
contramap f (Predicate g) = Predicate (g . f)
Instance details

Defined in Data.Functor.Contravariant

Methods

contramap :: (a' -> a) -> Predicate a -> Predicate a' Source #

(>$) :: b -> Predicate b -> Predicate a Source #

Contravariant (Op a) 
Instance details

Defined in Data.Functor.Contravariant

Methods

contramap :: (a' -> a0) -> Op a a0 -> Op a a' Source #

(>$) :: b -> Op a b -> Op a a0 Source #

Contravariant (Proxy :: Type -> Type) 
Instance details

Defined in Data.Functor.Contravariant

Methods

contramap :: (a' -> a) -> Proxy a -> Proxy a' Source #

(>$) :: b -> Proxy b -> Proxy a Source #

Contravariant (U1 :: Type -> Type) 
Instance details

Defined in Data.Functor.Contravariant

Methods

contramap :: (a' -> a) -> U1 a -> U1 a' Source #

(>$) :: b -> U1 b -> U1 a Source #

Contravariant (V1 :: Type -> Type) 
Instance details

Defined in Data.Functor.Contravariant

Methods

contramap :: (a' -> a) -> V1 a -> V1 a' Source #

(>$) :: b -> V1 b -> V1 a Source #

Contravariant (Tracer m) 
Instance details

Defined in Control.Tracer

Methods

contramap :: (a' -> a) -> Tracer m a -> Tracer m a' Source #

(>$) :: b -> Tracer m b -> Tracer m a Source #

Contravariant m => Contravariant (FirstToFinish m) 
Instance details

Defined in Data.Monoid.Synchronisation

Methods

contramap :: (a' -> a) -> FirstToFinish m a -> FirstToFinish m a' Source #

(>$) :: b -> FirstToFinish m b -> FirstToFinish m a Source #

Monad m => Contravariant (Trace m) Source #

Contramap lifted to Trace

Instance details

Defined in Cardano.Logging.Types

Methods

contramap :: (a' -> a) -> Trace m a -> Trace m a' Source #

(>$) :: b -> Trace m b -> Trace m a Source #

Monad m => Contravariant (Tracer m) Source # 
Instance details

Defined in Control.Tracer

Methods

contramap :: (a' -> a) -> Tracer m a -> Tracer m a' Source #

(>$) :: b -> Tracer m b -> Tracer m a Source #

Contravariant m => Contravariant (MaybeT m) 
Instance details

Defined in Control.Monad.Trans.Maybe

Methods

contramap :: (a' -> a) -> MaybeT m a -> MaybeT m a' Source #

(>$) :: b -> MaybeT m b -> MaybeT m a Source #

Contravariant (Const a :: Type -> Type) 
Instance details

Defined in Data.Functor.Contravariant

Methods

contramap :: (a' -> a0) -> Const a a0 -> Const a a' Source #

(>$) :: b -> Const a b -> Const a a0 Source #

Contravariant f => Contravariant (Alt f) 
Instance details

Defined in Data.Functor.Contravariant

Methods

contramap :: (a' -> a) -> Alt f a -> Alt f a' Source #

(>$) :: b -> Alt f b -> Alt f a Source #

Contravariant f => Contravariant (Rec1 f) 
Instance details

Defined in Data.Functor.Contravariant

Methods

contramap :: (a' -> a) -> Rec1 f a -> Rec1 f a' Source #

(>$) :: b -> Rec1 f b -> Rec1 f a Source #

Contravariant f => Contravariant (Backwards f)

Derived instance.

Instance details

Defined in Control.Applicative.Backwards

Methods

contramap :: (a' -> a) -> Backwards f a -> Backwards f a' Source #

(>$) :: b -> Backwards f b -> Backwards f a Source #

Contravariant m => Contravariant (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

contramap :: (a' -> a) -> ExceptT e m a -> ExceptT e m a' Source #

(>$) :: b -> ExceptT e m b -> ExceptT e m a Source #

Contravariant f => Contravariant (IdentityT f) 
Instance details

Defined in Control.Monad.Trans.Identity

Methods

contramap :: (a' -> a) -> IdentityT f a -> IdentityT f a' Source #

(>$) :: b -> IdentityT f b -> IdentityT f a Source #

Contravariant m => Contravariant (ReaderT r m) 
Instance details

Defined in Control.Monad.Trans.Reader

Methods

contramap :: (a' -> a) -> ReaderT r m a -> ReaderT r m a' Source #

(>$) :: b -> ReaderT r m b -> ReaderT r m a Source #

Contravariant m => Contravariant (StateT s m) 
Instance details

Defined in Control.Monad.Trans.State.Lazy

Methods

contramap :: (a' -> a) -> StateT s m a -> StateT s m a' Source #

(>$) :: b -> StateT s m b -> StateT s m a Source #

Contravariant m => Contravariant (StateT s m) 
Instance details

Defined in Control.Monad.Trans.State.Strict

Methods

contramap :: (a' -> a) -> StateT s m a -> StateT s m a' Source #

(>$) :: b -> StateT s m b -> StateT s m a Source #

Contravariant m => Contravariant (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

contramap :: (a' -> a) -> WriterT w m a -> WriterT w m a' Source #

(>$) :: b -> WriterT w m b -> WriterT w m a Source #

Contravariant m => Contravariant (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Strict

Methods

contramap :: (a' -> a) -> WriterT w m a -> WriterT w m a' Source #

(>$) :: b -> WriterT w m b -> WriterT w m a Source #

Contravariant (Constant a :: Type -> Type) 
Instance details

Defined in Data.Functor.Constant

Methods

contramap :: (a' -> a0) -> Constant a a0 -> Constant a a' Source #

(>$) :: b -> Constant a b -> Constant a a0 Source #

Contravariant f => Contravariant (Reverse f)

Derived instance.

Instance details

Defined in Data.Functor.Reverse

Methods

contramap :: (a' -> a) -> Reverse f a -> Reverse f a' Source #

(>$) :: b -> Reverse f b -> Reverse f a Source #

(Contravariant f, Contravariant g) => Contravariant (Product f g) 
Instance details

Defined in Data.Functor.Contravariant

Methods

contramap :: (a' -> a) -> Product f g a -> Product f g a' Source #

(>$) :: b -> Product f g b -> Product f g a Source #

(Contravariant f, Contravariant g) => Contravariant (Sum f g) 
Instance details

Defined in Data.Functor.Contravariant

Methods

contramap :: (a' -> a) -> Sum f g a -> Sum f g a' Source #

(>$) :: b -> Sum f g b -> Sum f g a Source #

(Contravariant f, Contravariant g) => Contravariant (f :*: g) 
Instance details

Defined in Data.Functor.Contravariant

Methods

contramap :: (a' -> a) -> (f :*: g) a -> (f :*: g) a' Source #

(>$) :: b -> (f :*: g) b -> (f :*: g) a Source #

(Contravariant f, Contravariant g) => Contravariant (f :+: g) 
Instance details

Defined in Data.Functor.Contravariant

Methods

contramap :: (a' -> a) -> (f :+: g) a -> (f :+: g) a' Source #

(>$) :: b -> (f :+: g) b -> (f :+: g) a Source #

Contravariant (K1 i c :: Type -> Type) 
Instance details

Defined in Data.Functor.Contravariant

Methods

contramap :: (a' -> a) -> K1 i c a -> K1 i c a' Source #

(>$) :: b -> K1 i c b -> K1 i c a Source #

(Functor f, Contravariant g) => Contravariant (Compose f g) 
Instance details

Defined in Data.Functor.Contravariant

Methods

contramap :: (a' -> a) -> Compose f g a -> Compose f g a' Source #

(>$) :: b -> Compose f g b -> Compose f g a Source #

(Functor f, Contravariant g) => Contravariant (f :.: g) 
Instance details

Defined in Data.Functor.Contravariant

Methods

contramap :: (a' -> a) -> (f :.: g) a -> (f :.: g) a' Source #

(>$) :: b -> (f :.: g) b -> (f :.: g) a Source #

Contravariant f => Contravariant (M1 i c f) 
Instance details

Defined in Data.Functor.Contravariant

Methods

contramap :: (a' -> a) -> M1 i c f a -> M1 i c f a' Source #

(>$) :: b -> M1 i c f b -> M1 i c f a Source #

Contravariant m => Contravariant (RWST r w s m) 
Instance details

Defined in Control.Monad.Trans.RWS.Lazy

Methods

contramap :: (a' -> a) -> RWST r w s m a -> RWST r w s m a' Source #

(>$) :: b -> RWST r w s m b -> RWST r w s m a Source #

Contravariant m => Contravariant (RWST r w s m) 
Instance details

Defined in Control.Monad.Trans.RWS.Strict

Methods

contramap :: (a' -> a) -> RWST r w s m a -> RWST r w s m a' Source #

(>$) :: b -> RWST r w s m b -> RWST r w s m a Source #

newtype Trace m a Source #

The Trace carries the underlying tracer Tracer from the contra-tracer package. It adds a LoggingContext and maybe a TraceControl to every message.

Constructors

Trace 

Instances

Instances details
Monad m => Contravariant (Trace m) Source #

Contramap lifted to Trace

Instance details

Defined in Cardano.Logging.Types

Methods

contramap :: (a' -> a) -> Trace m a -> Trace m a' Source #

(>$) :: b -> Trace m b -> Trace m a Source #

Monad m => Monoid (Trace m a) Source # 
Instance details

Defined in Cardano.Logging.Types

Methods

mempty :: Trace m a Source #

mappend :: Trace m a -> Trace m a -> Trace m a Source #

mconcat :: [Trace m a] -> Trace m a Source #

Monad m => Semigroup (Trace m a) Source #

tr1 <> tr2 will run tr1 and then tr2 with the same input.

Instance details

Defined in Cardano.Logging.Types

Methods

(<>) :: Trace m a -> Trace m a -> Trace m a Source #

sconcat :: NonEmpty (Trace m a) -> Trace m a Source #

stimes :: Integral b => b -> Trace m a -> Trace m a Source #

data TraceDispatcherMessage Source #

Constructors

StartLimiting Text

This message indicates the start of frequency limiting

StopLimiting Text Int

This message indicates the stop of frequency limiting, and gives the number of messages that has been suppressed

RememberLimiting Text Int

This message remembers of ongoing frequency limiting, and gives the number of messages that has been suppressed

UnknownNamespace [Text] [Text] UnknownNamespaceKind

An internal error was detected

TracerInfo [Text] [Text] [Text]

The first array signifies the namespace of silent tracers The second array signifies the namespace tracers without metrics The third array gives the names of all tracers

MetricsInfo (Map Text Int)

Outputs optional statistics about metrics frequency

TracerConsistencyWarnings [Text]

Consistency check found warnings

TracerInfoConfig TraceConfig

Trace the effective configuration as JSON

type NSWarnings = [Text] Source #

Warnings as a list of text

data DocuResult Source #

Instances

Instances details
Show DocuResult Source # 
Instance details

Defined in Cardano.Logging.DocuGenerator

data DocTracer Source #

Constructors

DocTracer 

Fields

data TraceObject Source #

Used as interface object for ForwarderTracer

Instances

Instances details
Generic TraceObject Source # 
Instance details

Defined in Cardano.Logging.Types

Associated Types

type Rep TraceObject :: Type -> Type Source #

Show TraceObject Source # 
Instance details

Defined in Cardano.Logging.Types

Eq TraceObject Source # 
Instance details

Defined in Cardano.Logging.Types

Serialise TraceObject Source # 
Instance details

Defined in Cardano.Logging.Types

ShowProxy TraceObject Source # 
Instance details

Defined in Cardano.Logging.Types

type Rep TraceObject Source # 
Instance details

Defined in Cardano.Logging.Types

data LimiterSpec Source #

Constructors

LimiterSpec 

Fields

class LogFormatting a where Source #

Every message needs this to define how to represent itself

Minimal complete definition

forMachine

Methods

forMachine :: DetailLevel -> a -> Object Source #

Machine readable representation with the possibility to represent with different details based on the detail level. No machine readable representation as default

forHuman :: a -> Text Source #

Human readable representation. No human representation is represented by the empty text The default implementation returns no human representation

forHumanOrMachine :: a -> Text Source #

asMetrics :: a -> [Metric] Source #

Metrics representation. No metrics by default

data Metric Source #

Constructors

IntM Text Integer

An integer metric. Text is used to name the metric

DoubleM Text Double

A double metric. Text is used to name the metric

CounterM Text (Maybe Int)

A counter metric. Text is used to name the metric

Instances

Instances details
Show Metric Source # 
Instance details

Defined in Cardano.Logging.Types

Eq Metric Source # 
Instance details

Defined in Cardano.Logging.Types

newtype Documented a Source #

Constructors

Documented 

Fields

Instances

Instances details
Semigroup (Documented a) Source # 
Instance details

Defined in Cardano.Logging.Types

Show (Documented a) Source # 
Instance details

Defined in Cardano.Logging.Types

data DocMsg a Source #

Document a message by giving a prototype, its most special name in the namespace and a comment in markdown format

Constructors

DocMsg 

Instances

Instances details
Show (DocMsg a) Source # 
Instance details

Defined in Cardano.Logging.Types

data LoggingContext Source #

Context any log message carries

Instances

Instances details
Generic LoggingContext Source # 
Instance details

Defined in Cardano.Logging.Types

Associated Types

type Rep LoggingContext :: Type -> Type Source #

Show LoggingContext Source # 
Instance details

Defined in Cardano.Logging.Types

Serialise LoggingContext Source # 
Instance details

Defined in Cardano.Logging.Types

type Rep LoggingContext Source # 
Instance details

Defined in Cardano.Logging.Types

type Rep LoggingContext = D1 ('MetaData "LoggingContext" "Cardano.Logging.Types" "trace-dispatcher-2.5.2-inplace" 'False) (C1 ('MetaCons "LoggingContext" 'PrefixI 'True) ((S1 ('MetaSel ('Just "lcNSInner") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text]) :*: S1 ('MetaSel ('Just "lcNSPrefix") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text])) :*: (S1 ('MetaSel ('Just "lcSeverity") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe SeverityS)) :*: (S1 ('MetaSel ('Just "lcPrivacy") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Privacy)) :*: S1 ('MetaSel ('Just "lcDetails") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe DetailLevel))))))

data Namespace a Source #

A unique identifier for every message, composed of text A namespace can as well appear with the tracer name (e.g. ChainDB.OpenEvent.OpenedDB), or more prefixes, in this moment it is a NamespaceOuter is used

Constructors

Namespace 

Fields

Instances

Instances details
Show (Namespace a) Source # 
Instance details

Defined in Cardano.Logging.Types

Eq (Namespace a) Source # 
Instance details

Defined in Cardano.Logging.Types

data DetailLevel Source #

Formerly known as verbosity

Instances

Instances details
FromJSON DetailLevel Source # 
Instance details

Defined in Cardano.Logging.Types

ToJSON DetailLevel Source # 
Instance details

Defined in Cardano.Logging.Types

Bounded DetailLevel Source # 
Instance details

Defined in Cardano.Logging.Types

Enum DetailLevel Source # 
Instance details

Defined in Cardano.Logging.Types

Generic DetailLevel Source # 
Instance details

Defined in Cardano.Logging.Types

Associated Types

type Rep DetailLevel :: Type -> Type Source #

Show DetailLevel Source # 
Instance details

Defined in Cardano.Logging.Types

Eq DetailLevel Source # 
Instance details

Defined in Cardano.Logging.Types

Ord DetailLevel Source # 
Instance details

Defined in Cardano.Logging.Types

Serialise DetailLevel Source # 
Instance details

Defined in Cardano.Logging.Types

type Rep DetailLevel Source # 
Instance details

Defined in Cardano.Logging.Types

type Rep DetailLevel = D1 ('MetaData "DetailLevel" "Cardano.Logging.Types" "trace-dispatcher-2.5.2-inplace" 'False) ((C1 ('MetaCons "DMinimal" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DNormal" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "DDetailed" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DMaximum" 'PrefixI 'False) (U1 :: Type -> Type)))

data Privacy Source #

Privacy of a message. Default is Public

Constructors

Confidential

confidential information - handle with care

Public

can be public.

Instances

Instances details
Bounded Privacy Source # 
Instance details

Defined in Cardano.Logging.Types

Enum Privacy Source # 
Instance details

Defined in Cardano.Logging.Types

Generic Privacy Source # 
Instance details

Defined in Cardano.Logging.Types

Associated Types

type Rep Privacy :: Type -> Type Source #

Show Privacy Source # 
Instance details

Defined in Cardano.Logging.Types

Eq Privacy Source # 
Instance details

Defined in Cardano.Logging.Types

Ord Privacy Source # 
Instance details

Defined in Cardano.Logging.Types

Serialise Privacy Source # 
Instance details

Defined in Cardano.Logging.Types

type Rep Privacy Source # 
Instance details

Defined in Cardano.Logging.Types

type Rep Privacy = D1 ('MetaData "Privacy" "Cardano.Logging.Types" "trace-dispatcher-2.5.2-inplace" 'False) (C1 ('MetaCons "Confidential" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Public" 'PrefixI 'False) (U1 :: Type -> Type))

data SeverityS Source #

Severity of a message

Constructors

Debug

Debug messages

Info

Information

Notice

Normal runtime Conditions

Warning

General Warnings

Error

General Errors

Critical

Severe situations

Alert

Take immediate action

Emergency

System is unusable

Instances

Instances details
FromJSON SeverityS Source # 
Instance details

Defined in Cardano.Logging.Types

ToJSON SeverityS Source # 
Instance details

Defined in Cardano.Logging.Types

Bounded SeverityS Source # 
Instance details

Defined in Cardano.Logging.Types

Enum SeverityS Source # 
Instance details

Defined in Cardano.Logging.Types

Generic SeverityS Source # 
Instance details

Defined in Cardano.Logging.Types

Associated Types

type Rep SeverityS :: Type -> Type Source #

Read SeverityS Source # 
Instance details

Defined in Cardano.Logging.Types

Show SeverityS Source # 
Instance details

Defined in Cardano.Logging.Types

Eq SeverityS Source # 
Instance details

Defined in Cardano.Logging.Types

Ord SeverityS Source # 
Instance details

Defined in Cardano.Logging.Types

Serialise SeverityS Source # 
Instance details

Defined in Cardano.Logging.Types

type Rep SeverityS Source # 
Instance details

Defined in Cardano.Logging.Types

type Rep SeverityS = D1 ('MetaData "SeverityS" "Cardano.Logging.Types" "trace-dispatcher-2.5.2-inplace" 'False) (((C1 ('MetaCons "Debug" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Info" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Notice" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Warning" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "Error" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Critical" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "Alert" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Emergency" 'PrefixI 'False) (U1 :: Type -> Type))))

newtype SeverityF Source #

Severity for a filter Nothing means don't show anything (Silence) Nothing level means show messages with severity >= level

Constructors

SeverityF (Maybe SeverityS) 

Instances

Instances details
FromJSON SeverityF Source # 
Instance details

Defined in Cardano.Logging.Types

ToJSON SeverityF Source # 
Instance details

Defined in Cardano.Logging.Types

Enum SeverityF Source # 
Instance details

Defined in Cardano.Logging.Types

Show SeverityF Source # 
Instance details

Defined in Cardano.Logging.Types

Eq SeverityF Source # 
Instance details

Defined in Cardano.Logging.Types

Ord SeverityF Source # 
Instance details

Defined in Cardano.Logging.Types

data ConfigOption Source #

Constructors

ConfSeverity

Severity level for a filter (default is Warning)

Fields

ConfDetail

Detail level (default is DNormal)

Fields

ConfBackend

To which backend to pass Default is [EKGBackend, Forwarder, Stdout MachineFormat]

Fields

ConfLimiter

Construct a limiter with limiting to the Double, which represents frequency in number of messages per second

Fields

Instances

Instances details
Generic ConfigOption Source # 
Instance details

Defined in Cardano.Logging.Types

Associated Types

type Rep ConfigOption :: Type -> Type Source #

Show ConfigOption Source # 
Instance details

Defined in Cardano.Logging.Types

Eq ConfigOption Source # 
Instance details

Defined in Cardano.Logging.Types

Ord ConfigOption Source # 
Instance details

Defined in Cardano.Logging.Types

type Rep ConfigOption Source # 
Instance details

Defined in Cardano.Logging.Types

type Rep ConfigOption = D1 ('MetaData "ConfigOption" "Cardano.Logging.Types" "trace-dispatcher-2.5.2-inplace" 'False) ((C1 ('MetaCons "ConfSeverity" 'PrefixI 'True) (S1 ('MetaSel ('Just "severity") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SeverityF)) :+: C1 ('MetaCons "ConfDetail" 'PrefixI 'True) (S1 ('MetaSel ('Just "detail") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 DetailLevel))) :+: (C1 ('MetaCons "ConfBackend" 'PrefixI 'True) (S1 ('MetaSel ('Just "backends") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [BackendConfig])) :+: C1 ('MetaCons "ConfLimiter" 'PrefixI 'True) (S1 ('MetaSel ('Just "maxFrequency") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double))))

data ForwarderMode Source #

Constructors

Initiator

Forwarder works as a client: it initiates network connection with 'cardano-tracer' and/or another Haskell acceptor application.

Responder

Forwarder works as a server: it accepts network connection from 'cardano-tracer' and/or another Haskell acceptor application.

Instances

Instances details
FromJSON ForwarderMode Source # 
Instance details

Defined in Cardano.Logging.Types

Generic ForwarderMode Source # 
Instance details

Defined in Cardano.Logging.Types

Associated Types

type Rep ForwarderMode :: Type -> Type Source #

Show ForwarderMode Source # 
Instance details

Defined in Cardano.Logging.Types

Eq ForwarderMode Source # 
Instance details

Defined in Cardano.Logging.Types

Ord ForwarderMode Source # 
Instance details

Defined in Cardano.Logging.Types

type Rep ForwarderMode Source # 
Instance details

Defined in Cardano.Logging.Types

type Rep ForwarderMode = D1 ('MetaData "ForwarderMode" "Cardano.Logging.Types" "trace-dispatcher-2.5.2-inplace" 'False) (C1 ('MetaCons "Initiator" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Responder" 'PrefixI 'False) (U1 :: Type -> Type))

data Verbosity Source #

Constructors

Maximum

Maximum verbosity for all tracers in the forwarding protocols.

Minimum

Minimum verbosity, the forwarding will work as silently as possible.

Instances

Instances details
FromJSON Verbosity Source # 
Instance details

Defined in Cardano.Logging.Types

ToJSON Verbosity Source # 
Instance details

Defined in Cardano.Logging.Types

Generic Verbosity Source # 
Instance details

Defined in Cardano.Logging.Types

Associated Types

type Rep Verbosity :: Type -> Type Source #

Show Verbosity Source # 
Instance details

Defined in Cardano.Logging.Types

Eq Verbosity Source # 
Instance details

Defined in Cardano.Logging.Types

Ord Verbosity Source # 
Instance details

Defined in Cardano.Logging.Types

type Rep Verbosity Source # 
Instance details

Defined in Cardano.Logging.Types

type Rep Verbosity = D1 ('MetaData "Verbosity" "Cardano.Logging.Types" "trace-dispatcher-2.5.2-inplace" 'False) (C1 ('MetaCons "Maximum" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Minimum" 'PrefixI 'False) (U1 :: Type -> Type))

data TraceOptionForwarder Source #

Instances

Instances details
FromJSON TraceOptionForwarder Source # 
Instance details

Defined in Cardano.Logging.Types

ToJSON TraceOptionForwarder Source # 
Instance details

Defined in Cardano.Logging.Types

Generic TraceOptionForwarder Source # 
Instance details

Defined in Cardano.Logging.Types

Associated Types

type Rep TraceOptionForwarder :: Type -> Type Source #

Show TraceOptionForwarder Source # 
Instance details

Defined in Cardano.Logging.Types

Eq TraceOptionForwarder Source # 
Instance details

Defined in Cardano.Logging.Types

Ord TraceOptionForwarder Source # 
Instance details

Defined in Cardano.Logging.Types

type Rep TraceOptionForwarder Source # 
Instance details

Defined in Cardano.Logging.Types

type Rep TraceOptionForwarder = D1 ('MetaData "TraceOptionForwarder" "Cardano.Logging.Types" "trace-dispatcher-2.5.2-inplace" 'False) (C1 ('MetaCons "TraceOptionForwarder" 'PrefixI 'True) (S1 ('MetaSel ('Just "tofConnQueueSize") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: (S1 ('MetaSel ('Just "tofDisconnQueueSize") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: S1 ('MetaSel ('Just "tofVerbosity") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Verbosity))))

data TraceConfig Source #

Constructors

TraceConfig 

Fields

data TraceControl where Source #

When configuring a net of tracers, it should be run with Config on all entry points first, and then with TCOptimize. When reconfiguring it needs to run TCReset followed by Config followed by TCOptimize

newtype DocCollector Source #

Constructors

DocCollector (IORef (Map Int LogDoc)) 

data LogDoc Source #

Instances

Instances details
Show LogDoc Source # 
Instance details

Defined in Cardano.Logging.Types

Eq LogDoc Source # 
Instance details

Defined in Cardano.Logging.Types

data BackendConfig Source #

 

Instances

Instances details
FromJSON BackendConfig Source # 
Instance details

Defined in Cardano.Logging.Types

ToJSON BackendConfig Source # 
Instance details

Defined in Cardano.Logging.Types

Generic BackendConfig Source # 
Instance details

Defined in Cardano.Logging.Types

Associated Types

type Rep BackendConfig :: Type -> Type Source #

Show BackendConfig Source # 
Instance details

Defined in Cardano.Logging.Types

Eq BackendConfig Source # 
Instance details

Defined in Cardano.Logging.Types

Ord BackendConfig Source # 
Instance details

Defined in Cardano.Logging.Types

type Rep BackendConfig Source # 
Instance details

Defined in Cardano.Logging.Types

type Rep BackendConfig = D1 ('MetaData "BackendConfig" "Cardano.Logging.Types" "trace-dispatcher-2.5.2-inplace" 'False) ((C1 ('MetaCons "Forwarder" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Stdout" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FormatLogging))) :+: (C1 ('MetaCons "EKGBackend" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DatapointBackend" 'PrefixI 'False) (U1 :: Type -> Type)))

newtype Folding a b Source #

Type for the function foldTraceM from module CardanoLoggingTrace

Constructors

Folding b 

Instances

Instances details
LogFormatting b => LogFormatting (Folding a b) Source # 
Instance details

Defined in Cardano.Logging.Types

data PreFormatted a Source #

Constructors

PreFormatted 

Fields

traceWith :: Monad m => Trace m a -> a -> m () Source #

Adds a message object to a trace

unfold :: Folding a b -> b Source #

runTracer :: Tracer m a -> TracerA m a () Source #

contramapM :: Monad m => Trace m b -> ((LoggingContext, Either TraceControl a) -> m (LoggingContext, Either TraceControl b)) -> m (Trace m a) Source #

Contramap a monadic function over a trace

natTracer :: forall m n s. (forall x. m x -> n x) -> Tracer m s -> Tracer n s Source #

Use a natural transformation to change the m type. This is useful, for instance, to use concrete IO tracers in monad transformer stacks that have IO as their base.

stdoutTracer :: Tracer IO String Source #

Trace strings to stdout. Output could be jumbled when this is used from multiple threads. Consider debugTracer instead.

debugTracer :: Applicative m => Tracer m String Source #

Trace strings using traceM. This will use stderr. See documentation in Debug.Trace for more details.

uncurry3 :: (a -> b -> c -> d) -> (a, b, c) -> d Source #

Converts a curried function to a function on a triple.

arrow :: TracerA m a () -> Tracer m a Source #

Inverse of use.

configureTracers :: forall a m. (MetaTrace a, MonadIO m) => ConfigReflection -> TraceConfig -> [Trace m a] -> m () Source #

Call this function at initialisation, and later for reconfiguration. Config reflection is used to optimise the tracers and has to collect information about the tracers. Although it is possible to give more then one tracer of the same time, it is not a common case to do this.

withNamespaceConfig :: forall m a b c. (MonadIO m, Ord b) => String -> (TraceConfig -> Namespace a -> m b) -> (Maybe b -> Trace m c -> m (Trace m a)) -> Trace m c -> m (Trace m a) Source #

Take a selector function called extract. Take a function from trace to trace with this config dependent value. In this way construct a trace transformer with a config value

filterSeverityFromConfig :: MonadIO m => Trace m a -> m (Trace m a) Source #

Filter a trace by severity and take the filter value from the config

withDetailsFromConfig :: MonadIO m => Trace m a -> m (Trace m a) Source #

Set detail level of a trace from the config

withBackendsFromConfig :: MonadIO m => (Maybe [BackendConfig] -> Trace m FormattedMessage -> m (Trace m a)) -> m (Trace m a) Source #

Routing and formatting of a trace from the config

withLimitersFromConfig :: forall a m. MonadUnliftIO m => Trace m TraceDispatcherMessage -> Trace m a -> m (Trace m a) Source #

Routing and formatting of a trace from the config

maybeSilent :: forall m a. MonadIO m => (TraceConfig -> Namespace a -> Bool) -> [Text] -> Bool -> Trace m a -> m (Trace m a) Source #

Switch off any message of a particular tracer based on the configuration. If the top tracer is silent and no subtracer is not silent, then switch it off

getSeverity :: TraceConfig -> Namespace a -> SeverityF Source #

If no severity can be found in the config, it is set to Warning

getDetails :: TraceConfig -> Namespace a -> DetailLevel Source #

If no details can be found in the config, it is set to DNormal

getBackends :: TraceConfig -> Namespace a -> [BackendConfig] Source #

If no backends can be found in the config, it is set to [EKGBackend, Forwarder, Stdout HumanFormatColoured]

addFiltered :: MonadIO m => TraceControl -> Maybe SeverityF -> m () Source #

Callback for doc collection

addLimiter :: MonadIO m => TraceControl -> (Text, Double) -> m () Source #

Callback for doc collection

limitFrequency :: forall a m. MonadUnliftIO m => Double -> Text -> Trace m TraceDispatcherMessage -> Trace m a -> m (Trace m a) Source #

Limits the frequency of messages to nMsg which is given per minute.

If the limiter detects more messages, it traces randomly selected messages with the given frequency on the vtracer until the frequency falls under the threshold long enough.(see below)

Before this the ltracer gets a StartLimiting message. In-between you receive ContinueLimiting messages on the ltracer every reminderPeriod seconds, with the number of suppressed messages. Finally it sends a StopLimiting message on the ltracer and traces all messages on the vtracer again.

A budget is used to decide when to start limiting and stop limiting, so that the limiter does not get activated if few messages are send in high frequency, and doesn't get deactivated if their are only few messages which come with low frequency. When messages arrive in shorter frequency then by the given thresholdFrequency budget is earned, and if they arrive in a longer period budget is spend. If budget is gets higher then budgetLimit, the limiter starts, and if it falls below minus budgetLimit the limiter stops.

readConfiguration :: FilePath -> IO TraceConfig Source #

Read a configuration file and returns the internal representation

readConfigurationWithDefault :: FilePath -> TraceConfig -> IO TraceConfig Source #

Read a configuration file and returns the internal representation Uses values which are not in the file fram the defaultConfig

configToRepresentation :: TraceConfig -> ConfigRepresentation Source #

Convert from internal to external representation

checkTraceConfiguration :: FilePath -> TraceConfig -> [([Text], [Text])] -> IO NSWarnings Source #

Checks if all namespaces in this configuration are legal. Legal in this case means that it can be found by a hierarchcical lookup in all namespaces. Warns if namespaces in all namespaces are not unique, Warns if namespaces in all namespaces are ending in the middle of another namespace. The namespaces in allNamespaces are consistent with the namespaces for the severityFor, privacyFor, detailsFor, documentFor and metricsDofFor functions.

documentTracer' :: forall a a1. MetaTrace a => (Trace IO a1 -> IO (Trace IO a)) -> Trace IO a1 -> IO DocTracer Source #

docIt :: MonadIO m => BackendConfig -> (LoggingContext, Either TraceControl a) -> m () Source #

Callback for doc collection

addDocumentedNamespace :: [Text] -> Documented a -> Documented a Source #

Convenience function for adding a namespace prefix to a documented

metricsFormatter :: forall a m. (LogFormatting a, MonadIO m) => Trace m FormattedMessage -> Trace m a Source #

Format this trace as metrics

preFormatted :: (LogFormatting a, MonadIO m) => [BackendConfig] -> Trace m (PreFormatted a) -> m (Trace m a) Source #

Transform this trace to a preformatted message, so that double serialization is avoided

forwardFormatter' :: forall a m. MonadIO m => Maybe Text -> Trace m FormattedMessage -> Trace m (PreFormatted a) Source #

Format this trace as TraceObject for the trace forwarder

machineFormatter' :: forall a m. MonadIO m => Maybe Text -> Trace m FormattedMessage -> Trace m (PreFormatted a) Source #

Format this trace as TraceObject for the trace forwarder

humanFormatter :: forall a m. MonadIO m => LogFormatting a => Bool -> Maybe Text -> Trace m FormattedMessage -> m (Trace m a) Source #

humanFormatter' :: forall a m. MonadIO m => Bool -> Maybe Text -> Trace m FormattedMessage -> Trace m (PreFormatted a) Source #

Format this trace in human readable style

showT :: Show a => a -> Text Source #

Convenience function for a Show instance to be converted to text immediately

runInLoop :: IO () -> FilePath -> Word -> IO () Source #

Run monadic action in a loop. If there's an exception, it will re-run the action again, after pause that grows.

withLoggingContext :: Monad m => LoggingContext -> Trace m a -> Trace m a Source #

Sets a new logging context for this message

filterTrace :: Monad m => ((LoggingContext, a) -> Bool) -> Trace m a -> Trace m a Source #

setSeverity :: Monad m => SeverityS -> Trace m a -> Trace m a Source #

Sets severity for the messages in this trace

withSeverity :: forall m a. (Monad m, MetaTrace a) => Trace m a -> Trace m a Source #

Sets severities for the messages in this trace based on the MetaTrace class

privately :: Monad m => Trace m a -> Trace m a Source #

Sets privacy Confidential for the messages in this trace

setPrivacy :: Monad m => Privacy -> Trace m a -> Trace m a Source #

Sets privacy for the messages in this trace

withPrivacy :: forall m a. (Monad m, MetaTrace a) => Trace m a -> Trace m a Source #

Sets privacy for the messages in this trace based on the MetaTrace class

setDetails :: Monad m => DetailLevel -> Trace m a -> Trace m a Source #

Sets detail level for the messages in this trace

withDetails :: forall m a. (Monad m, MetaTrace a) => Trace m a -> Trace m a Source #

Sets detail level for the messages in this trace based on the message

contramapMCond :: Monad m => Trace m b -> ((LoggingContext, Either TraceControl a) -> m (Maybe (LoggingContext, Either TraceControl b))) -> m (Trace m a) Source #

Contramap a monadic function over a trace Can as well filter out messages

foldTraceM :: forall a acc m. MonadUnliftIO m => (acc -> LoggingContext -> a -> m acc) -> acc -> Trace m (Folding a acc) -> m (Trace m a) Source #

Folds the monadic cata function with acc over a. Uses an MVar to store the state

foldCondTraceM :: forall a acc m. MonadUnliftIO m => (acc -> LoggingContext -> a -> m acc) -> acc -> (a -> Bool) -> Trace m (Folding a acc) -> m (Trace m a) Source #

Like foldTraceM, but filter the trace by a predicate.

routingTrace :: forall m a. Monad m => (a -> m (Trace m a)) -> Trace m a -> Trace m a Source #

Allows to route to different tracers, based on the message being processed. The second argument must mappend all possible tracers of the first argument to one tracer. This is required for the configuration!

withNames :: forall m a. (Monad m, MetaTrace a) => [Text] -> Trace m a -> Trace m a Source #

Sets names for the messages in this trace based on the selector function and appends the provided names to the context.

appendPrefixName :: Monad m => Text -> Trace m a -> Trace m a Source #

Appends a name to the context. E.g. appendName "specific" $ appendName "middle" $ appendName "general" tracer give the result: `general.middle.specific`.

appendPrefixNames :: Monad m => [Text] -> Trace m a -> Trace m a Source #

Appends all names to the context.

appendInnerName :: Monad m => Text -> Trace m a -> Trace m a Source #

appendInnerNames :: Monad m => [Text] -> Trace m a -> Trace m a Source #

Appends all names to the context.

withInnerNames :: forall m a. (Monad m, MetaTrace a) => Trace m a -> Trace m a Source #

Sets names for the messages in this trace based on the selector function

mkDataPointTracer :: forall dp. (ToJSON dp, MetaTrace dp, NFData dp) => Trace IO DataPoint -> IO (Trace IO dp) Source #

ekgTracer :: MonadIO m => Either Store Server -> m (Trace m FormattedMessage) Source #

It is mandatory to construct only one standard tracer in any application! Throwing away a standard tracer and using a new one will result in an exception

standardTracer :: forall m. MonadIO m => m (Trace m FormattedMessage) Source #

It is mandatory to construct only one standard tracer in any application! Throwing away a standard tracer and using a new one will result in an exception

forwardTracer :: forall m. MonadIO m => ForwardSink TraceObject -> Trace m FormattedMessage Source #

It is mandatory to construct only one forwardTracer tracer in any application! Throwing away a forwardTracer tracer and using a new one will result in an exception

mkCardanoTracer :: forall evt. (LogFormatting evt, MetaTrace evt) => Trace IO FormattedMessage -> Trace IO FormattedMessage -> Maybe (Trace IO FormattedMessage) -> [Text] -> IO (Trace IO evt) Source #

Construct a tracer according to the requirements for cardano node. The tracer gets a name, which is appended to its namespace. The tracer has to be an instance of LogFormatting for the display of messages and an instance of MetaTrace for meta information such as severity, privacy, details and backends'. The tracer gets the backends': trStdout, trForward and mbTrEkg as arguments. The returned tracer needs to be configured with a configuration before it is used.

mkCardanoTracer' :: forall evt evt1. (LogFormatting evt1, MetaTrace evt1) => Trace IO FormattedMessage -> Trace IO FormattedMessage -> Maybe (Trace IO FormattedMessage) -> [Text] -> (Trace IO evt1 -> IO (Trace IO evt)) -> IO (Trace IO evt) Source #

Adds the possibility to add special tracers via the hook function

emptyObject :: HashMap Text a Source #

A helper function for creating an empty |Object|.

showTHex :: (Integral a, Show a) => a -> Text Source #

Convenience function for a showHex call converted to text immediately

emit :: Applicative m => (a -> m ()) -> TracerA m a () Source #

Do an emitting effect. Contrast with effect which does not make the tracer an emitting tracer.

effect :: (a -> m b) -> TracerA m a b Source #

Do a non-emitting effect. This effect will only be run if some part of the tracer downstream emits (see emit).

squelch :: Applicative m => TracerA m a () Source #

Ignore the input and do not emit. The name is intended to lead to clear and suggestive arrow expressions.

nat :: (forall x. m x -> n x) -> TracerA m a b -> TracerA n a b Source #

Use a natural transformation to change the underlying monad.

use :: Tracer m a -> TracerA m a () Source #

Inverse of arrow. Useful when writing arrow tracers which use a contravariant tracer (the newtype in this module).

traceMaybe :: Monad m => (a -> Maybe b) -> Tracer m b -> Tracer m a Source #

Run a tracer only for the Just variant of a Maybe. If it's Nothing, the nullTracer is used (no output).

The arrow representation allows for proper laziness: if the tracer parameter does not produce any tracing effects, then the predicate won't even be evaluated. Contrast with the simple contravariant representation as a -> m (), in which the predicate _must_ be forced no matter what, because it's impossible to know a priori whether that function will not produce any tracing effects.

It's written out explicitly for demonstration. Could also use arrow notation:

traceMaybe p tr = Tracer $ proc a -> do
  case k a of
    Just b  -> use tr        -< b
    Nothing -> Arrow.squelch -< ()

squelchUnless :: Monad m => (a -> Bool) -> Tracer m a -> Tracer m a Source #

Uses traceMaybe to give a tracer which emits only if a predicate is true.