aboutsummaryrefslogtreecommitdiff
path: root/hsm-log
diff options
context:
space:
mode:
Diffstat (limited to 'hsm-log')
-rw-r--r--hsm-log/Hsm/Log.hs15
-rw-r--r--hsm-log/hsm-log.cabal17
2 files changed, 32 insertions, 0 deletions
diff --git a/hsm-log/Hsm/Log.hs b/hsm-log/Hsm/Log.hs
new file mode 100644
index 0000000..0f388be
--- /dev/null
+++ b/hsm-log/Hsm/Log.hs
@@ -0,0 +1,15 @@
+{-# LANGUAGE OverloadedStrings #-}
+
+module Hsm.Log
+ ( logMsg
+ ) where
+
+import Data.Text qualified as T
+import Data.Text.IO qualified as T
+import Data.Time.Clock (getCurrentTime)
+import Data.Time.ISO8601 (formatISO8601Millis)
+
+logMsg :: [T.Text] -> T.Text -> IO ()
+logMsg domain msg = do
+ time <- T.pack . formatISO8601Millis <$> getCurrentTime
+ T.putStrLn $ T.unwords [time, "[" <> T.intercalate "/" domain <> "]", msg]
diff --git a/hsm-log/hsm-log.cabal b/hsm-log/hsm-log.cabal
new file mode 100644
index 0000000..65279db
--- /dev/null
+++ b/hsm-log/hsm-log.cabal
@@ -0,0 +1,17 @@
+cabal-version: 3.4
+author: Paul Oliver
+build-type: Simple
+maintainer: contact@pauloliver.dev
+name: hsm-log
+version: 0.1.0.0
+
+library
+ build-depends:
+ , base
+ , iso8601-time
+ , text
+ , time
+
+ exposed-modules: Hsm.Log
+ ghc-options: -Wall -Wunused-packages
+ default-language: GHC2021