{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric      #-}
{-# LANGUAGE LambdaCase         #-}
{-# LANGUAGE OverloadedStrings  #-}
{- |
   Module      : Text.Pandoc.Logging
   Copyright   : Copyright (C) 2006-2020 John MacFarlane
   License     : GNU GPL, version 2 or above

   Maintainer  : John MacFarlane <jgm@berkeley.edu>
   Stability   : alpha
   Portability : portable

This module provides data types and functions for warnings
and info messages.

-}
module Text.Pandoc.Logging (
    Verbosity(..)
  , LogMessage(..)
  , encodeLogMessages
  , showLogMessage
  , messageVerbosity
  ) where

import Control.Monad (mzero)
import Data.YAML (withStr, FromYAML(..))
import Data.Aeson
import Data.Aeson.Encode.Pretty (Config (..), defConfig, encodePretty',
                                 keyOrder)
import qualified Data.ByteString.Lazy as BL
import Data.Data (Data, toConstr)
import qualified Data.Text as Text
import Data.Typeable (Typeable)
import GHC.Generics (Generic)
import Text.Pandoc.Definition
import Text.Parsec.Pos

-- | Verbosity level.
data Verbosity = ERROR | WARNING | INFO
     deriving (Int -> Verbosity -> ShowS
[Verbosity] -> ShowS
Verbosity -> String
(Int -> Verbosity -> ShowS)
-> (Verbosity -> String)
-> ([Verbosity] -> ShowS)
-> Show Verbosity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Verbosity] -> ShowS
$cshowList :: [Verbosity] -> ShowS
show :: Verbosity -> String
$cshow :: Verbosity -> String
showsPrec :: Int -> Verbosity -> ShowS
$cshowsPrec :: Int -> Verbosity -> ShowS
Show, ReadPrec [Verbosity]
ReadPrec Verbosity
Int -> ReadS Verbosity
ReadS [Verbosity]
(Int -> ReadS Verbosity)
-> ReadS [Verbosity]
-> ReadPrec Verbosity
-> ReadPrec [Verbosity]
-> Read Verbosity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Verbosity]
$creadListPrec :: ReadPrec [Verbosity]
readPrec :: ReadPrec Verbosity
$creadPrec :: ReadPrec Verbosity
readList :: ReadS [Verbosity]
$creadList :: ReadS [Verbosity]
readsPrec :: Int -> ReadS Verbosity
$creadsPrec :: Int -> ReadS Verbosity
Read, Verbosity -> Verbosity -> Bool
(Verbosity -> Verbosity -> Bool)
-> (Verbosity -> Verbosity -> Bool) -> Eq Verbosity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Verbosity -> Verbosity -> Bool
$c/= :: Verbosity -> Verbosity -> Bool
== :: Verbosity -> Verbosity -> Bool
$c== :: Verbosity -> Verbosity -> Bool
Eq, Typeable Verbosity
DataType
Constr
Typeable Verbosity
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Verbosity -> c Verbosity)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Verbosity)
-> (Verbosity -> Constr)
-> (Verbosity -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Verbosity))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Verbosity))
-> ((forall b. Data b => b -> b) -> Verbosity -> Verbosity)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Verbosity -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Verbosity -> r)
-> (forall u. (forall d. Data d => d -> u) -> Verbosity -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> Verbosity -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Verbosity -> m Verbosity)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Verbosity -> m Verbosity)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Verbosity -> m Verbosity)
-> Data Verbosity
Verbosity -> DataType
Verbosity -> Constr
(forall b. Data b => b -> b) -> Verbosity -> Verbosity
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Verbosity -> c Verbosity
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Verbosity
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Verbosity -> u
forall u. (forall d. Data d => d -> u) -> Verbosity -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Verbosity -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Verbosity -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Verbosity -> m Verbosity
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Verbosity -> m Verbosity
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Verbosity
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Verbosity -> c Verbosity
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Verbosity)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Verbosity)
$cINFO :: Constr
$cWARNING :: Constr
$cERROR :: Constr
$tVerbosity :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Verbosity -> m Verbosity
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Verbosity -> m Verbosity
gmapMp :: (forall d. Data d => d -> m d) -> Verbosity -> m Verbosity
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Verbosity -> m Verbosity
gmapM :: (forall d. Data d => d -> m d) -> Verbosity -> m Verbosity
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Verbosity -> m Verbosity
gmapQi :: Int -> (forall d. Data d => d -> u) -> Verbosity -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Verbosity -> u
gmapQ :: (forall d. Data d => d -> u) -> Verbosity -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Verbosity -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Verbosity -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Verbosity -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Verbosity -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Verbosity -> r
gmapT :: (forall b. Data b => b -> b) -> Verbosity -> Verbosity
$cgmapT :: (forall b. Data b => b -> b) -> Verbosity -> Verbosity
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Verbosity)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Verbosity)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Verbosity)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Verbosity)
dataTypeOf :: Verbosity -> DataType
$cdataTypeOf :: Verbosity -> DataType
toConstr :: Verbosity -> Constr
$ctoConstr :: Verbosity -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Verbosity
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Verbosity
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Verbosity -> c Verbosity
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Verbosity -> c Verbosity
$cp1Data :: Typeable Verbosity
Data, Int -> Verbosity
Verbosity -> Int
Verbosity -> [Verbosity]
Verbosity -> Verbosity
Verbosity -> Verbosity -> [Verbosity]
Verbosity -> Verbosity -> Verbosity -> [Verbosity]
(Verbosity -> Verbosity)
-> (Verbosity -> Verbosity)
-> (Int -> Verbosity)
-> (Verbosity -> Int)
-> (Verbosity -> [Verbosity])
-> (Verbosity -> Verbosity -> [Verbosity])
-> (Verbosity -> Verbosity -> [Verbosity])
-> (Verbosity -> Verbosity -> Verbosity -> [Verbosity])
-> Enum Verbosity
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: Verbosity -> Verbosity -> Verbosity -> [Verbosity]
$cenumFromThenTo :: Verbosity -> Verbosity -> Verbosity -> [Verbosity]
enumFromTo :: Verbosity -> Verbosity -> [Verbosity]
$cenumFromTo :: Verbosity -> Verbosity -> [Verbosity]
enumFromThen :: Verbosity -> Verbosity -> [Verbosity]
$cenumFromThen :: Verbosity -> Verbosity -> [Verbosity]
enumFrom :: Verbosity -> [Verbosity]
$cenumFrom :: Verbosity -> [Verbosity]
fromEnum :: Verbosity -> Int
$cfromEnum :: Verbosity -> Int
toEnum :: Int -> Verbosity
$ctoEnum :: Int -> Verbosity
pred :: Verbosity -> Verbosity
$cpred :: Verbosity -> Verbosity
succ :: Verbosity -> Verbosity
$csucc :: Verbosity -> Verbosity
Enum, Eq Verbosity
Eq Verbosity
-> (Verbosity -> Verbosity -> Ordering)
-> (Verbosity -> Verbosity -> Bool)
-> (Verbosity -> Verbosity -> Bool)
-> (Verbosity -> Verbosity -> Bool)
-> (Verbosity -> Verbosity -> Bool)
-> (Verbosity -> Verbosity -> Verbosity)
-> (Verbosity -> Verbosity -> Verbosity)
-> Ord Verbosity
Verbosity -> Verbosity -> Bool
Verbosity -> Verbosity -> Ordering
Verbosity -> Verbosity -> Verbosity
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Verbosity -> Verbosity -> Verbosity
$cmin :: Verbosity -> Verbosity -> Verbosity
max :: Verbosity -> Verbosity -> Verbosity
$cmax :: Verbosity -> Verbosity -> Verbosity
>= :: Verbosity -> Verbosity -> Bool
$c>= :: Verbosity -> Verbosity -> Bool
> :: Verbosity -> Verbosity -> Bool
$c> :: Verbosity -> Verbosity -> Bool
<= :: Verbosity -> Verbosity -> Bool
$c<= :: Verbosity -> Verbosity -> Bool
< :: Verbosity -> Verbosity -> Bool
$c< :: Verbosity -> Verbosity -> Bool
compare :: Verbosity -> Verbosity -> Ordering
$ccompare :: Verbosity -> Verbosity -> Ordering
$cp1Ord :: Eq Verbosity
Ord, Verbosity
Verbosity -> Verbosity -> Bounded Verbosity
forall a. a -> a -> Bounded a
maxBound :: Verbosity
$cmaxBound :: Verbosity
minBound :: Verbosity
$cminBound :: Verbosity
Bounded, Typeable, (forall x. Verbosity -> Rep Verbosity x)
-> (forall x. Rep Verbosity x -> Verbosity) -> Generic Verbosity
forall x. Rep Verbosity x -> Verbosity
forall x. Verbosity -> Rep Verbosity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Verbosity x -> Verbosity
$cfrom :: forall x. Verbosity -> Rep Verbosity x
Generic)

