diff options
Diffstat (limited to 'src/Graylog/Types.hs')
-rw-r--r-- | src/Graylog/Types.hs | 8 |
1 files changed, 7 insertions, 1 deletions
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 | |||
22 | import Network.BSD | 22 | import Network.BSD |
23 | import Network.Socket | 23 | import Network.Socket |
24 | 24 | ||
25 | -- | The maximum size of each datagram when using UDP transit methods. | ||
25 | type ChunkSize = Word | 26 | type ChunkSize = Word |
26 | 27 | ||
28 | -- | Handle for a socket connected to Graylog. In some cases this socket | ||
29 | -- is UDP and will not have a maintained session. | ||
27 | data Graylog | 30 | data Graylog |
28 | = Graylog | 31 | = Graylog |
29 | { _graylogHost :: String | 32 | { _graylogHost :: String |
@@ -38,7 +41,10 @@ defaultChunkSize :: ChunkSize | |||
38 | defaultChunkSize = 8192 | 41 | defaultChunkSize = 8192 |
39 | 42 | ||
40 | openGraylog | 43 | openGraylog |
41 | :: HostName -> ServiceName -> ChunkSize -> IO (Either String Graylog) | 44 | :: HostName -- ^ The host on which graylog is running. |
45 | -> ServiceName -- ^ The port on which graylog is running. | ||
46 | -> ChunkSize -- ^ The maximum size of each UDP datagram. | ||
47 | -> IO (Either String Graylog) | ||
42 | openGraylog h p cksize | 48 | openGraylog h p cksize |
43 | | cksize < 1024 = return $ Left "ChunkSize must be at least 1024." | 49 | | cksize < 1024 = return $ Left "ChunkSize must be at least 1024." |
44 | | otherwise = getAddrInfo Nothing (Just h) (Just p) >>= \case | 50 | | otherwise = getAddrInfo Nothing (Just h) (Just p) >>= \case |