Fix line endings in logging output

This commit is contained in:
Daniel Gröber 2015-03-06 14:04:49 +01:00
parent b3b4b91ff8
commit c8da5b8085
2 changed files with 5 additions and 2 deletions

View File

@ -23,6 +23,8 @@ module Language.Haskell.GhcMod.Logging (
) where
import Control.Monad
import Data.List
import Data.Char
import Data.Monoid (mempty, mappend, mconcat, (<>))
import System.IO
import Text.PrettyPrint hiding (style, (<>))
@ -52,7 +54,8 @@ gmLog level loc' doc = do
let loc | loc' == "" = empty
| otherwise = text (head $ lines loc') <> colon
msg = gmRenderDoc $ gmLogLevelDoc level <+> loc <+> doc
msg' = dropWhileEnd isSpace msg
when (Just level <= level') $
liftIO $ hPutStr stderr msg
liftIO $ hPutStrLn stderr msg'
gmlJournal (GhcModLog Nothing [(level, render loc, msg)])

View File

@ -31,7 +31,7 @@ import Test.Hspec
import Exception
testLogLevel :: GmLogLevel
testLogLevel = GmException
testLogLevel = GmDebug
extract :: Show e => IO (Either e a, w) -> IO a
extract action = do