instance ToJSON Verbosity where
  toJSON :: Verbosity -> Value
toJSON Verbosity
x = String -> Value
forall a. ToJSON a => a -> Value
toJSON (Verbosity -> String
forall a. Show a => a -> String
show Verbosity
x)
instance FromJSON Verbosity where
  parseJSON :: Value -> Parser Verbosity
parseJSON (String Text
t) =
    case Text
t of
         Text
"ERROR"   -> Verbosity -> Parser Verbosity
forall (m :: * -> *) a. Monad m => a -> m a
return Verbosity
ERROR
         Text
"WARNING" -> Verbosity -> Parser Verbosity
forall (m :: * -> *) a. Monad m => a -> m a
return Verbosity
WARNING
         Text
"INFO"    -> Verbosity -> Parser Verbosity
forall (m :: * -> *) a. Monad m => a -> m a
return Verbosity
INFO
         Text
_         -> Parser Verbosity
forall (m :: * -> *) a. MonadPlus m => m a
mzero
  parseJSON Value
_      =  Parser Verbosity
forall (m :: * -> *) a. MonadPlus m => m a
mzero

instance FromYAML Verbosity where
  parseYAML :: Node Pos -> Parser Verbosity
parseYAML = String
-> (Text -> Parser Verbosity) -> Node Pos -> Parser Verbosity
forall a. String -> (Text -> Parser a) -> Node Pos -> Parser a
withStr String
"Verbosity" ((Text -> Parser Verbosity) -> Node Pos -> Parser Verbosity)
-> (Text -> Parser Verbosity) -> Node Pos -> Parser Verbosity
forall a b. (a -> b) -> a -> b
$ \case
         Text
