Logging: added MacroAlreadyDefined.

This commit is contained in:
John MacFarlane 2017-07-03 12:36:12 +02:00
parent 8300b3fbda
commit 1dd769e558

View file

@ -77,6 +77,7 @@ data LogMessage =
| CircularReference String SourcePos
| ParsingUnescaped String SourcePos
| CouldNotLoadIncludeFile String SourcePos
| MacroAlreadyDefined String SourcePos
| InlineNotRendered Inline
| BlockNotRendered Block
| DocxParserWarning String
@ -150,6 +151,11 @@ instance ToJSON LogMessage where
"source" .= Text.pack (sourceName pos),
"line" .= toJSON (sourceLine pos),
"column" .= toJSON (sourceColumn pos)]
MacroAlreadyDefined name pos ->
["name" .= Text.pack name,
"source" .= Text.pack (sourceName pos),
"line" .= toJSON (sourceLine pos),
"column" .= toJSON (sourceColumn pos)]
InlineNotRendered il ->
["contents" .= toJSON il]
BlockNotRendered bl ->
@ -224,6 +230,8 @@ showLogMessage msg =
"Parsing unescaped '" ++ s ++ "' at " ++ showPos pos
CouldNotLoadIncludeFile fp pos ->
"Could not load include file '" ++ fp ++ "' at " ++ showPos pos
MacroAlreadyDefined name pos ->
"Macro '" ++ name ++ "' already defined, ignoring at " ++ showPos pos
InlineNotRendered il ->
"Not rendering " ++ show il
BlockNotRendered bl ->
@ -277,6 +285,7 @@ messageVerbosity msg =
ReferenceNotFound{} -> WARNING
CircularReference{} -> WARNING
CouldNotLoadIncludeFile{} -> WARNING
MacroAlreadyDefined{} -> WARNING
ParsingUnescaped{} -> INFO
InlineNotRendered{} -> INFO
BlockNotRendered{} -> INFO