git.iko.soy/typeable/pandoc
on master help sign in
Logging: add LoadedResource constructor to LogMessage.

[API change] This is for INFO-level messages telling where image data has been loaded from. (This can vary because of the resource path.)

commitfb40c8109dc969dce74c8153ad1c0d4b33d54a6c authorJohn MacFarlane <jgm@berkeley.edu> dateTue 25 May 2021, 10:07 (5 years ago) parentd46ea7d
1 file changed+7
src/Text/Pandoc/Logging.hs+7
src/Text/Pandoc/Logging.hs+7
@@ -85,6 +85,7 @@ data LogMessage =
8585 | CouldNotParseCSS Text
8686 | Fetching Text
8787 | Extracting Text
88+ | LoadedResource FilePath FilePath
8889 | NoTitleElement Text
8990 | NoLangSpecified
9091 | InvalidLang Text
@@ -195,6 +196,9 @@ instance ToJSON LogMessage where
195196 ["path" .= fp]
196197 Extracting fp ->
197198 ["path" .= fp]
199+ LoadedResource orig found ->
200+ ["for" .= orig
201+ ,"from" .= found]
198202 NoTitleElement fallback ->
199203 ["fallback" .= fallback]
200204 NoLangSpecified -> []
@@ -309,6 +313,8 @@ showLogMessage msg =
309313 "Fetching " <> fp <> "..."
310314 Extracting fp ->
311315 "Extracting " <> fp <> "..."
316+ LoadedResource orig found ->
317+ "Loaded " <> Text.pack orig <> " from " <> Text.pack found
312318 NoTitleElement fallback ->
313319 "This document format requires a nonempty <title> element.\n" <>
314320 "Defaulting to '" <> fallback <> "' as the title.\n" <>
@@ -389,6 +395,7 @@ messageVerbosity msg =
389395 CouldNotParseCSS{} -> WARNING
390396 Fetching{} -> INFO
391397 Extracting{} -> INFO
398+ LoadedResource{} -> INFO
392399 NoTitleElement{} -> WARNING
393400 NoLangSpecified -> INFO
394401 InvalidLang{} -> WARNING