aboutsummaryrefslogtreecommitdiff
path: root/src/Logger.hs
diff options
context:
space:
mode:
authorJoris2015-11-21 19:02:49 +0100
committerJoris2015-11-21 19:02:54 +0100
commit7acd7a42f7663aa79d18e24bdb9fe19bf15f8fae (patch)
tree000d1d157ff33917358ded8100980d018e437f7f /src/Logger.hs
parent6850159bf998a209ad7b6d7103d113a54659937e (diff)
downloadevents-7acd7a42f7663aa79d18e24bdb9fe19bf15f8fae.tar.gz
events-7acd7a42f7663aa79d18e24bdb9fe19bf15f8fae.tar.bz2
events-7acd7a42f7663aa79d18e24bdb9fe19bf15f8fae.zip
Log details about sent mails in a file
Diffstat (limited to 'src/Logger.hs')
-rw-r--r--src/Logger.hs22
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"
+ ]