Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- newtype Trace m a = Trace {
- unpackTrace :: Tracer m (LoggingContext, Either TraceControl a)
- class LogFormatting a where
- forMachine :: DetailLevel -> a -> Object
- forHuman :: a -> Text
- forHumanOrMachine :: a -> Text
- asMetrics :: a -> [Metric]
- data Metric
- getMetricName :: Metric -> Text
- emptyObject :: HashMap Text a
- newtype Documented a = Documented {}
- data DocMsg a = DocMsg {
- dmNamespace :: Namespace a
- dmMetricsMD :: [(Text, Text)]
- dmMarkdown :: Text
- data LoggingContext = LoggingContext {
- lcNSInner :: [Text]
- lcNSPrefix :: [Text]
- lcSeverity :: Maybe SeverityS
- lcPrivacy :: Maybe Privacy
- lcDetails :: Maybe DetailLevel
- emptyLoggingContext :: LoggingContext
- data Namespace a = Namespace {}
- nsReplacePrefix :: [Text] -> Namespace a -> Namespace a
- nsReplaceInner :: [Text] -> Namespace a -> Namespace a
- nsCast :: Namespace a -> Namespace b
- nsPrependInner :: Text -> Namespace a -> Namespace b
- nsGetComplete :: Namespace a -> [Text]
- nsGetTuple :: Namespace a -> ([Text], [Text])
- nsRawToText :: ([Text], [Text]) -> Text
- nsToText :: Namespace a -> Text
- class MetaTrace a where
- namespaceFor :: a -> Namespace a
- severityFor :: Namespace a -> Maybe a -> Maybe SeverityS
- privacyFor :: Namespace a -> Maybe a -> Maybe Privacy
- detailsFor :: Namespace a -> Maybe a -> Maybe DetailLevel
- documentFor :: Namespace a -> Maybe Text
- metricsDocFor :: Namespace a -> [(Text, Text)]
- allNamespaces :: [Namespace a]
- data DetailLevel
- data Privacy
- data SeverityS
- newtype SeverityF = SeverityF (Maybe SeverityS)
- data ConfigOption
- = ConfSeverity { }
- | ConfDetail { }
- | ConfBackend {
- backends :: [BackendConfig]
- | ConfLimiter { }
- newtype ForwarderAddr = LocalSocket FilePath
- data FormatLogging
- data ForwarderMode
- data Verbosity
- data TraceOptionForwarder = TraceOptionForwarder {}
- defaultForwarder :: TraceOptionForwarder
- data ConfigReflection = ConfigReflection {}
- emptyConfigReflection :: IO ConfigReflection
- data TraceConfig = TraceConfig {}
- emptyTraceConfig :: TraceConfig
- data FormattedMessage
- data TraceControl where
- TCReset :: TraceControl
- TCConfig :: TraceConfig -> TraceControl
- TCOptimize :: ConfigReflection -> TraceControl
- TCDocument :: Int -> DocCollector -> TraceControl
- newtype DocCollector = DocCollector (IORef (Map Int LogDoc))
- data LogDoc = LogDoc {
- ldDoc :: !Text
- ldMetricsDoc :: !(Map Text Text)
- ldNamespace :: ![([Text], [Text])]
- ldSeverityCoded :: !(Maybe SeverityS)
- ldPrivacyCoded :: !(Maybe Privacy)
- ldDetailsCoded :: !(Maybe DetailLevel)
- ldDetails :: ![DetailLevel]
- ldBackends :: ![BackendConfig]
- ldFiltered :: ![SeverityF]
- ldLimiter :: ![(Text, Double)]
- ldSilent :: Bool
- emptyLogDoc :: Text -> [(Text, Text)] -> LogDoc
- data BackendConfig
- newtype Folding a b = Folding b
- unfold :: Folding a b -> b
- data TraceObject = TraceObject {
- toHuman :: !(Maybe Text)
- toMachine :: !Text
- toNamespace :: ![Text]
- toSeverity :: !SeverityS
- toDetails :: !DetailLevel
- toTimestamp :: !UTCTime
- toHostname :: !HostName
- toThreadId :: !Text
- data PreFormatted a = PreFormatted {
- pfMessage :: !a
- pfForHuman :: !(Maybe Text)
- pfForMachine :: !(KeyMap Value)
- pfNamespace :: ![Text]
- pfTimestamp :: !Text
- pfTime :: !UTCTime
- pfHostname :: !HostName
- pfThreadId :: !Text
Documentation
The Trace carries the underlying tracer Tracer from the contra-tracer package.
It adds a LoggingContext
and maybe a TraceControl
to every message.
Trace | |
|
class LogFormatting a where Source #
Every message needs this to define how to represent itself
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
Instances
LogFormatting TraceDispatcherMessage Source # | |
Defined in Cardano.Logging.TraceDispatcherMessage | |
LogFormatting b => LogFormatting (Folding a b) Source # | |
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 |
getMetricName :: Metric -> Text Source #
emptyObject :: HashMap Text a Source #
A helper function for creating an empty |Object|.
newtype Documented a Source #
Instances
Semigroup (Documented a) Source # | |
Defined in Cardano.Logging.Types (<>) :: Documented a -> Documented a -> Documented a Source # sconcat :: NonEmpty (Documented a) -> Documented a Source # stimes :: Integral b => b -> Documented a -> Documented a Source # | |
Show (Documented a) Source # | |
Defined in Cardano.Logging.Types |
Document a message by giving a prototype, its most special name in the namespace and a comment in markdown format
DocMsg | |
|
data LoggingContext Source #
Context any log message carries
LoggingContext | |
|
Instances
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
nsGetComplete :: Namespace a -> [Text] Source #
class MetaTrace a where Source #
namespaceFor :: a -> Namespace a Source #
severityFor :: Namespace a -> Maybe a -> Maybe SeverityS Source #
privacyFor :: Namespace a -> Maybe a -> Maybe Privacy Source #
detailsFor :: Namespace a -> Maybe a -> Maybe DetailLevel Source #
documentFor :: Namespace a -> Maybe Text Source #
metricsDocFor :: Namespace a -> [(Text, Text)] Source #
allNamespaces :: [Namespace a] Source #
Instances
data DetailLevel Source #
Formerly known as verbosity
Instances
Privacy of a message. Default is Public
Confidential | confidential information - handle with care |
Public | can be public. |
Instances
Bounded Privacy Source # | |
Enum Privacy Source # | |
Defined in Cardano.Logging.Types succ :: Privacy -> Privacy Source # pred :: Privacy -> Privacy Source # toEnum :: Int -> Privacy Source # fromEnum :: Privacy -> Int Source # enumFrom :: Privacy -> [Privacy] Source # enumFromThen :: Privacy -> Privacy -> [Privacy] Source # enumFromTo :: Privacy -> Privacy -> [Privacy] Source # enumFromThenTo :: Privacy -> Privacy -> Privacy -> [Privacy] Source # | |
Generic Privacy Source # | |
Show Privacy Source # | |
Eq Privacy Source # | |
Ord Privacy Source # | |
Serialise Privacy Source # | |
type Rep Privacy Source # | |
Severity of a message
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
Severity for a filter Nothing means don't show anything (Silence) Nothing level means show messages with severity >= level
Instances
FromJSON SeverityF Source # | |
Defined in Cardano.Logging.Types | |
ToJSON SeverityF Source # | |
Defined in Cardano.Logging.Types | |
Enum SeverityF Source # | |
Defined in Cardano.Logging.Types succ :: SeverityF -> SeverityF Source # pred :: SeverityF -> SeverityF Source # toEnum :: Int -> SeverityF Source # fromEnum :: SeverityF -> Int Source # enumFrom :: SeverityF -> [SeverityF] Source # enumFromThen :: SeverityF -> SeverityF -> [SeverityF] Source # enumFromTo :: SeverityF -> SeverityF -> [SeverityF] Source # enumFromThenTo :: SeverityF -> SeverityF -> SeverityF -> [SeverityF] Source # | |
Show SeverityF Source # | |
Eq SeverityF Source # | |
Ord SeverityF Source # | |
Defined in Cardano.Logging.Types |
data ConfigOption Source #
ConfSeverity | Severity level for a filter (default is Warning) |
ConfDetail | Detail level (default is DNormal) |
ConfBackend | To which backend to pass Default is [EKGBackend, Forwarder, Stdout MachineFormat] |
| |
ConfLimiter | Construct a limiter with limiting to the Double, which represents frequency in number of messages per second |
Instances
newtype ForwarderAddr Source #
Instances
FromJSON ForwarderAddr Source # | |
Defined in Cardano.Logging.Types parseJSON :: Value -> Parser ForwarderAddr # parseJSONList :: Value -> Parser [ForwarderAddr] # | |
Show ForwarderAddr Source # | |
Defined in Cardano.Logging.Types | |
Eq ForwarderAddr Source # | |
Defined in Cardano.Logging.Types (==) :: ForwarderAddr -> ForwarderAddr -> Bool Source # (/=) :: ForwarderAddr -> ForwarderAddr -> Bool Source # | |
Ord ForwarderAddr Source # | |
Defined in Cardano.Logging.Types compare :: ForwarderAddr -> ForwarderAddr -> Ordering Source # (<) :: ForwarderAddr -> ForwarderAddr -> Bool Source # (<=) :: ForwarderAddr -> ForwarderAddr -> Bool Source # (>) :: ForwarderAddr -> ForwarderAddr -> Bool Source # (>=) :: ForwarderAddr -> ForwarderAddr -> Bool Source # max :: ForwarderAddr -> ForwarderAddr -> ForwarderAddr Source # min :: ForwarderAddr -> ForwarderAddr -> ForwarderAddr Source # |
data FormatLogging Source #
Instances
Show FormatLogging Source # | |
Defined in Cardano.Logging.Types | |
Eq FormatLogging Source # | |
Defined in Cardano.Logging.Types (==) :: FormatLogging -> FormatLogging -> Bool Source # (/=) :: FormatLogging -> FormatLogging -> Bool Source # | |
Ord FormatLogging Source # | |
Defined in Cardano.Logging.Types compare :: FormatLogging -> FormatLogging -> Ordering Source # (<) :: FormatLogging -> FormatLogging -> Bool Source # (<=) :: FormatLogging -> FormatLogging -> Bool Source # (>) :: FormatLogging -> FormatLogging -> Bool Source # (>=) :: FormatLogging -> FormatLogging -> Bool Source # max :: FormatLogging -> FormatLogging -> FormatLogging Source # min :: FormatLogging -> FormatLogging -> FormatLogging Source # |
data ForwarderMode Source #
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
Maximum | Maximum verbosity for all tracers in the forwarding protocols. |
Minimum | Minimum verbosity, the forwarding will work as silently as possible. |
Instances
FromJSON Verbosity Source # | |
Defined in Cardano.Logging.Types | |
ToJSON Verbosity Source # | |
Defined in Cardano.Logging.Types | |
Generic Verbosity Source # | |
Show Verbosity Source # | |
Eq Verbosity Source # | |
Ord Verbosity Source # | |
Defined in Cardano.Logging.Types | |
type Rep Verbosity Source # | |
data TraceOptionForwarder Source #
Instances
data TraceConfig Source #
TraceConfig | |
|
Instances
ToJSON TraceConfig Source # | |
Defined in Cardano.Logging.ConfigurationParser toJSON :: TraceConfig -> Value # toEncoding :: TraceConfig -> Encoding # toJSONList :: [TraceConfig] -> Value # toEncodingList :: [TraceConfig] -> Encoding # omitField :: TraceConfig -> Bool # | |
Show TraceConfig Source # | |
Defined in Cardano.Logging.Types | |
Eq TraceConfig Source # | |
Defined in Cardano.Logging.Types (==) :: TraceConfig -> TraceConfig -> Bool Source # (/=) :: TraceConfig -> TraceConfig -> Bool Source # | |
Ord TraceConfig Source # | |
Defined in Cardano.Logging.Types compare :: TraceConfig -> TraceConfig -> Ordering Source # (<) :: TraceConfig -> TraceConfig -> Bool Source # (<=) :: TraceConfig -> TraceConfig -> Bool Source # (>) :: TraceConfig -> TraceConfig -> Bool Source # (>=) :: TraceConfig -> TraceConfig -> Bool Source # max :: TraceConfig -> TraceConfig -> TraceConfig Source # min :: TraceConfig -> TraceConfig -> TraceConfig Source # |
data FormattedMessage Source #
FormattedHuman Bool Text | The bool specifies if the formatting includes colours |
FormattedMachine Text | |
FormattedMetrics [Metric] | |
FormattedForwarder TraceObject |
Instances
Show FormattedMessage Source # | |
Defined in Cardano.Logging.Types | |
Eq FormattedMessage Source # | |
Defined in Cardano.Logging.Types (==) :: FormattedMessage -> FormattedMessage -> Bool Source # (/=) :: FormattedMessage -> FormattedMessage -> Bool Source # |
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
TCReset :: TraceControl | |
TCConfig :: TraceConfig -> TraceControl | |
TCOptimize :: ConfigReflection -> TraceControl | |
TCDocument :: Int -> DocCollector -> TraceControl |
newtype DocCollector Source #
DocCollector (IORef (Map Int LogDoc)) |
LogDoc | |
|
data BackendConfig Source #
Instances
Type for the function foldTraceM from module CardanoLoggingTrace
Folding b |
Instances
LogFormatting b => LogFormatting (Folding a b) Source # | |
data TraceObject Source #
Used as interface object for ForwarderTracer
TraceObject | |
|
Instances
data PreFormatted a Source #
PreFormatted | |
|