@@ -3,6 +3,7 @@ module Kafka.Kafka
4 , KafkaConfig
4 , KafkaConfig
5 , makeClient
5 , makeClient
8import Prelude
9import Prelude
@@ -11,6 +12,18 @@ import Data.Nullable (Nullable, toNullable)
12foreign import data Kafka :: Type
13foreign import data Kafka :: Type
16+data LogLevel = LogNothing | LogDebug | LogInfo | LogWarn | LogError
18+foreign import data InternalLogLevel :: Type
20+foreign import internalLogNothing :: InternalLogLevel
22+foreign import internalLogDebug :: InternalLogLevel
23+foreign import internalLogInfo:: InternalLogLevel
24+foreign import internalLogWarn :: InternalLogLevel
25+foreign import internalLogError :: InternalLogLevel
14type SaslConfig
27type SaslConfig
15 = { mechanism :: String
28 = { mechanism :: String
16 , username :: String
29 , username :: String
@@ -22,6 +35,7 @@ type InternalKafkaConfig
22 , brokers :: Array String
35 , brokers :: Array String
23 , ssl :: Boolean
36 , ssl :: Boolean
24 , sasl :: Nullable SaslConfig
37 , sasl :: Nullable SaslConfig
38+ , logLevel :: Nullable InternalLogLevel
27type KafkaConfig
41type KafkaConfig
@@ -29,6 +43,7 @@ type KafkaConfig
29 , brokers :: Array String
43 , brokers :: Array String
30 , ssl :: Boolean
44 , ssl :: Boolean
31 , sasl :: Maybe SaslConfig
45 , sasl :: Maybe SaslConfig
46+ , logLevel :: Maybe LogLevel
34foreign import makeClientImpl :: InternalKafkaConfig -> Kafka
49foreign import makeClientImpl :: InternalKafkaConfig -> Kafka
@@ -36,9 +51,17 @@ foreign import makeClientImpl :: InternalKafkaConfig -> Kafka
36makeClient :: KafkaConfig -> Kafka
51makeClient :: KafkaConfig -> Kafka
37makeClient = toInternal >>> makeClientImpl
52makeClient = toInternal >>> makeClientImpl
55+ toInternalLogLevel LogNothing = internalLogNothing
56+ toInternalLogLevel LogDebug = internalLogDebug
57+ toInternalLogLevel LogInfo = internalLogDebug
58+ toInternalLogLevel LogWarn = internalLogWarn
59+ toInternalLogLevel LogError = internalLogError
39 toInternal config =
61 toInternal config =
40 { clientId: config.clientId
62 { clientId: config.clientId
41 , brokers: config.brokers
63 , brokers: config.brokers
42 , ssl: config.ssl
64 , ssl: config.ssl
43 , sasl: toNullable config.sasl
65 , sasl: toNullable config.sasl
66+ , logLevel : config.logLevel <#> toInternalLogLevel # toNullable