"ERROR"   -> Verbosity -> Parser Verbosity
forall (m :: * -> *) a. Monad m => a -> m a
return Verbosity
ERROR
         Text
"WARNING" -> Verbosity -> Parser Verbosity
forall (m :: * -> *) a. Monad m => a -> m a
return Verbosity
WARNING
         Text
"INFO"    -> Verbosity -> Parser Verbosity
forall (m :: * -> *) a. Monad m => a -> m a
return Verbosity
INFO
         Text
_         -> Parser Verbosity
forall (m :: * -> *) a. MonadPlus m => m a
mzero

data LogMessage =
    SkippedContent Text.Text SourcePos
  | IgnoredElement Text.Text
  | DuplicateLinkReference Text.Text SourcePos
  | DuplicateNoteReference Text.Text SourcePos
  | NoteDefinedButNotUsed Text.Text SourcePos
  | DuplicateIdentifier Text.Text SourcePos
  | ReferenceNotFound Text.Text SourcePos
  | CircularReference Text.Text SourcePos
  | UndefinedToggle Text.Text SourcePos
  | ParsingUnescaped Text.Text SourcePos
  | CouldNotLoadIncludeFile Text.Text SourcePos
  | MacroAlreadyDefined Text.Text SourcePos
  | InlineNotRendered Inline
  | BlockNotRendered Block
  | DocxParserWarning Text.Text
  | IgnoredIOError Text.Text
  | CouldNotFetchResource Text.Text Text.Text
  | CouldNotDetermineImageSize Text.Text Text.Text
  | CouldNotConvertImage Text.Text Text.Text
  | CouldNotDetermineMimeType Text.Text
  | CouldNotConvertTeXMath Text.Text Text.Text
  | CouldNotParseCSS Text.Text
  | Fetching Text.Text
  | Extracting Text.Text
  | NoTitleElement Text.Text
  | NoLangSpecified
  | InvalidLang Text.Text
  | CouldNotHighlight Text.Text
  | MissingCharacter Text.Text
  | Deprecated Text.Text Text.Text
  | NoTranslation Text.Text
  | CouldNotLoadTranslations Text.Text Text.Text
  | UnusualConversion Text.Text
  | UnexpectedXmlElement Text.Text Text.Text
  | UnknownOrgExportOption Text.Text
  | CouldNotDeduceFormat [Text.Text] Text.Text
  | RunningFilter FilePath
  | FilterCompleted FilePath Integer
  | CiteprocWarning Text.Text
  deriving (Int -> LogMessage -> ShowS
[LogMessage] -> ShowS
LogMessage -> String
(Int -> LogMessage -> ShowS)
-> (LogMessage -> String)
-> ([LogMessage] -> ShowS)
-> Show LogMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LogMessage] -> ShowS
$cshowList :: [LogMessage] -> ShowS
show :: LogMessage -> String
$cshow :: LogMessage -> String
showsPrec :: Int -> LogMessage -> ShowS
$cshowsPrec :: Int -> LogMessage -> ShowS
Show, LogMessage -> LogMessage -> Bool
(LogMessage -> LogMessage -> Bool)
-> (LogMessage -> LogMessage -> Bool) -> Eq LogMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LogMessage -> LogMessage -> Bool
$c/= :: LogMessage -> LogMessage -> Bool
== :: LogMessage -> LogMessage -> Bool
$c== :: LogMessage -> LogMessage -> Bool
Eq, Typeable LogMessage
DataType
Constr
Typeable LogMessage
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> LogMessage -> c LogMessage)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c LogMessage)
-> (LogMessage -> Constr)
-> (LogMessage -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c LogMessage))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c LogMessage))
-> ((forall b. Data b => b -> b) -> LogMessage -> LogMessage)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> LogMessage -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> LogMessage -> r)
-> (forall u. (forall d. Data d => d -> u) -> LogMessage -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> LogMessage -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> LogMessage -> m LogMessage)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> LogMessage -> m LogMessage)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> LogMessage -> m LogMessage)
-> Data LogMessage
LogMessage -> DataType
LogMessage -> Constr
(forall b. Data b => b -> b) -> LogMessage -> LogMessage
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LogMessage -> c LogMessage
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LogMessage
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> LogMessage -> u
forall u. (forall d. Data d => d -> u) -> LogMessage -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LogMessage -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LogMessage -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> LogMessage -> m LogMessage
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LogMessage -> m LogMessage
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LogMessage
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LogMessage -> c LogMessage
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LogMessage)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LogMessage)
$cCiteprocWarning :: Constr
$cFilterCompleted :: Constr
$cRunningFilter :: Constr
$cCouldNotDeduceFormat :: Constr
$cUnknownOrgExportOption :: Constr
$cUnexpectedXmlElement :: Constr
$cUnusualConversion :: Constr
$cCouldNotLoadTranslations :: Constr
$cNoTranslation :: Constr
$cDeprecated :: Constr
$cMissingCharacter :: Constr
$cCouldNotHighlight :: Constr
$cInvalidLang :: Constr
$cNoLangSpecified :: Constr
$cNoTitleElement :: Constr
$cExtracting :: Constr
$cFetching :: Constr
$cCouldNotParseCSS :: Constr
$cCouldNotConvertTeXMath :: Constr
$cCouldNotDetermineMimeType :: Constr
$cCouldNotConvertImage :: Constr
$cCouldNotDetermineImageSize :: Constr
$cCouldNotFetchResource :: Constr
$cIgnoredIOError :: Constr
$cDocxParserWarning :: Constr
$cBlockNotRendered :: Constr
$cInlineNotRendered :: Constr
$cMacroAlreadyDefined :: Constr
$cCouldNotLoadIncludeFile :: Constr
$cParsingUnescaped :: Constr
$cUndefinedToggle :: Constr
$cCircularReference :: Constr
$cReferenceNotFound :: Constr
$cDuplicateIdentifier :: Constr
$cNoteDefinedButNotUsed :: Constr
$cDuplicateNoteReference :: Constr
$cDuplicateLinkReference :: Constr
$cIgnoredElement :: Constr
$cSkippedContent :: Constr
$tLogMessage :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> LogMessage -> m LogMessage
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LogMessage -> m LogMessage
gmapMp :: (forall d. Data d => d -> m d) -> LogMessage -> m LogMessage
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LogMessage -> m LogMessage
gmapM :: (forall d. Data d => d -> m d) -> LogMessage -> m LogMessage
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> LogMessage -> m LogMessage
gmapQi :: Int -> (forall d. Data d => d -> u) -> LogMessage -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> LogMessage -> u
gmapQ :: (forall d. Data d => d -> u) -> LogMessage -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> LogMessage -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LogMessage -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LogMessage -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LogMessage -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LogMessage -> r
gmapT :: (forall b. Data b => b -> b) -> LogMessage -> LogMessage
$cgmapT :: (forall b. Data b => b -> b) -> LogMessage -> LogMessage
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LogMessage)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LogMessage)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c LogMessage)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LogMessage)
dataTypeOf :: LogMessage -> DataType
$cdataTypeOf :: LogMessage -> DataType
toConstr :: LogMessage -> Constr
$ctoConstr :: LogMessage -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LogMessage
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LogMessage
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LogMessage -> c LogMessage
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LogMessage -> c LogMessage
$cp1Data :: Typeable LogMessage
Data, Eq LogMessage
Eq LogMessage
-> (LogMessage -> LogMessage -> Ordering)
-> (LogMessage -> LogMessage -> Bool)
-> (LogMessage -> LogMessage -> Bool)
-> (LogMessage -> LogMessage -> Bool)
-> (LogMessage -> LogMessage -> Bool)
-> (LogMessage -> LogMessage -> LogMessage)
-> (LogMessage -> LogMessage -> LogMessage)
-> Ord LogMessage
LogMessage -> LogMessage -> Bool
LogMessage -> LogMessage -> Ordering
LogMessage -> LogMessage -> LogMessage
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: LogMessage -> LogMessage -> LogMessage
$cmin :: LogMessage -> LogMessage -> LogMessage
max :: LogMessage -> LogMessage -> LogMessage
$cmax :: LogMessage -> LogMessage -> LogMessage
>= :: LogMessage -> LogMessage -> Bool
$c>= :: LogMessage -> LogMessage -> Bool
> :: LogMessage -> LogMessage -> Bool
$c> :: LogMessage -> LogMessage -> Bool
<= :: LogMessage -> LogMessage -> Bool
$c<= :: LogMessage -> LogMessage -> Bool
< :: LogMessage -> LogMessage -> Bool
$c< :: LogMessage -> LogMessage -> Bool
compare :: LogMessage -> LogMessage -> Ordering
$ccompare :: LogMessage -> LogMessage -> Ordering
$cp1Ord :: Eq LogMessage
Ord, Typeable, (forall x. LogMessage -> Rep LogMessage x)
-> (forall x. Rep LogMessage x -> LogMessage) -> Generic LogMessage
forall x. Rep LogMessage x -> LogMessage
forall x. LogMessage -> Rep LogMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LogMessage x -> LogMessage
$cfrom :: forall x. LogMessage -> Rep LogMessage x
Generic)

