git.iko.soy/typeable/pandoc
on master help sign in
Changed display format for messages.
1ec6a19John MacFarlane
src/Text/Pandoc/Class.hs+8−8
@@ -77,6 +77,7 @@ import Text.Pandoc.Logging
77import Text.Parsec (ParsecT)
77import Text.Parsec (ParsecT)
78import qualified Text.Pandoc.Compat.Time as IO (getCurrentTime)
78import qualified Text.Pandoc.Compat.Time as IO (getCurrentTime)
79import Text.Pandoc.MIME (MimeType, getMimeType)
79import Text.Pandoc.MIME (MimeType, getMimeType)
80+import Data.Char (toLower)
80import Data.Time.Clock.POSIX ( utcTimeToPOSIXSeconds
81import Data.Time.Clock.POSIX ( utcTimeToPOSIXSeconds
81 , posixSecondsToUTCTime
82 , posixSecondsToUTCTime
82 , POSIXTime )
83 , POSIXTime )
@@ -106,7 +107,6 @@ import System.IO.Error
106import System.IO (stderr)
107import System.IO (stderr)
107import qualified Data.Map as M
108import qualified Data.Map as M
108import Text.Pandoc.Error
109import Text.Pandoc.Error
109−import Text.Printf (printf)
110
110
111class (Functor m, Applicative m, Monad m, MonadError PandocError m)
111class (Functor m, Applicative m, Monad m, MonadError PandocError m)
112 => PandocMonad m where
112 => PandocMonad m where
@@ -251,17 +251,17 @@ instance PandocMonad PandocIO where
251 getCommonState = PandocIO $ lift get
251 getCommonState = PandocIO $ lift get
252 putCommonState x = PandocIO $ lift $ put x
252 putCommonState x = PandocIO $ lift $ put x
253 logOutput msg = liftIO $ do
253 logOutput msg = liftIO $ do
254+ UTF8.hPutStr stderr $ "[" ++
254− UTF8.hPutStr stderr $ printf "%-7s " (show (messageVerbosity msg))
255+ (map toLower $ show (messageVerbosity msg)) ++ "] "
255− hangingIndent 2 $ lines $ showLogMessage msg
256+ alertIndent $ lines $ showLogMessage msg
256
257
257−hangingIndent :: Int -> [String] -> IO ()
258+alertIndent :: [String] -> IO ()
258−hangingIndent _level [] = return ()
259+alertIndent [] = return ()
259−hangingIndent level (l:ls) = do
260+alertIndent (l:ls) = do
260 UTF8.hPutStrLn stderr l
261 UTF8.hPutStrLn stderr l
261 mapM_ go ls
262 mapM_ go ls
262− where go l' = do UTF8.hPutStr stderr ind
263+ where go l' = do UTF8.hPutStr stderr "! "
263 UTF8.hPutStrLn stderr l'
264 UTF8.hPutStrLn stderr l'
264− ind = replicate level ' '
265
265
266-- | Specialized version of parseURIReference that disallows
266-- | Specialized version of parseURIReference that disallows
267-- single-letter schemes. Reason: these are usually windows absolute
267-- single-letter schemes. Reason: these are usually windows absolute