tinylog-0.10.3: Simplistic logging using fast-logger.

Safe HaskellNone
LanguageHaskell2010

System.Logger.Message

Description

Msg and ToBytes assist in constructing log messages. For example:

> g <- new (setBufSize 1 . setOutput StdOut $ defSettings)
> info g $ msg "some text" ~~ "key" .= "value" ~~ "okay" .= True
2014-04-28T21:18:20Z, I, some text, key=value, okay=True
>

Synopsis

Documentation

data Msg Source

Type representing log messages.

msg :: ToBytes a => a -> Msg -> Msg Source

Turn some value into a Msg.

field :: ToBytes a => ByteString -> a -> Msg -> Msg Source

Render some field, i.e. a key-value pair delimited by "=".

(.=) :: ToBytes a => ByteString -> a -> Msg -> Msg infixr 5 Source

Alias of field.

(+++) :: (ToBytes a, ToBytes b) => a -> b -> Builder infixr 6 Source

Concatenate two ToBytes values.

(~~) :: (b -> c) -> (a -> b) -> a -> c infixr 4 Source

Alias of . with lowered precedence to allow combination with .= without requiring parentheses.

val :: ByteString -> Builder Source

Type restriction. Useful to disambiguate string literals when using OverloadedStrings pragma.

render :: ByteString -> Bool -> (Msg -> Msg) -> ByteString Source

Intersperse parts of the log message with the given delimiter and render the whole builder into a ByteString.

If the second parameter is set to True, netstrings encoding is used for the message elements. Cf. http://cr.yp.to/proto/netstrings.txt for details.