instance ToJSON LogMessage where
  toJSON :: LogMessage -> Value
toJSON LogMessage
x = [Pair] -> Value
object ([Pair] -> Value) -> [Pair] -> Value
forall a b. (a -> b) -> a -> b
$
    Text
"verbosity" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Verbosity -> Value
forall a. ToJSON a => a -> Value
toJSON (LogMessage -> Verbosity
messageVerbosity LogMessage
x) Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
:
    Text
"type" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= String -> Value
forall a. ToJSON a => a -> Value
toJSON (Constr -> String
forall a. Show a => a -> String
show (Constr -> String) -> Constr -> String
forall a b. (a -> b) -> a -> b
$ LogMessage -> Constr
forall a. Data a => a -> Constr
toConstr LogMessage
x) Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
:
    case LogMessage
x of
      SkippedContent Text
s SourcePos
pos ->
           [Text
"contents" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s,
            Text
"source" Text -> String -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= SourcePos -> String
sourceName SourcePos
pos,
            Text
"line" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= SourcePos -> Int
sourceLine SourcePos
pos,
            Text
"column" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= SourcePos -> Int
sourceColumn SourcePos
pos]
      IgnoredElement Text
s ->
           [Text
"contents" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s]
      DuplicateLinkReference Text
s SourcePos
pos ->
           [Text
"contents" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s,
            Text
"source" Text -> String -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= SourcePos -> String
sourceName SourcePos
pos,
            Text
"line" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceLine SourcePos
pos),
            Text
