-- 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 <i>df1</i> 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 <i>df1</i> 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 <a>SystemTime</a> rather than <a>UTCTime</a> because it is
--   cheaper to obtain and to render. You can use <a>systemToUTCTime</a> to
--   convert it if necessary.
[log_time] :: Log -> !SystemTime

-- | Importance level of the logged message.
[log_level] :: Log -> !Level

-- | <a>Path</a> where the logged message was created from.
--   
--   The leftmost <a>Path</a> is the closest to the root. The rightmost
--   <a>Path</a> is the one closest to where the log was generated.
--   
--   An <a>empty</a> <a>Seq</a> 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 <a>syslog(3)</a>.
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

-- | <a>Path</a> represents the hierarchical structure of logged messages.
--   
--   For example, consider a <i>df1</i> log line as like the following:
--   
--   <pre>
--   1999-12-20T07:11:39.230553031Z <i>foo x=a y=b </i>qux z=c z=d WARNING Something
--   </pre>
--   
--   For that line, the <a>log_path</a> attribute of the <a>Log</a>
--   datatype will contain the following:
--   
--   <pre>
--   [ <a>Push</a> (<a>segment</a> "foo")
--   , <a>Attr</a> (<a>key</a> "x") (<a>value</a> "a")
--   , <a>Attr</a> (<a>key</a> "y") (<a>value</a> "b")
--   , <a>Push</a> (<a>segment</a> "qux")
--   , <a>Attr</a> (<a>key</a> "z") (<a>value</a> "c")
--   , <a>Attr</a> (<a>key</a> "z") (<a>value</a> "d")
--   ] :: <a>Seq</a> <a>Path</a>
--   </pre>
--   
--   Please notice that <tt>[] :: <a>Seq</a> <a>Path</a></tt> is a valid
--   path insofar as <i>df1</i> is concerned, and that <a>Attr</a> and
--   <a>Push</a> can be juxtapositioned in any order.
data Path
Push :: !Segment -> Path
Attr :: !Key -> !Value -> Path

-- | A path segment.
--   
--   If you have the <tt>OverloadedStrings</tt> GHC extension enabled, you
--   can build a <a>Segment</a> using a string literal:
--   
--   <pre>
--   "foo" :: <a>Segment</a>
--   </pre>
--   
--   Otherwise, you can use <a>fromString</a> or the <a>Segment</a>
--   constructor directly.
data Segment
unSegment :: Segment -> Text
segment :: Text -> Segment

-- | An attribute key (see <a>Attr</a>).
--   
--   If you have the <tt>OverloadedStrings</tt> GHC extension enabled, you
--   can build a <a>Key</a> using a string literal:
--   
--   <pre>
--   "foo" :: <a>Key</a>
--   </pre>
--   
--   Otherwise, you can use <a>fromString</a> or the <a>key</a> function.
--   
--   Please keep in mind that <a>Key</a> will always strip surrounding
--   whitespace. That is:
--   
--   <pre>
--   "x" :: <a>Key</a>  ==  " x"  == "x " == " x "
--   </pre>
data Key
unKey :: Key -> Text
key :: Text -> Key

-- | An attribute value (see <a>Attr</a>).
--   
--   If you have the <tt>OverloadedStrings</tt> GHC extension enabled, you
--   can build a <a>Value</a> using a string literal:
--   
--   <pre>
--   "foo" :: <a>Value</a>
--   </pre>
--   
--   Otherwise, you can use <a>fromString</a> or the <a>value</a> function.
--   
--   Please keep in mind that <a>value</a> will always strip surrounding
--   whitespace. That is:
--   
--   <pre>
--   "x" :: <a>Value</a>  ==  " x"  == "x " == " x "
--   </pre>
data Value
unValue :: Value -> Text
value :: Text -> Value

-- | A message text.
--   
--   If you have the <tt>OverloadedStrings</tt> GHC extension enabled, you
--   can build a <a>Message</a> using a string literal:
--   
--   <pre>
--   "foo" :: <a>Message</a>
--   </pre>
--   
--   Please keep in mind that <a>Message</a> will always strip surrounding
--   whitespace. That is:
--   
--   <pre>
--   "x" :: <a>Message</a>  ==  " x"  == "x " == " x "
--   </pre>
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 <a>renderColor</a>, but without color.
render :: Log -> Builder
renderColor :: Log -> Builder
