]> git.immae.eu Git - github/fretlink/haskell-graylog.git/blobdiff - src/Graylog/UDP.hs
Defined sendLog function.
[github/fretlink/haskell-graylog.git] / src / Graylog / UDP.hs
index 00b6a1244d395004b35d0647a189d4930e10b803..dc172b906ed5fafe7e821e027b9ce76073400d9e 100644 (file)
@@ -1,13 +1,22 @@
 module Graylog.UDP
-   ( Graylog (..)
-   , sendLog
+   ( sendLog
 
    , module Export
    ) where
 
-import           Graylog.Gelf  as Export
-import           Graylog.Types as Export
+import           Data.Aeson
+import qualified Data.ByteString.Lazy           as LBS
+import           Network.Socket.ByteString.Lazy
+import           System.Random.MWC
+
+import           Graylog.Gelf                   as Export
+import           Graylog.Types                  as Export
 
 sendLog :: Graylog -> GELF -> IO ()
-sendLog glog msg = undefined
+sendLog glog msg = mapM_ (send $ _graylogSocket glog) cks
+   where
+      raw = encode msg
+      cks = chunky raw
 
+chunky :: LBS.ByteString -> [LBS.ByteString]
+chunky = undefined