summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Logging.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-02-15 17:35:29 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2017-02-15 17:35:29 +0100
commitebe4072bd9f1b76e4cc9abe7ae654cb0130fd775 (patch)
treed14dde13493851ee8c515bb7535d17dfef821455 /src/Text/Pandoc/Logging.hs
parent93f0a9c2e5664f61610dabb16109525c7b571708 (diff)
Add CircularReference constructor to LogMessage.
Diffstat (limited to 'src/Text/Pandoc/Logging.hs')
-rw-r--r--src/Text/Pandoc/Logging.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Logging.hs b/src/Text/Pandoc/Logging.hs
index 65ba9783a..1f98d019e 100644
--- a/src/Text/Pandoc/Logging.hs
+++ b/src/Text/Pandoc/Logging.hs
@@ -61,6 +61,7 @@ data LogMessage =
| DuplicateLinkReference String SourcePos
| DuplicateNoteReference String SourcePos
| ReferenceNotFound String SourcePos
+ | CircularReference String SourcePos
| ParsingUnescaped String SourcePos
| CouldNotLoadIncludeFile String SourcePos
| ParsingTrace String SourcePos
@@ -106,6 +107,12 @@ instance ToJSON LogMessage where
"source" .= Text.pack (sourceName pos),
"line" .= toJSON (sourceLine pos),
"column" .= toJSON (sourceColumn pos)]
+ CircularReference s pos ->
+ ["type" .= String "CircularReference",
+ "contents" .= Text.pack s,
+ "source" .= Text.pack (sourceName pos),
+ "line" .= toJSON (sourceLine pos),
+ "column" .= toJSON (sourceColumn pos)]
ParsingUnescaped s pos ->
["type" .= String "ParsingUnescaped",
"contents" .= Text.pack s,
@@ -176,6 +183,8 @@ showLogMessage msg =
"Duplicate note reference '" ++ s ++ "' at " ++ showPos pos
ReferenceNotFound s pos ->
"Reference not found for '" ++ s ++ "' at " ++ showPos pos
+ CircularReference s pos ->
+ "Circular reference '" ++ s ++ "' at " ++ showPos pos
ParsingUnescaped s pos ->
"Parsing unescaped '" ++ s ++ "' at " ++ showPos pos
CouldNotLoadIncludeFile fp pos ->
@@ -208,6 +217,7 @@ messageVerbosity msg =
DuplicateLinkReference{} -> WARNING
DuplicateNoteReference{} -> WARNING
ReferenceNotFound{} -> WARNING
+ CircularReference{} -> WARNING
CouldNotLoadIncludeFile{} -> WARNING
ParsingUnescaped{} -> INFO
ParsingTrace{} -> DEBUG