summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-01-15 14:09:35 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-01-15 14:09:35 -0400
commit6dca9e23d3d03539f9f27b0580f5aa9654b6dcec (patch)
tree1a1160be502d5f7f321bc525b79911d1904b6c40
parentef6c4964c5b9c63ee3742a8ca1ebe3ab6515c16b (diff)
write alerts to log in debug mode
-rw-r--r--Assistant/Alert.hs6
-rw-r--r--Assistant/DaemonStatus.hs4
2 files changed, 9 insertions, 1 deletions
diff --git a/Assistant/Alert.hs b/Assistant/Alert.hs
index c615b38ef..97f75bae8 100644
--- a/Assistant/Alert.hs
+++ b/Assistant/Alert.hs
@@ -120,6 +120,12 @@ renderAlertMessage :: Alert -> Text
renderAlertMessage alert = renderTense (alertTense 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
| alertClass alert == Activity = Present
diff --git a/Assistant/DaemonStatus.hs b/Assistant/DaemonStatus.hs
index 28383a4dd..01e18e5ab 100644
--- a/Assistant/DaemonStatus.hs
+++ b/Assistant/DaemonStatus.hs
@@ -186,7 +186,9 @@ notifyAlert = do
{- Returns the alert's identifier, which can be used to remove it. -}
addAlert :: Alert -> Assistant AlertId
-addAlert alert = notifyAlert `after` modifyDaemonStatus add
+addAlert alert = do
+ debug [showAlert alert]
+ notifyAlert `after` modifyDaemonStatus add
where
add s = (s { lastAlertId = i, alertMap = m }, i)
where