From 6dca9e23d3d03539f9f27b0580f5aa9654b6dcec Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 15 Jan 2013 14:09:35 -0400 Subject: write alerts to log in debug mode --- Assistant/Alert.hs | 6 ++++++ Assistant/DaemonStatus.hs | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3