df1-0.4: Type, render and parse the df1 hierarchical structured log format

Safe HaskellSafe
LanguageHaskell2010

Df1.Render

Synopsis

Documentation

log :: Log -> Builder Source #

Renders a Log on its own line. Doesn't include a trailing newline character.

For example:

2019-11-15T18:05:54.949470902Z NOTICE Welcome to my program!
2019-11-15T18:05:54.949623731Z /initialization NOTICE Starting web server
2019-11-15T18:05:54.949630205Z /initialization ALERT Disk is almost full!!!
2019-11-15T18:05:54.949640299Z /server port=80 INFO Listening for new clients
2019-11-15T18:05:54.949652133Z /server port=80 /handler client-address=10.0.0.8 INFO Connection established
2019-11-15T18:05:54.949664482Z /server port=80 /handler client-address=10.0.0.8 WARNING user error (Oops!)

logColorANSI :: Log -> Builder Source #

Like log, but with ANSI colors.

key :: Key -> Builder Source #

Escaping rules for Key:

  • An ASCII-7 control character is always percent-escaped.
  • An ASCII-7 punctuation character is always percent-escaped.
  • An ASCII-7 punctuation character anywhere else is always percent-escaped, unless it is '-' or '_'.

The output is encoded as UTF-8.

message :: Message -> Builder Source #

Escaping rules for Segment:

  • A '%' anywhere is always percent-escaped ("%25")
  • An ASCII-7 control character anywhere is always percent-escaped.

The output is encoded as UTF-8.

iso8601 :: SystemTime -> Builder Source #

Renders YYYY-MM-DDThh:mm:ss.sssssssssZ (nanosecond precision).

The rendered string is 30 characters long, and it's encoded as ASCII/UTF-8.

segment :: Segment -> Builder Source #

Escaping rules for Segment:

  • An ASCII-7 punctuation character as first character is always percent-escaped.
  • An ASCII-7 punctuation character anywhere else is always percent-escaped, unless it is '-' or '_'.
  • An ASCII-7 control character anywhere is always percent-escaped.

The output is encoded as UTF-8.

value :: Value -> Builder Source #

Escaping rules for Value:

  • A ' ' anywhere is always percent-escaped ("%20").
  • A '%' anywhere is always percent-escaped ("%25")"
  • A '=' anywhere is always percent-escaped ("%3d").
  • An ASCII-7 control character anywhere is always percent-escaped.

The output is encoded as UTF-8.