tinylog-0.15.0: Simplistic logging using fast-logger.
Safe HaskellSafe-Inferred
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

class ToBytes a where Source #

Convert some value to a Builder.

Methods

bytes :: a -> Builder Source #

Instances

Instances details
ToBytes Int16 Source # 
Instance details

Defined in System.Logger.Message

Methods

bytes :: Int16 -> Builder Source #

ToBytes Int32 Source # 
Instance details

Defined in System.Logger.Message

Methods

bytes :: Int32 -> Builder Source #

ToBytes Int64 Source # 
Instance details

Defined in System.Logger.Message

Methods

bytes :: Int64 -> Builder Source #

ToBytes Int8 Source # 
Instance details

Defined in System.Logger.Message

Methods

bytes :: Int8 -> Builder Source #

ToBytes Word16 Source # 
Instance details

Defined in System.Logger.Message

Methods

bytes :: Word16 -> Builder Source #

ToBytes Word32 Source # 
Instance details

Defined in System.Logger.Message

Methods

bytes :: Word32 -> Builder Source #

ToBytes Word64 Source # 
Instance details

Defined in System.Logger.Message

Methods

bytes :: Word64 -> Builder Source #

ToBytes Word8 Source # 
Instance details

Defined in System.Logger.Message

Methods

bytes :: Word8 -> Builder Source #

ToBytes ByteString Source # 
Instance details

Defined in System.Logger.Message

ToBytes ByteString Source # 
Instance details

Defined in System.Logger.Message

ToBytes Text Source # 
Instance details

Defined in System.Logger.Message

Methods

bytes :: Text -> Builder Source #

ToBytes Text Source # 
Instance details

Defined in System.Logger.Message

Methods

bytes :: Text -> Builder Source #

ToBytes Builder Source # 
Instance details

Defined in System.Logger.Message

ToBytes Integer Source # 
Instance details

Defined in System.Logger.Message

ToBytes Bool Source # 
Instance details

Defined in System.Logger.Message

Methods

bytes :: Bool -> Builder Source #

ToBytes Char Source # 
Instance details

Defined in System.Logger.Message

Methods

bytes :: Char -> Builder Source #

ToBytes Double Source # 
Instance details

Defined in System.Logger.Message

Methods

bytes :: Double -> Builder Source #

ToBytes Float Source # 
Instance details

Defined in System.Logger.Message

Methods

bytes :: Float -> Builder Source #

ToBytes Int Source # 
Instance details

Defined in System.Logger.Message

Methods

bytes :: Int -> Builder Source #

ToBytes Word Source # 
Instance details

Defined in System.Logger.Message

Methods

bytes :: Word -> Builder Source #

ToBytes [Char] Source # 
Instance details

Defined in System.Logger.Message

Methods

bytes :: [Char] -> Builder Source #

data Msg Source #

Type representing log messages.

data Builder Source #

Instances

Instances details
IsString Builder Source # 
Instance details

Defined in System.Logger.Message

Methods

fromString :: String -> Builder #

Monoid Builder Source # 
Instance details

Defined in System.Logger.Message

Semigroup Builder Source # 
Instance details

Defined in System.Logger.Message

ToBytes Builder Source # 
Instance details

Defined in System.Logger.Message

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 :: ([Element] -> Builder) -> (Msg -> Msg) -> ByteString Source #

Construct elements, call a renderer, and run the whole builder into a ByteString.

renderDefault :: ByteString -> [Element] -> Builder Source #

Simple Renderer with '=' between field names and values and a custom separator.

renderNetstr :: [Element] -> Builder Source #

Renderer that uses netstring encoding for log lines.