From d9a5d441ca9b5ae766311702557bf9f1ff0255b1 Mon Sep 17 00:00:00 2001 From: AndrewRademacher Date: Sun, 28 Feb 2016 14:38:16 -0600 Subject: Added readme, license, and light commenting. --- src/Graylog/Gelf.hs | 2 ++ src/Graylog/Types.hs | 8 +++++++- src/Graylog/UDP.hs | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Graylog/Gelf.hs b/src/Graylog/Gelf.hs index cd68e05..ee17e3d 100644 --- a/src/Graylog/Gelf.hs +++ b/src/Graylog/Gelf.hs @@ -2,6 +2,8 @@ {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE OverloadedStrings #-} +-- | Default formatting for Graylog messages, +-- see http://docs.graylog.org/en/latest/pages/gelf.html module Graylog.Gelf where import Data.Aeson (ToJSON (..), Value (..), genericToJSON, diff --git a/src/Graylog/Types.hs b/src/Graylog/Types.hs index 5c32a8b..5ec779b 100644 --- a/src/Graylog/Types.hs +++ b/src/Graylog/Types.hs @@ -22,8 +22,11 @@ import qualified Data.Text as T import Network.BSD import Network.Socket +-- | The maximum size of each datagram when using UDP transit methods. type ChunkSize = Word +-- | Handle for a socket connected to Graylog. In some cases this socket +-- is UDP and will not have a maintained session. data Graylog = Graylog { _graylogHost :: String @@ -38,7 +41,10 @@ defaultChunkSize :: ChunkSize defaultChunkSize = 8192 openGraylog - :: HostName -> ServiceName -> ChunkSize -> IO (Either String Graylog) + :: HostName -- ^ The host on which graylog is running. + -> ServiceName -- ^ The port on which graylog is running. + -> ChunkSize -- ^ The maximum size of each UDP datagram. + -> IO (Either String Graylog) openGraylog h p cksize | cksize < 1024 = return $ Left "ChunkSize must be at least 1024." | otherwise = getAddrInfo Nothing (Just h) (Just p) >>= \case diff --git a/src/Graylog/UDP.hs b/src/Graylog/UDP.hs index cd7fe5a..7c8eb84 100644 --- a/src/Graylog/UDP.hs +++ b/src/Graylog/UDP.hs @@ -1,3 +1,4 @@ +-- | UDP Chunked support for sending messages to graylog. module Graylog.UDP ( sendLog -- cgit v1.2.3