"column" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceColumn SourcePos
pos)]
      NoteDefinedButNotUsed Text
s SourcePos
pos ->
           [Text
"key" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s,
            Text
"source" Text -> String -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= SourcePos -> String
sourceName SourcePos
pos,
            Text
"line" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceLine SourcePos
pos),
            Text
"column" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceColumn SourcePos
pos)]
      DuplicateNoteReference Text
s SourcePos
pos ->
           [Text
"contents" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s,
            Text
"source" Text -> String -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= SourcePos -> String
sourceName SourcePos
pos,
            Text
"line" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceLine SourcePos
pos),
            Text
"column" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceColumn SourcePos
pos)]
      DuplicateIdentifier Text
s SourcePos
pos ->
           [Text
"contents" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s,
            Text
"source" Text -> String -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= SourcePos -> String
sourceName SourcePos
pos,
            Text
"line" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceLine SourcePos
pos),
            Text
"column" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceColumn SourcePos
pos)]
      ReferenceNotFound Text
s SourcePos
pos ->
           [Text
"contents" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s,
            Text
"source" Text -> String -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= SourcePos -> String
sourceName SourcePos
pos,
            Text
"line" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceLine SourcePos
pos),
            Text
"column" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceColumn SourcePos
pos)]
      CircularReference Text
s SourcePos
pos ->
           [Text
"contents" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s,
            Text
"source" Text -> String -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= SourcePos -> String
sourceName SourcePos
pos,
            Text
"line" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceLine SourcePos
pos),
            Text
"column" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceColumn SourcePos
pos)]
      UndefinedToggle Text
s SourcePos
pos ->
           [Text
"contents" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s,
            Text
"source" Text -> String -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= SourcePos -> String
sourceName SourcePos
pos,
            Text
"line" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceLine SourcePos
pos),
            Text
"column" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceColumn SourcePos
pos)]
      ParsingUnescaped Text
s SourcePos
pos ->
           [Text
"contents" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s,
            Text
"source" Text -> String -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= SourcePos -> String
sourceName SourcePos
pos,
            Text
"line" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceLine SourcePos
pos),
            Text
