write alerts to log in debug mode

This commit is contained in:
Joey Hess 2013-01-15 14:09:35 -04:00
parent e15cca7db8
commit 85c8b222a0
2 changed files with 9 additions and 1 deletions

View file

@ -120,6 +120,12 @@ renderAlertMessage :: Alert -> Text
renderAlertMessage alert = renderTense (alertTense alert) $ renderAlertMessage alert = renderTense (alertTense alert) $
(alertMessageRender alert) (alertData alert) (alertMessageRender alert) (alertData alert)
showAlert :: Alert -> String
showAlert alert = T.unpack $ T.unwords $ catMaybes
[ renderAlertHeader alert
, Just $ renderAlertMessage alert
]
alertTense :: Alert -> Tense alertTense :: Alert -> Tense
alertTense alert alertTense alert
| alertClass alert == Activity = Present | alertClass alert == Activity = Present

View file

@ -186,7 +186,9 @@ notifyAlert = do
{- Returns the alert's identifier, which can be used to remove it. -} {- Returns the alert's identifier, which can be used to remove it. -}
addAlert :: Alert -> Assistant AlertId addAlert :: Alert -> Assistant AlertId
addAlert alert = notifyAlert `after` modifyDaemonStatus add addAlert alert = do
debug [showAlert alert]
notifyAlert `after` modifyDaemonStatus add
where where
add s = (s { lastAlertId = i, alertMap = m }, i) add s = (s { lastAlertId = i, alertMap = m }, i)
where where