| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Cardano.Logging.Types
Synopsis
- newtype Trace m a = Trace {
- unpackTrace :: Tracer m (LoggingContext, Either TraceControl a)
- class LogFormatting a where
- forMachine :: DetailLevel -> a -> Object
- forHuman :: 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
- = Forwarder
- | Stdout FormatLogging
- | EKGBackend
- | DatapointBackend
- | PrometheusSimple Bool (Maybe HostName) PortNumber
- 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 :: !Text
- toThreadId :: !Text
- data PreFormatted = PreFormatted {
- pfTime :: !UTCTime
- pfNamespace :: !Text
- pfThreadId :: !Text
- pfForHuman :: !(Maybe Text)
- pfForMachineObject :: Object
- data HowToConnect
- = LocalPipe !FilePath
- | RemoteSocket !Host !Port
Documentation
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 | |
Fields
| |
class LogFormatting a where Source #
Every message needs this to define how to represent itself
Minimal complete definition
Methods
forMachine :: DetailLevel -> a -> Object Source #
Machine readable representation with the possibility to represent with varying serialisations based on the detail level.
This will result in JSON formatted log output.
A forMachine implementation is required for any instance definition.
forHuman :: a -> Text Source #
Human-readable representation.
The empty text indicates there's no specific human-readable formatting for that type - this is the default implementation.
If however human-readble output is explicitly requested, e.g. by logs, the system will fall back to a JSON object
conforming to the forMachine definition, and rendering it as a value in `{"data": value}`.
Leaving out forHuman in some instance definition will not lead to loss of log information that way.
asMetrics :: a -> [Metric] Source #
Metrics representation. The default indicates that no metric is based on trace occurrences of that type.
Instances
| LogFormatting TracePrometheusSimple Source # | |
Defined in Cardano.Logging.Prometheus.TCPServer Methods forMachine :: DetailLevel -> TracePrometheusSimple -> Object Source # forHuman :: TracePrometheusSimple -> Text Source # asMetrics :: TracePrometheusSimple -> [Metric] Source # | |
| LogFormatting TraceDispatcherMessage Source # | |
Defined in Cardano.Logging.TraceDispatcherMessage Methods forMachine :: DetailLevel -> TraceDispatcherMessage -> Object Source # forHuman :: TraceDispatcherMessage -> Text Source # asMetrics :: TraceDispatcherMessage -> [Metric] Source # | |
| LogFormatting b => LogFormatting (Folding a b) 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 |
| PrometheusM Text [(Text, Text)] | A prometheus metric with key label pairs. Text is used to name the metric [(Text, Text)] is used to represent the key label pairs The value of the metric will always be "1" e.g. if you have a prometheus metric with the name "prometheus_metric" and the key label pairs [("key1", "value1"), ("key2", "value2")] the metric will be represented as "prometheus_metric{key1="value1",key2="value2"} 1" |
getMetricName :: Metric -> Text Source #
emptyObject :: HashMap Text a Source #
A helper function for creating an empty |Object|.
newtype Documented a Source #
Constructors
| Documented | |
Instances
| Semigroup (Documented a) Source # | |
Defined in Cardano.Logging.Types Methods (<>) :: 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
Constructors
| DocMsg | |
Fields
| |
data LoggingContext Source #
Context any log message carries
Constructors
| LoggingContext | |
Fields
| |
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 #
Minimal complete definition
Methods
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
Constructors
| Confidential | confidential information - handle with care |
| Public | can be public. |
Instances
| Bounded Privacy Source # | |
| Enum Privacy Source # | |
Defined in Cardano.Logging.Types Methods 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 # | |
Defined in Cardano.Logging.Types | |
| Serialise Privacy Source # | |
| type Rep Privacy 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
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 Methods 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 #
Constructors
| ConfSeverity | Severity level for a filter (default is Warning) |
| 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
newtype ForwarderAddr Source #
Constructors
| LocalSocket FilePath |
Instances
| FromJSON ForwarderAddr Source # | |
Defined in Cardano.Logging.Types Methods parseJSON :: Value -> Parser ForwarderAddr # parseJSONList :: Value -> Parser [ForwarderAddr] # | |
| Show ForwarderAddr Source # | |
Defined in Cardano.Logging.Types | |
| Eq ForwarderAddr Source # | |
Defined in Cardano.Logging.Types Methods (==) :: ForwarderAddr -> ForwarderAddr -> Bool Source # (/=) :: ForwarderAddr -> ForwarderAddr -> Bool Source # | |
| Ord ForwarderAddr Source # | |
Defined in Cardano.Logging.Types Methods 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 #
Constructors
| HumanFormatColoured | |
| HumanFormatUncoloured | |
| MachineFormat |
Instances
| Show FormatLogging Source # | |
Defined in Cardano.Logging.Types | |
| Eq FormatLogging Source # | |
Defined in Cardano.Logging.Types Methods (==) :: FormatLogging -> FormatLogging -> Bool Source # (/=) :: FormatLogging -> FormatLogging -> Bool Source # | |
| Ord FormatLogging Source # | |
Defined in Cardano.Logging.Types Methods 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 #
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
Constructors
| 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 #
Constructors
| TraceOptionForwarder | |
Fields | |
Instances
data TraceConfig Source #
Constructors
| TraceConfig | |
Fields
| |
Instances
| ToJSON TraceConfig Source # | |
Defined in Cardano.Logging.ConfigurationParser Methods 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 Methods (==) :: TraceConfig -> TraceConfig -> Bool Source # (/=) :: TraceConfig -> TraceConfig -> Bool Source # | |
| Ord TraceConfig Source # | |
Defined in Cardano.Logging.Types Methods 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 #
Constructors
| FormattedHuman Bool Text | The bool specifies if the formatting includes colours |
| FormattedMachine Text | |
| FormattedMetrics [Metric] | |
| FormattedForwarder TraceObject | |
| FormattedCBOR ByteString |
Instances
| Show FormattedMessage Source # | |
Defined in Cardano.Logging.Types | |
| Eq FormattedMessage Source # | |
Defined in Cardano.Logging.Types Methods (==) :: 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
Constructors
| TCReset :: TraceControl | |
| TCConfig :: TraceConfig -> TraceControl | |
| TCOptimize :: ConfigReflection -> TraceControl | |
| TCDocument :: Int -> DocCollector -> TraceControl |
newtype DocCollector Source #
Constructors
| DocCollector (IORef (Map Int LogDoc)) |
Constructors
| LogDoc | |
Fields
| |
data BackendConfig Source #
Constructors
| Forwarder | |
| Stdout FormatLogging | |
| EKGBackend | |
| DatapointBackend | |
| PrometheusSimple Bool (Maybe HostName) PortNumber |
Instances
Type for the function foldTraceM from module CardanoLoggingTrace
Constructors
| Folding b |
Instances
| LogFormatting b => LogFormatting (Folding a b) Source # | |
data TraceObject Source #
Used as interface object for ForwarderTracer
Constructors
| TraceObject | |
Fields
| |
Instances
data PreFormatted Source #
Constructors
| PreFormatted | |
Fields
| |
data HowToConnect Source #
Constructors
| LocalPipe !FilePath | Local pipe (UNIX or Windows). |
| RemoteSocket !Host !Port | Remote socket (host and port). |
Instances
| FromJSON HowToConnect Source # | |
Defined in Cardano.Logging.Types | |
| ToJSON HowToConnect Source # | |
Defined in Cardano.Logging.Types Methods toJSON :: HowToConnect -> Value # toEncoding :: HowToConnect -> Encoding # toJSONList :: [HowToConnect] -> Value # toEncodingList :: [HowToConnect] -> Encoding # omitField :: HowToConnect -> Bool # | |
| Generic HowToConnect Source # | |
Defined in Cardano.Logging.Types Methods from :: HowToConnect -> Rep HowToConnect x Source # to :: Rep HowToConnect x -> HowToConnect Source # | |
| Show HowToConnect Source # | |
Defined in Cardano.Logging.Types | |
| NFData HowToConnect Source # | |
Defined in Cardano.Logging.Types Methods rnf :: HowToConnect -> () Source # | |
| Eq HowToConnect Source # | |
Defined in Cardano.Logging.Types Methods (==) :: HowToConnect -> HowToConnect -> Bool Source # (/=) :: HowToConnect -> HowToConnect -> Bool Source # | |
| type Rep HowToConnect Source # | |
Defined in Cardano.Logging.Types | |