summaryrefslogtreecommitdiff
path: root/Assistant
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-01-15 14:34:39 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-01-15 14:34:39 -0400
commit90a1bf735ec2aef240549c65a714703d33ff07f5 (patch)
tree1fdeb0e846c15e0dc724213e35d2e8d727f0703b /Assistant
parent6dca9e23d3d03539f9f27b0580f5aa9654b6dcec (diff)
log alerts in notice mode, which is enabled by default
Diffstat (limited to 'Assistant')
-rw-r--r--Assistant/DaemonStatus.hs2
-rw-r--r--Assistant/Types/NamedThread.hs17
2 files changed, 15 insertions, 4 deletions
diff --git a/Assistant/DaemonStatus.hs b/Assistant/DaemonStatus.hs
index 01e18e5ab..f682657c9 100644
--- a/Assistant/DaemonStatus.hs
+++ b/Assistant/DaemonStatus.hs
@@ -187,7 +187,7 @@ notifyAlert = do
{- Returns the alert's identifier, which can be used to remove it. -}
addAlert :: Alert -> Assistant AlertId
addAlert alert = do
- debug [showAlert alert]
+ notice [showAlert alert]
notifyAlert `after` modifyDaemonStatus add
where
add s = (s { lastAlertId = i, alertMap = m }, i)
diff --git a/Assistant/Types/NamedThread.hs b/Assistant/Types/NamedThread.hs
index 569f787d1..0e122c097 100644
--- a/Assistant/Types/NamedThread.hs
+++ b/Assistant/Types/NamedThread.hs
@@ -5,7 +5,12 @@
- Licensed under the GNU GPL version 3 or higher.
-}
-module Assistant.Types.NamedThread where
+module Assistant.Types.NamedThread (
+ ThreadName,
+ NamedThread(..),
+ debug,
+ notice,
+) where
import Common.Annex
import Assistant.Monad
@@ -16,6 +21,12 @@ type ThreadName = String
data NamedThread = NamedThread ThreadName (Assistant ())
debug :: [String] -> Assistant ()
-debug ws = do
+debug = logaction debugM
+
+notice :: [String] -> Assistant ()
+notice = logaction noticeM
+
+logaction :: (String -> String -> IO ()) -> [String] -> Assistant ()
+logaction a ws = do
name <- getAssistant threadName
- liftIO $ debugM name $ unwords $ (name ++ ":") : ws
+ liftIO $ a name $ unwords $ (name ++ ":") : ws