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

View File

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