"column" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceColumn SourcePos
pos)]
      CouldNotLoadIncludeFile Text
fp SourcePos
pos ->
           [Text
"path" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
fp,
            Text
"source" Text -> String -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= SourcePos -> String
sourceName SourcePos
pos,
            Text
"line" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceLine SourcePos
pos),
            Text
"column" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceColumn SourcePos
pos)]
      MacroAlreadyDefined Text
name SourcePos
pos ->
           [Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
name,
            Text
"source" Text -> String -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= SourcePos -> String
sourceName SourcePos
pos,
            Text
"line" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceLine SourcePos
pos),
            Text
"column" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceColumn SourcePos
pos)]
      InlineNotRendered Inline
il ->
           [Text
"contents" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Inline -> Value
forall a. ToJSON a => a -> Value
toJSON Inline
il]
      BlockNotRendered Block
bl ->
           [Text
"contents" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Block -> Value
forall a. ToJSON a => a -> Value
toJSON Block
bl]
      DocxParserWarning Text
s ->
           [Text
"contents" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s]
      IgnoredIOError Text
s ->
           [Text
"contents" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s]
      CouldNotFetchResource Text
fp Text
s ->
           [Text
"path" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
fp,
            Text
"message" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s]
      CouldNotDetermineImageSize Text
fp Text
s ->
           [Text
"path" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
fp,
            Text
"message" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s]
      CouldNotConvertImage Text
fp Text
s ->
           [Text
"path" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
fp,
            Text
"message" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s]
      CouldNotDetermineMimeType Text
fp ->
           [Text
"path" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
fp]
      CouldNotConvertTeXMath Text
s Text
msg ->
           [Text
"contents" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s,
            Text
"message" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
msg]
      CouldNotParseCSS Text
msg ->
           [Text
"message" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
msg]
      Fetching Text
fp ->
           [Text
"path" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
fp]
      Extracting Text
fp ->
           [Text
"path" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
fp]
      NoTitleElement Text
fallback ->
           [Text
"fallback" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
fallback]
      LogMessage
NoLangSpecified -> []
      InvalidLang Text
s ->
           [Text
"lang" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
s]
      CouldNotHighlight Text
msg ->
           [Text
"message" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
msg]
      MissingCharacter Text
msg ->
           [Text
"message" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
msg]
      Deprecated Text
thing Text
msg ->
           [Text
"thing" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
thing,
            Text
"message" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
msg]
      NoTranslation Text
term ->
           [Text
"term" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
term]
      CouldNotLoadTranslations Text
lang Text
msg ->
           [Text
"lang" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
lang,
            Text
"message" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
msg]
      UnusualConversion Text
msg ->
           [Text
"message" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
msg]
      UnexpectedXmlElement Text
element Text
parent ->
           [Text
"element" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
element,
            Text
"parent" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
parent]
      UnknownOrgExportOption Text
option ->
           [Text
"option" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
option]
      CouldNotDeduceFormat [Text]
exts Text
format ->
           [Text
"extensions" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= [Text]
exts
           ,Text
"format" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
format]
      RunningFilter String
fp ->
           [Text
"path" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= String -> Text
Text.pack String
fp ]
      FilterCompleted String
fp Integer
ms ->
           [Text
"path" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= String -> Text
Text.pack String
fp
           ,Text
"milliseconds" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= String -> Text
Text.pack (Integer -> String
forall a. Show a => a -> String
show Integer
ms) ]
      CiteprocWarning Text
msg ->
           [Text
"message" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
.= Text
msg]

showPos :: SourcePos -> Text.Text
showPos :: SourcePos -> Text
showPos SourcePos
pos = String -> Text
Text.pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ String
sn String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
"line " String -> ShowS
forall a. [a] -> [a] -> [a]
++
     Int -> String
forall a. Show a => a -> String
show (SourcePos -> Int
sourceLine SourcePos
pos) String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
" column " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show (SourcePos -> Int
sourceColumn SourcePos
pos)
  where sn :: String
sn = if SourcePos -> String
sourceName SourcePos
pos String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
"source" Bool -> Bool -> Bool
|| SourcePos -> String
sourceName SourcePos
pos String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
""
                then String
""
                else SourcePos -> String
sourceName SourcePos
pos String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
" "

encodeLogMessages :: [LogMessage] -> BL.ByteString
encodeLogMessages :: [LogMessage] -> ByteString
encodeLogMessages [LogMessage]
ms =
  Config -> [LogMessage] -> ByteString
forall a. ToJSON a => Config -> a -> ByteString
encodePretty' Config
defConfig{ confCompare :: Text -> Text -> Ordering
confCompare =
      [Text] -> Text -> Text -> Ordering
keyOrder [ Text
"type", Text
"verbosity", Text
"contents", Text
"message", Text
"path",
                 Text
"source", Text
"line", Text
"column" ] } [LogMessage]
ms

