summaryrefslogtreecommitdiff
path: root/Coolbal/Log.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Coolbal/Log.hs')
-rw-r--r--Coolbal/Log.hs21
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)