{-# LANGUAGE OverloadedStrings #-} module Network.Socketson.Report where -- import Control.Monad.Trans.Either import Control.Monad.IO.Class (liftIO) -- data: import qualified Data.Text as T import qualified Data.Text.IO as T -- intern: import Network.Socketson.ProtocolException data Priority = Low | Middle | High deriving (Eq, Ord, Show) data ReportType = Error ProtocolException | Info Priority T.Text -- | Simple report function. Just puts to console; future plans involve priorities and log files. report :: T.Text -> ReportType -> EitherT ProtocolException IO () report nick (Error err) = liftIO (T.putStrLn $ T.unwords ["Error @ <", nick, ">:", T.pack $ show err]) report nick (Info _ s) = liftIO (T.putStrLn $ T.unwords ["Info @<", nick, ">:", s])