summaryrefslogtreecommitdiff
path: root/Messages.hs
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 /Messages.hs
parent6dca9e23d3d03539f9f27b0580f5aa9654b6dcec (diff)
log alerts in notice mode, which is enabled by default
Diffstat (limited to 'Messages.hs')
-rw-r--r--Messages.hs14
1 files changed, 11 insertions, 3 deletions
diff --git a/Messages.hs b/Messages.hs
index d75fe6769..63c628108 100644
--- a/Messages.hs
+++ b/Messages.hs
@@ -38,6 +38,10 @@ import Text.JSON
import Data.Progress.Meter
import Data.Progress.Tracker
import Data.Quantity
+import System.Log.Logger
+import System.Log.Formatter
+import System.Log.Handler (setFormatter, LogHandler)
+import System.Log.Handler.Simple
import Common
import Types
@@ -197,11 +201,15 @@ showHeader h = handle q $
showRaw :: String -> Annex ()
showRaw s = handle q $ putStrLn s
-{- This avoids ghc's output layer crashing on invalid encoded characters in
- - filenames when printing them out.
- -}
setupConsole :: IO ()
setupConsole = do
+ s <- setFormatter
+ <$> streamHandler stderr DEBUG
+ <*> pure (simpleLogFormatter "[$time] $msg")
+ updateGlobalLogger rootLoggerName (setLevel NOTICE . setHandlers [s])
+ {- This avoids ghc's output layer crashing on
+ - invalid encoded characters in
+ - filenames when printing them out. -}
fileEncoding stdout
fileEncoding stderr