Safe Haskell | None |
---|---|
Language | Haskell2010 |
Cardano.BM.Tracing
Synopsis
- newtype Tracer (m :: Type -> Type) a = Tracer {
- runTracer :: a -> m ()
- type Trace m a = Tracer m (LoggerName, LogObject a)
- data LogObject a = LogObject {}
- data PrivacyAnnotation
- data Severity
- class Monad m => ToLogObject m where
- toLogObject :: (ToObject a, Transformable a m b) => Trace m a -> Tracer m b
- toLogObject' :: (ToObject a, Transformable a m b) => TracingVerbosity -> Trace m a -> Tracer m b
- toLogObjectVerbose :: (ToObject a, Transformable a m b) => Trace m a -> Tracer m b
- toLogObjectMinimal :: (ToObject a, Transformable a m b) => Trace m a -> Tracer m b
- class ToObject a where
- toObject :: TracingVerbosity -> a -> Object
- textTransformer :: a -> Object -> Text
- class (Monad m, HasPrivacyAnnotation b, HasSeverityAnnotation b) => Transformable a m b where
- trTransformer :: TracingVerbosity -> Trace m a -> Tracer m b
- class HasPrivacyAnnotation a where
- class HasSeverityAnnotation a where
- getSeverityAnnotation :: a -> Severity
- data TracingVerbosity
- appendName :: LoggerName -> Trace m a -> Trace m a
- contramap :: Contravariant f => (a -> b) -> f b -> f a
- defaultConfigStdout :: IO Configuration
- defaultConfigTesting :: IO Configuration
- mkLOMeta :: MonadIO m => Severity -> PrivacyAnnotation -> m LOMeta
- nullTracer :: forall (m :: Type -> Type) a. Applicative m => Tracer m a
- setupTrace :: (MonadIO m, ToJSON a, FromJSON a, ToObject a) => Either FilePath Configuration -> Text -> m (Trace m a)
- traceWith :: Tracer m a -> a -> m ()
Documentation
newtype Tracer (m :: Type -> Type) a Source #
example: simply output a message on the console
let logTrace = traceWith $ showTracing $ stdoutTracer in logTrace "hello world"
example: calling a function and passing in a Tracer
example1 :: IO () example1 = do let logTrace a = traceWith (showTracing (contramap ("Debug: " ++) stdoutTracer)) a void $ callFun1 logTrace
callFun1 :: (String -> IO ()) -> IO Int callFun1 logTrace = do logTrace "in function 1" return 42
Instances
Contravariant (Tracer m) | |
Applicative m => Divisible (Tracer m) Source # | |
Applicative m => Decidable (Tracer m) Source # | |
Applicative m => Semigroup (Tracer m s) | |
Applicative m => Monoid (Tracer m s) | |
Instances
Functor LogObject Source # | |
Eq a => Eq (LogObject a) Source # | |
Show a => Show (LogObject a) Source # | |
ToJSON a => ToJSON (LogObject a) Source # | |
FromJSON a => FromJSON (LogObject a) Source # | |
ToJSON a => ToObject (LogObject a) Source # | |
ToJSON a => LogItem (LogObject a) Source # | |
Defined in Cardano.BM.Backend.Log Methods payloadKeys :: Verbosity -> LogObject a -> PayloadSelection Source # | |
ToJSON a => ToObject (LogObject a) Source # | |
Defined in Cardano.BM.Data.Tracer |
data PrivacyAnnotation Source #
Constructors
Confidential | |
Public |
Instances
Instances
class Monad m => ToLogObject m where Source #
Minimal complete definition
Methods
toLogObject :: (ToObject a, Transformable a m b) => Trace m a -> Tracer m b Source #
toLogObject' :: (ToObject a, Transformable a m b) => TracingVerbosity -> Trace m a -> Tracer m b Source #
toLogObjectVerbose :: (ToObject a, Transformable a m b) => Trace m a -> Tracer m b Source #
default toLogObjectVerbose :: (ToObject a, Transformable a m b) => Trace m a -> Tracer m b Source #
toLogObjectMinimal :: (ToObject a, Transformable a m b) => Trace m a -> Tracer m b Source #
default toLogObjectMinimal :: (ToObject a, Transformable a m b) => Trace m a -> Tracer m b Source #
Instances
ToLogObject IO Source # | |
Defined in Cardano.BM.Data.Tracer Methods toLogObject :: (ToObject a, Transformable a IO b) => Trace IO a -> Tracer IO b Source # toLogObject' :: (ToObject a, Transformable a IO b) => TracingVerbosity -> Trace IO a -> Tracer IO b Source # toLogObjectVerbose :: (ToObject a, Transformable a IO b) => Trace IO a -> Tracer IO b Source # toLogObjectMinimal :: (ToObject a, Transformable a IO b) => Trace IO a -> Tracer IO b Source # |
class ToObject a where Source #
Minimal complete definition
Nothing
Methods
toObject :: TracingVerbosity -> a -> Object Source #
textTransformer :: a -> Object -> Text Source #
default textTransformer :: a -> Object -> Text Source #
Instances
ToObject () Source # | |
Defined in Cardano.BM.Data.Tracer Methods toObject :: TracingVerbosity -> () -> Object Source # textTransformer :: () -> Object -> Text Source # | |
ToObject String Source # | |
Defined in Cardano.BM.Data.Tracer | |
ToObject Text Source # | |
Defined in Cardano.BM.Data.Tracer | |
ToObject Value Source # | |
Defined in Cardano.BM.Data.Tracer | |
ToJSON a => ToObject (LOContent a) Source # | |
Defined in Cardano.BM.Data.Tracer | |
ToJSON a => ToObject (LogObject a) Source # | |
Defined in Cardano.BM.Data.Tracer |
class (Monad m, HasPrivacyAnnotation b, HasSeverityAnnotation b) => Transformable a m b where Source #
Minimal complete definition
Nothing
Methods
trTransformer :: TracingVerbosity -> Trace m a -> Tracer m b Source #
default trTransformer :: TracingVerbosity -> Trace m a -> Tracer m b Source #
Instances
class HasPrivacyAnnotation a where Source #
Minimal complete definition
Nothing
Methods
getPrivacyAnnotation :: a -> PrivacyAnnotation Source #
default getPrivacyAnnotation :: a -> PrivacyAnnotation Source #
Instances
class HasSeverityAnnotation a where Source #
Minimal complete definition
Nothing
Methods
getSeverityAnnotation :: a -> Severity Source #
default getSeverityAnnotation :: a -> Severity Source #
Instances
HasSeverityAnnotation Double Source # | |
Defined in Cardano.BM.Data.Tracer Methods | |
HasSeverityAnnotation Float Source # | |
Defined in Cardano.BM.Data.Tracer Methods | |
HasSeverityAnnotation Int Source # | |
Defined in Cardano.BM.Data.Tracer Methods getSeverityAnnotation :: Int -> Severity Source # | |
HasSeverityAnnotation Integer Source # | |
Defined in Cardano.BM.Data.Tracer Methods | |
HasSeverityAnnotation Word64 Source # | |
Defined in Cardano.BM.Data.Tracer Methods | |
HasSeverityAnnotation String Source # | |
Defined in Cardano.BM.Data.Tracer Methods | |
HasSeverityAnnotation Text Source # | |
Defined in Cardano.BM.Data.Tracer Methods getSeverityAnnotation :: Text -> Severity Source # | |
HasSeverityAnnotation a => HasSeverityAnnotation (WithPrivacyAnnotation a) Source # | |
Defined in Cardano.BM.Data.Tracer Methods getSeverityAnnotation :: WithPrivacyAnnotation a -> Severity Source # | |
HasSeverityAnnotation (WithSeverity a) Source # | |
Defined in Cardano.BM.Data.Tracer Methods getSeverityAnnotation :: WithSeverity a -> Severity Source # |
data TracingVerbosity Source #
Constructors
MinimalVerbosity | |
NormalVerbosity | |
MaximalVerbosity |
Instances
Eq TracingVerbosity Source # | |
Defined in Cardano.BM.Data.Tracer Methods (==) :: TracingVerbosity -> TracingVerbosity -> Bool # (/=) :: TracingVerbosity -> TracingVerbosity -> Bool # | |
Ord TracingVerbosity Source # | |
Defined in Cardano.BM.Data.Tracer Methods compare :: TracingVerbosity -> TracingVerbosity -> Ordering # (<) :: TracingVerbosity -> TracingVerbosity -> Bool # (<=) :: TracingVerbosity -> TracingVerbosity -> Bool # (>) :: TracingVerbosity -> TracingVerbosity -> Bool # (>=) :: TracingVerbosity -> TracingVerbosity -> Bool # max :: TracingVerbosity -> TracingVerbosity -> TracingVerbosity # min :: TracingVerbosity -> TracingVerbosity -> TracingVerbosity # | |
Read TracingVerbosity Source # | |
Defined in Cardano.BM.Data.Tracer Methods readsPrec :: Int -> ReadS TracingVerbosity # readList :: ReadS [TracingVerbosity] # |
appendName :: LoggerName -> Trace m a -> Trace m a Source #
contramap :: Contravariant f => (a -> b) -> f b -> f a #
nullTracer :: forall (m :: Type -> Type) a. Applicative m => Tracer m a Source #
this Tracer
forgets about all arguments