showLogMessage :: LogMessage -> Text.Text
showLogMessage :: LogMessage -> Text
showLogMessage LogMessage
msg =
  case LogMessage
msg of
       SkippedContent Text
s SourcePos
pos ->
         Text
"Skipped '" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
s Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"' at " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> SourcePos -> Text
showPos SourcePos
pos
       IgnoredElement Text
s ->
         Text
"Ignored element " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
s
       DuplicateLinkReference Text
s SourcePos
pos ->
         Text
"Duplicate link reference '" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
s Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"' at " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> SourcePos -> Text
showPos SourcePos
pos
       DuplicateNoteReference Text
s SourcePos
pos ->
         Text
"Duplicate note reference '" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
s Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"' at " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> SourcePos -> Text
showPos SourcePos
pos
       NoteDefinedButNotUsed Text
s SourcePos
pos ->
         Text
"Note with key '" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
s Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"' defined at " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> SourcePos -> Text
showPos SourcePos
pos Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>
           Text
" but not used."
       DuplicateIdentifier Text
s SourcePos
pos ->
         Text
"Duplicate identifier '" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
s Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"' at " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> SourcePos -> Text
showPos SourcePos
pos
       ReferenceNotFound Text
s SourcePos
pos ->
         Text
"Reference not found for '" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
s Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"' at " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> SourcePos -> Text
showPos SourcePos
pos
       CircularReference Text
s SourcePos
pos ->
         Text
"Circular reference '" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
s Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"' at " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> SourcePos -> Text
showPos SourcePos
pos
       UndefinedToggle Text
s SourcePos
pos ->
         Text
"Undefined toggle '" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
s Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"' at " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> SourcePos -> Text
showPos SourcePos
pos
       ParsingUnescaped Text
s SourcePos
pos ->
         Text
"Parsing unescaped '" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
s Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"' at " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> SourcePos -> Text
showPos SourcePos
pos
       CouldNotLoadIncludeFile Text
fp SourcePos
pos ->
         Text
"Could not load include file '" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
fp Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"' at " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> SourcePos -> Text
showPos SourcePos
pos
       MacroAlreadyDefined Text
name SourcePos
pos ->
         Text
"Macro '" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
name Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"' already defined, ignoring at " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> SourcePos -> Text
showPos SourcePos
pos
       InlineNotRendered Inline
il ->
         Text
"Not rendering " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> String -> Text
Text.pack (Inline -> String
forall a. Show a => a -> String
show Inline
il)
       BlockNotRendered Block
bl ->
         Text
"Not rendering " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> String -> Text
Text.pack (Block -> String
forall a. Show a => a -> String
show Block
bl)
       DocxParserWarning Text
s ->
         Text
"Docx parser warning: " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
s
       IgnoredIOError Text
s ->
         Text
"IO Error (ignored): " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
s
       CouldNotFetchResource Text
fp Text
s ->
         Text
"Could not fetch resource '" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
fp Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"'" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>
           if Text -> Bool
Text.null Text
s then Text
"" else Text
": " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
s
       CouldNotDetermineImageSize Text
fp Text
s ->
         Text
"Could not determine image size for '" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
fp Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"'" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>
           if Text -> Bool
Text.null Text
s then Text
"" else Text
": " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
s
       CouldNotConvertImage Text
fp Text
s ->
         Text
"Could not convert image '" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
fp Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"'" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>
           if Text -> Bool
Text.null Text
s then Text
"" else Text
": " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
s
       CouldNotDetermineMimeType Text
fp ->
         Text
"Could not determine mime type for '" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
fp Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"'"
       CouldNotConvertTeXMath Text
s Text
m ->
         Text
"Could not convert TeX math '" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
s Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"', rendering as TeX" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>
           if Text -> Bool
Text.null Text
m then Text
"" else Text
":\n" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
m
       CouldNotParseCSS Text
m ->
         Text
"Could not parse CSS" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> if Text -> Bool
Text.null Text
m then Text
"" else Text
":\n" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
m
       Fetching Text
fp ->
         Text
"Fetching " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
fp Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"..."
       Extracting Text
fp ->
         Text
"Extracting " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
fp Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"..."
       NoTitleElement Text
fallback ->
         Text
"This document format requires a nonempty <title> element.\n" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>
         Text
"Defaulting to '" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
fallback Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"' as the title.\n" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>
         Text
"To specify a title, use 'title' in metadata or " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>
         Text
"--metadata title=\"...\"."
       LogMessage
NoLangSpecified ->
         Text
"No value for 'lang' was specified in the metadata.\n" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>
         Text
"It is recommended that lang be specified for this format."
       InvalidLang Text
