setup :: Config -> IO ()
setup config = do
  Log.removeAllHandlers
  Log.updateGlobalLogger Log.rootLoggerName (Log.setLevel $ level config)
  forM_ (appenders config) $ \case
    SyslogAppender  -> do
      s <- Log.openlog "hummingbird" [Log.PID] Log.USER Log.DEBUG
      Log.updateGlobalLogger Log.rootLoggerName (Log.addHandler s)
    ConsoleAppender -> do
      lh <- Log.streamHandler stderr Log.DEBUG
      let h = Log.setFormatter lh (Log.simpleLogFormatter "[$time : $loggername : $prio] $msg")
      Log.updateGlobalLogger Log.rootLoggerName (Log.addHandler h)
  Log.infoM "hummingbird" "Started hummingbird MQTT message broker."
setup :: Config -> IO ()
setup config = do
  Log.removeAllHandlers
  Log.updateGlobalLogger Log.rootLoggerName (Log.setLevel $ level config)
  forM_ (appenders config) $ \case
    SyslogAppender  -> do
      s <- Log.openlog "hummingbird" [Log.PID] Log.USER Log.DEBUG
      Log.updateGlobalLogger Log.rootLoggerName (Log.addHandler s)
    ConsoleAppender -> do
      lh <- Log.streamHandler stderr Log.DEBUG
      let h = Log.setFormatter lh (Log.simpleLogFormatter "[$time : $loggername : $prio] $msg")
      Log.updateGlobalLogger Log.rootLoggerName (Log.addHandler h)
  Log.infoM "hummingbird" "Started hummingbird MQTT message broker."
setup config = do
  Log.removeAllHandlers
  Log.updateGlobalLogger Log.rootLoggerName (Log.setLevel $ level config)
  forM_ (appenders config) $ \case
    SyslogAppender  -> do
      s <- Log.openlog "hummingbird" [Log.PID] Log.USER Log.DEBUG
      Log.updateGlobalLogger Log.rootLoggerName (Log.addHandler s)
    ConsoleAppender -> do
      lh <- Log.streamHandler stderr Log.DEBUG
      let h = Log.setFormatter lh (Log.simpleLogFormatter "[$time : $loggername : $prio] $msg")
      Log.updateGlobalLogger Log.rootLoggerName (Log.addHandler h)
  Log.infoM "hummingbird" "Started hummingbird MQTT message broker."