-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Type, render and parse the df1 hierarchical structured log format -- -- Type, render and parse logs in df1 format, a hierarchical -- structured log format that is easy for humans and fast for computers. @package df1 @version 0.1.1 -- | This module exports tools for typing, parsing, and rendering logs in -- the df1 hierarchical structured logging format. -- -- Consider this a preview release: The API is likely to stay stable, but -- extensive testing, formalization and tooling is due. module Df1 data Log Log :: !SystemTime -> !Level -> !(Seq Path) -> !Message -> Log -- | First known timestamp when the log was generated. -- -- We use SystemTime rather than UTCTime because it is -- cheaper to obtain and to render. You can use systemToUTCTime to -- convert it if necessary. [log_time] :: Log -> !SystemTime -- | Importance level of the logged message. [log_level] :: Log -> !Level -- | Path where the logged message was created from. -- -- The leftmost Path is the closest to the root. The rightmost -- Path is the one closest to where the log was generated. -- -- An empty Seq is acceptable, conveying the idea of the -- “root path”. [log_path] :: Log -> !(Seq Path) -- | Human-readable message itself. [log_message] :: Log -> !Message -- | Importance of the logged message. -- -- These levels, listed in increasing order of importance, correspond to -- the levels used by syslog(3). data Level -- | Message intended to be useful only when deliberately debugging a -- program. Debug :: Level -- | Informational message. Info :: Level -- | A condition that is not an error, but should possibly be handled -- specially. Notice :: Level -- | A warning condition, such as an exception being gracefully handled or -- some missing configuration setting being assigned a default value. Warning :: Level -- | Error condition, such as an unhandled exception. Error :: Level -- | Critical condition that could result in system failure, such as a disk -- running out of space. Critical :: Level -- | A condition that should be corrected immediately, such as a corrupted -- database. Alert :: Level -- | System is unusable. Emergency :: Level -- | Path represents the hierarchical structure of logged messages. -- -- For example, consider a df1 log line as like the following: -- --
--   1999-12-20T07:11:39.230553031Z /foo x=a y=b /qux z=c z=d WARNING Something
--   
-- -- For that line, the log_path attribute of the Log -- datatype will contain the following: -- --
--   [ Push (segment "foo")
--   , Attr (key "x") (value "a")
--   , Attr (key "y") (value "b")
--   , Push (segment "qux")
--   , Attr (key "z") (value "c")
--   , Attr (key "z") (value "d")
--   ] :: Seq Path
--   
-- -- Please notice that [] :: Seq Path is a valid -- path insofar as df1 is concerned, and that Attr and -- Push can be juxtapositioned in any order. data Path Push :: !Segment -> Path Attr :: !Key -> !Value -> Path -- | A path segment. -- -- If you have the OverloadedStrings GHC extension enabled, you -- can build a Segment using a string literal: -- --
--   "foo" :: Segment
--   
-- -- Otherwise, you can use fromString or the Segment -- constructor directly. data Segment unSegment :: Segment -> Text segment :: Text -> Segment -- | An attribute key (see Attr). -- -- If you have the OverloadedStrings GHC extension enabled, you -- can build a Key using a string literal: -- --
--   "foo" :: Key
--   
-- -- Otherwise, you can use fromString or the key function. -- -- Please keep in mind that Key will always strip surrounding -- whitespace. That is: -- --
--   "x" :: Key  ==  " x"  == "x " == " x "
--   
data Key unKey :: Key -> Text key :: Text -> Key -- | An attribute value (see Attr). -- -- If you have the OverloadedStrings GHC extension enabled, you -- can build a Value using a string literal: -- --
--   "foo" :: Value
--   
-- -- Otherwise, you can use fromString or the value function. -- -- Please keep in mind that value will always strip surrounding -- whitespace. That is: -- --
--   "x" :: Value  ==  " x"  == "x " == " x "
--   
data Value unValue :: Value -> Text value :: Text -> Value -- | A message text. -- -- If you have the OverloadedStrings GHC extension enabled, you -- can build a Message using a string literal: -- --
--   "foo" :: Message
--   
-- -- Please keep in mind that Message will always strip surrounding -- whitespace. That is: -- --
--   "x" :: Message  ==  " x"  == "x " == " x "
--   
data Message unMessage :: Message -> Text message :: Text -> Message -- | If sucessful, parsing will stop after the first CR or LF newline -- marker if any, otherwise it will consume all input. parse :: Parser Log -- | Like renderColor, but without color. render :: Log -> Builder renderColor :: Log -> Builder