aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Graylog/Gelf.hs31
-rw-r--r--src/Graylog/UDP.hs19
2 files changed, 27 insertions, 23 deletions
diff --git a/src/Graylog/Gelf.hs b/src/Graylog/Gelf.hs
index 67e0de7..32b9321 100644
--- a/src/Graylog/Gelf.hs
+++ b/src/Graylog/Gelf.hs
@@ -7,24 +7,21 @@ module Graylog.Gelf where
7import Data.Aeson (ToJSON (..), Value (..), genericToJSON, 7import Data.Aeson (ToJSON (..), Value (..), genericToJSON,
8 toJSON) 8 toJSON)
9import Data.Aeson.Casing 9import Data.Aeson.Casing
10import Data.Scientific
11import Data.Text (Text) 10import Data.Text (Text)
12import Data.Time 11import Data.Time
13import Data.Typeable 12import Data.Typeable
14import Data.Vector
15import GHC.Generics 13import GHC.Generics
16 14
17data GELF 15data GELF
18 = GELF 16 = GELF
19 { _gelfVersion :: Version 17 { _gelfVersion :: Version
20 , _gelfHost :: Text 18 , _gelfHost :: Text
21 , _gelfShortMessage :: Text 19 , _gelfShortMessage :: Text
22 , _gelfFullMessage :: Maybe Text 20 , _gelfFullMessage :: Maybe Text
23 , _gelfTimestamp :: Maybe UTCTime 21 , _gelfTimestamp :: Maybe UTCTime
24 , _gelfLevel :: Maybe SyslogLevel 22 , _gelfLevel :: Maybe SyslogLevel
25 , _gelfLine :: Maybe Word 23 , _gelfLine :: Maybe Word
26 , _gelfFile :: Maybe Text 24 , _gelfFile :: Maybe Text
27 , _gelfAdditionalFields :: Vector Field
28 } 25 }
29 deriving (Show, Typeable, Generic) 26 deriving (Show, Typeable, Generic)
30 27
@@ -62,15 +59,3 @@ instance ToJSON SyslogLevel where
62 toJSON Notice = Number 5 59 toJSON Notice = Number 5
63 toJSON Informational = Number 6 60 toJSON Informational = Number 6
64 toJSON Debug = Number 7 61 toJSON Debug = Number 7
65
66--
67
68data Field
69 = FieldString Text
70 | FieldNumber Scientific
71 deriving (Eq, Show, Typeable, Generic)
72
73instance ToJSON Field where
74 toJSON (FieldString s) = String s
75 toJSON (FieldNumber n) = Number n
76
diff --git a/src/Graylog/UDP.hs b/src/Graylog/UDP.hs
new file mode 100644
index 0000000..6aec108
--- /dev/null
+++ b/src/Graylog/UDP.hs
@@ -0,0 +1,19 @@
1module Graylog.UDP
2 ( Graylog (..)
3 , sendLog
4
5 , module Graylog.Gelf
6 ) where
7
8import Network.Socket
9
10import Graylog.Gelf
11
12data Graylog
13 = Graylog
14 { _graylogHost :: String
15 , _graylogPort :: String
16 }
17
18sendLog :: Graylog -> GELF -> IO ()
19sendLog glog msg = undefined