Add logging
Also fix reconnecting logic
This commit is contained in:
parent
6ba2ddfaea
commit
5a75d9b205
3 changed files with 52 additions and 47 deletions
|
|
@ -1,5 +1,12 @@
|
|||
import qualified EuphApi.Bot as E
|
||||
import qualified EuphApi.Connection as E
|
||||
import System.IO
|
||||
|
||||
import qualified System.Log.Formatter as LF
|
||||
import qualified System.Log.Handler as LH
|
||||
import qualified System.Log.Handler.Simple as LH
|
||||
import qualified System.Log.Logger as L
|
||||
|
||||
import qualified EuphApi.Bot as E
|
||||
import qualified EuphApi.Connection as E
|
||||
|
||||
myBotConfig :: E.BotConfig () ()
|
||||
myBotConfig = E.BotConfig
|
||||
|
|
@ -13,4 +20,10 @@ myBotConfig = E.BotConfig
|
|||
, E.botReconnectPolicy = E.defaultReconnectPolicy
|
||||
}
|
||||
|
||||
main = E.runBot myBotConfig
|
||||
main = do
|
||||
myHandler <- LH.verboseStreamHandler stderr L.INFO
|
||||
let myFormatter = LF.simpleLogFormatter "<$time> [$loggername/$prio] $msg"
|
||||
myFormattedHandler = LH.setFormatter myHandler myFormatter
|
||||
L.updateGlobalLogger L.rootLoggerName (L.setHandlers [myFormattedHandler])
|
||||
L.updateGlobalLogger L.rootLoggerName (L.setLevel L.INFO)
|
||||
E.runBot myBotConfig
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue