diff options
author | Tom Smeding <tom@tomsmeding.com> | 2021-07-11 17:56:34 +0200 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2021-07-11 17:56:34 +0200 |
commit | f57e800a1d1a8e9f2bed34428f7f58a375f178fb (patch) | |
tree | 7164b0a9bcf03703a6a7f44f5fa04e5847d876e5 /Coolbal/Log.hs | |
parent | 317f1e27688a082926f39ec897f5a38d01a07ce7 (diff) |
Diffstat (limited to 'Coolbal/Log.hs')
-rw-r--r-- | Coolbal/Log.hs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Coolbal/Log.hs b/Coolbal/Log.hs new file mode 100644 index 0000000..d09ad7b --- /dev/null +++ b/Coolbal/Log.hs @@ -0,0 +1,21 @@ +module Coolbal.Log ( + logw, + logVerbose, +) where + +import System.IO (hPutStrLn, stderr) + +import Coolbal.Options + + +logw :: Flags -> Verbosity -> String -> String -> IO () +logw Flags{fVerbosity=verb} level key line + | verb >= level = doLog key line + | otherwise = return () + +logVerbose :: Flags -> String -> String -> IO () +logVerbose flags key line = logw flags Verbose key line + +doLog :: String -> String -> IO () +doLog key line = + hPutStrLn stderr ("[coolbal:" ++ key ++ "] " ++ line) |