diff options
author | Paul Oliver <contact@pauloliver.dev> | 2025-02-07 17:10:05 +0000 |
---|---|---|
committer | Paul Oliver <contact@pauloliver.dev> | 2025-02-18 20:35:35 +0000 |
commit | ab4591cb0e074ce98c24645cdb80cb5012aed566 (patch) | |
tree | 98451fa7e042e49ea83f265866754f3f6a3b406f /hsm-log |
Diffstat (limited to 'hsm-log')
-rw-r--r-- | hsm-log/Hsm/Log.hs | 15 | ||||
-rw-r--r-- | hsm-log/hsm-log.cabal | 17 |
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 |