diff --git a/src/Text/Pandoc/Logging.hs b/src/Text/Pandoc/Logging.hs index 01a96d56fc91..04f90885049d 100644 --- a/src/Text/Pandoc/Logging.hs +++ b/src/Text/Pandoc/Logging.hs @@ -79,6 +79,7 @@ data LogMessage = | Fetching Text | Extracting Text | LoadedResource FilePath FilePath + | ScriptingInfo Text (Maybe SourcePos) | ScriptingWarning Text (Maybe SourcePos) | NoTitleElement Text | NoLangSpecified @@ -205,6 +206,14 @@ instance ToJSON LogMessage where LoadedResource orig found -> ["for" .= orig ,"from" .= found] + ScriptingInfo msg mbpos -> + ["message" .= msg] <> + case mbpos of + Nothing -> [] + Just pos -> ["source" .= sourceName pos + ,"line" .= toJSON (sourceLine pos) + ,"column" .= toJSON (sourceColumn pos) + ] ScriptingWarning msg mbpos -> ["message" .= msg] <> case mbpos of @@ -352,6 +361,9 @@ showLogMessage msg = "Extracting " <> fp <> "..." LoadedResource orig found -> "Loaded " <> Text.pack orig <> " from " <> Text.pack found + ScriptingInfo s mbpos -> + "Scripting info" <> + maybe "" (\pos -> " at " <> showPos pos) mbpos <> ": " <> s ScriptingWarning s mbpos -> "Scripting warning" <> maybe "" (\pos -> " at " <> showPos pos) mbpos <> ": " <> s @@ -451,6 +463,7 @@ messageVerbosity msg = Fetching{} -> INFO Extracting{} -> INFO LoadedResource{} -> INFO + ScriptingInfo{} -> INFO ScriptingWarning{} -> WARNING NoTitleElement{} -> WARNING NoLangSpecified -> INFO