hGelf-0.1: Haskell GELF library

Safe HaskellSafe-Infered

Network.Gelf

Description

 

Synopsis

Documentation

sendSource

Arguments

:: HostName

Remote hostname of the graylog server

-> String

Port number

-> Int

Chunk size

-> Text

Short message

-> Maybe Text

Long message (optional)

-> Maybe Text

Filename of the message cause

-> Maybe Integer

Line in the file where the message was sent for

-> [(Text, Maybe Text)]

Additional fields (name, information), should not contain id as name

-> IO ()

Does I/O

Send a log message to a server accepting Graylog2 messages.

encodeSource

Arguments

:: Int

Maximal chunk size

-> Text

Short message

-> Maybe Text

Long message (optional)

-> String

Hostname

-> Integer

Timestamp

-> Maybe Text

Filename of the file causing the message, e.g., for debugging purposes

-> Maybe Integer

Line number in the file causing the message, e.g., for debugging purposes

-> [(Text, Maybe Text)]

Additional fields

-> [ByteString]

One or more chunks

Encode a log message as a GELF message.

This function wraps a given log message in a GELF structure. It creates the JSON object, converts it to a ByteString and GZips the result. If the resulting ByteString is longer than the maximal chunk size, the GELF message is split up into chunks, each at most chunk size in length.