diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-06-19 22:04:01 +0200 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-06-19 22:17:43 +0200 |
commit | 814ac51d3228eeb3bbcbf78a8a88a43cd11d23dd (patch) | |
tree | 25c4fbca3e8dff81527fdb4239dfe0ed14661d8d /src/Text/Pandoc/Logging.hs | |
parent | 4929d027dc57151dc7f009347478b35b90d2373b (diff) |
Separated tracing from logging.
Formerly tracing was just log messages with a DEBUG log
level. We now make these things independent. Tracing
can be turned on or off in PandocMonad using `setTrace`;
it is independent of logging.
* Removed `DEBUG` from `Verbosity`.
* Removed `ParserTrace` from `LogMessage`.
* Added `trace`, `setTrace` to `PandocMonad`.
Diffstat (limited to 'src/Text/Pandoc/Logging.hs')
-rw-r--r-- | src/Text/Pandoc/Logging.hs | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/src/Text/Pandoc/Logging.hs b/src/Text/Pandoc/Logging.hs index b31c33d4e..4090243ea 100644 --- a/src/Text/Pandoc/Logging.hs +++ b/src/Text/Pandoc/Logging.hs @@ -52,7 +52,7 @@ import Text.Pandoc.Definition import Text.Parsec.Pos -- | Verbosity level. -data Verbosity = ERROR | WARNING | INFO | DEBUG +data Verbosity = ERROR | WARNING | INFO deriving (Show, Read, Eq, Data, Enum, Ord, Bounded, Typeable, Generic) instance ToJSON Verbosity where @@ -63,7 +63,6 @@ instance FromJSON Verbosity where "ERROR" -> return ERROR "WARNING" -> return WARNING "INFO" -> return INFO - "DEBUG" -> return DEBUG _ -> mzero parseJSON _ = mzero @@ -78,7 +77,6 @@ data LogMessage = | CircularReference String SourcePos | ParsingUnescaped String SourcePos | CouldNotLoadIncludeFile String SourcePos - | ParsingTrace String SourcePos | InlineNotRendered Inline | BlockNotRendered Block | DocxParserWarning String @@ -151,11 +149,6 @@ instance ToJSON LogMessage where "source" .= Text.pack (sourceName pos), "line" .= toJSON (sourceLine pos), "column" .= toJSON (sourceColumn pos)] - ParsingTrace s pos -> - ["contents" .= Text.pack s, - "source" .= Text.pack (sourceName pos), - "line" .= sourceLine pos, - "column" .= sourceColumn pos] InlineNotRendered il -> ["contents" .= toJSON il] BlockNotRendered bl -> @@ -228,8 +221,6 @@ showLogMessage msg = "Parsing unescaped '" ++ s ++ "' at " ++ showPos pos CouldNotLoadIncludeFile fp pos -> "Could not load include file '" ++ fp ++ "' at " ++ showPos pos - ParsingTrace s pos -> - "Parsing trace at " ++ showPos pos ++ ": " ++ s InlineNotRendered il -> "Not rendering " ++ show il BlockNotRendered bl -> @@ -281,7 +272,6 @@ messageVerbosity msg = CircularReference{} -> WARNING CouldNotLoadIncludeFile{} -> WARNING ParsingUnescaped{} -> INFO - ParsingTrace{} -> DEBUG InlineNotRendered{} -> INFO BlockNotRendered{} -> INFO DocxParserWarning{} -> WARNING |