diff options
Diffstat (limited to 'src/Logger.hs')
-rw-r--r-- | src/Logger.hs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/Logger.hs b/src/Logger.hs new file mode 100644 index 0000000..4be55be --- /dev/null +++ b/src/Logger.hs @@ -0,0 +1,22 @@ +{-# LANGUAGE OverloadedStrings #-} + +module Logger + ( info + ) where + +import Data.Text (Text) +import qualified Data.Text as T +import qualified Data.Text.IO as T (appendFile) +import Data.Time.LocalTime (getZonedTime) +import Data.Time.Format (formatTime, defaultTimeLocale) + +info :: Text -> IO () +info message = do + time <- T.pack <$> formatTime defaultTimeLocale "[%d/%m/%Y, %H:%M]" <$> getZonedTime + T.appendFile "logs" $ + T.concat + [ time + , " - " + , message + , "\n" + ] |