s ->
         Text
"Invalid 'lang' value '" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
s Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"'.\n" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>
         Text
"Use an IETF language tag like 'en-US'."
       CouldNotHighlight Text
m ->
         Text
"Could not highlight code block:\n" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
m
       MissingCharacter Text
m ->
         Text
"Missing character: " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
m
       Deprecated Text
t Text
m ->
         Text
"Deprecated: " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
t Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>
         if Text -> Bool
Text.null Text
m
            then Text
""
            else Text
". " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
m
       NoTranslation Text
t ->
         Text
"The term " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
t Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
" has no translation defined."
       CouldNotLoadTranslations Text
lang Text
m ->
         Text
"Could not load translations for " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
lang Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>
           if Text -> Bool
Text.null Text
m then Text
"" else Text
"\n" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
m
       UnusualConversion Text
m ->
         Text
"Unusual conversion: " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
m
       UnexpectedXmlElement Text
element Text
parent ->
         Text
"Unexpected XML element " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
element Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
" in " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
parent
       UnknownOrgExportOption Text
option ->
         Text
"Ignoring unknown Org export option: " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
option
       CouldNotDeduceFormat [Text]
exts Text
format ->
         Text
"Could not deduce format from file extension " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>
         Text -> [Text] -> Text
Text.intercalate Text
" or " [Text]
exts Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"\n" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>
         Text
"Defaulting to " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
format
       RunningFilter String
fp -> Text
"Running filter " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> String -> Text
Text.pack String
fp
       FilterCompleted String
fp Integer
ms -> Text
"Completed filter " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> String -> Text
Text.pack String
fp Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>
          Text
" in " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> String -> Text
Text.pack (Integer -> String
forall a. Show a => a -> String
show Integer
ms) Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
" ms"
       CiteprocWarning Text
ms -> Text
"Citeproc: " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
ms

messageVerbosity :: LogMessage -> Verbosity
messageVerbosity :: LogMessage -> Verbosity
messageVerbosity LogMessage
msg =
  case LogMessage
msg of
       SkippedContent{}              -> Verbosity
INFO
       IgnoredElement{}              -> Verbosity
INFO
       DuplicateLinkReference{}      -> Verbosity
WARNING
       DuplicateNoteReference{}      -> Verbosity
WARNING
       NoteDefinedButNotUsed{}       -> Verbosity
WARNING
       DuplicateIdentifier{}         -> Verbosity
WARNING
       ReferenceNotFound{}           -> Verbosity
WARNING
       CircularReference{}           -> Verbosity
WARNING
       UndefinedToggle{}             -> Verbosity
WARNING
       CouldNotLoadIncludeFile Text
f SourcePos
_
        | Text
".sty" Text -> Text -> Bool
`Text.isSuffixOf` Text
f -> Verbosity
INFO
        | Bool
otherwise                  -> Verbosity
WARNING
       MacroAlreadyDefined{}         -> Verbosity
WARNING
       ParsingUnescaped{}            -> Verbosity
INFO
       InlineNotRendered{}           -> Verbosity
INFO
       BlockNotRendered{}            -> Verbosity
INFO
       DocxParserWarning{}           -> Verbosity
INFO
       IgnoredIOError{}              -> Verbosity
WARNING
       CouldNotFetchResource{}       -> Verbosity
WARNING
       CouldNotDetermineImageSize{}  -> Verbosity
WARNING
       CouldNotConvertImage{}        -> Verbosity
WARNING
       CouldNotDetermineMimeType{}   -> Verbosity
WARNING
       CouldNotConvertTeXMath{}      -> Verbosity
WARNING
       CouldNotParseCSS{}            -> Verbosity
WARNING
       Fetching{}                    -> Verbosity
INFO
       Extracting{}                  -> Verbosity
INFO
       NoTitleElement{}              -> Verbosity
WARNING
       LogMessage
NoLangSpecified               -> Verbosity
INFO
       InvalidLang{}                 -> Verbosity
WARNING
       CouldNotHighlight{}           -> Verbosity
WARNING
       MissingCharacter{}            -> Verbosity
WARNING
       Deprecated{}                  -> Verbosity
WARNING
       NoTranslation{}               -> Verbosity
WARNING
       CouldNotLoadTranslations{}    -> Verbosity
WARNING
       UnusualConversion {}          -> Verbosity
WARNING
       UnexpectedXmlElement {}       -> Verbosity
WARNING
       UnknownOrgExportOption {}     -> Verbosity
WARNING
       CouldNotDeduceFormat{}        -> Verbosity
WARNING
       RunningFilter{}               -> Verbosity
INFO
       FilterCompleted{}             -> Verbosity
INFO
       CiteprocWarning{}             -> Verbosity
WARNING