log alerts in notice mode, which is enabled by default
This commit is contained in:
parent
85c8b222a0
commit
b635d99f66
4 changed files with 27 additions and 17 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue