summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Logging.hs
diff options
context:
space:
mode:
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 2cca4b7d3..bf7f33d29 100644
--- a/src/Text/Pandoc/Logging.hs
+++ b/src/Text/Pandoc/Logging.hs
@@ -39,6 +39,7 @@ module Text.Pandoc.Logging (
, messageVerbosity
) where
+import Control.Monad (mzero)
import Data.Aeson
import Data.Aeson.Encode.Pretty (Config (..), defConfig, encodePretty',
keyOrder)
@@ -56,6 +57,15 @@ data Verbosity = ERROR | WARNING | INFO | DEBUG
instance ToJSON Verbosity where
toJSON x = toJSON (show x)
+instance FromJSON Verbosity where
+ parseJSON (String t) =
+ case t of
+ "ERROR" -> return ERROR
+ "WARNING" -> return WARNING
+ "INFO" -> return INFO
+ "DEBUG" -> return DEBUG
+ _ -> mzero
+ parseJSON _ = mzero
data LogMessage =
SkippedContent String SourcePos