--debug log messages are now timestamped with fractional seconds.

This commit is contained in:
Joey Hess 2015-08-12 14:42:49 -04:00
parent 626d273240
commit 7584e47ba3
4 changed files with 14 additions and 9 deletions

View file

@ -173,7 +173,7 @@ setupConsole :: IO ()
setupConsole = do
s <- setFormatter
<$> streamHandler stderr DEBUG
<*> pure (simpleLogFormatter "[$time] $msg")
<*> pure preciseLogFormatter
updateGlobalLogger rootLoggerName (setLevel NOTICE . setHandlers [s])
{- This avoids ghc's output layer crashing on
- invalid encoded characters in
@ -181,6 +181,10 @@ setupConsole = do
fileEncoding stdout
fileEncoding stderr
{- Log formatter with precision into fractions of a second. -}
preciseLogFormatter :: LogFormatter a
preciseLogFormatter = tfLogFormatter "%F %X%Q" "[$time] $msg"
enableDebugOutput :: IO ()
enableDebugOutput = updateGlobalLogger rootLoggerName $ setLevel DEBUG