{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric      #-}
{-# LANGUAGE OverloadedStrings  #-}
{- |
   Module      : Text.Pandoc.Logging
   Copyright   : Copyright (C) 2006-2024 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.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.Text (Text)
import Data.Typeable (Typeable)
import GHC.Generics (Generic)
import Text.Pandoc.Definition
import Text.Parsec.Pos
import Text.Pandoc.Shared (tshow)

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

instance ToJSON Verbosity where
  toJSON :: Verbosity -> Value
toJSON Verbosity
x = [Char] -> Value
forall a. ToJSON a => a -> Value
toJSON (Verbosity -> [Char]
forall a. Show a => a -> [Char]
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 a. a -> Parser a
forall (m :: * -> *) a. Monad m => a -> m a
return Verbosity
ERROR
         Text
"WARNING" -> Verbosity -> Parser Verbosity
forall a. a -> Parser a
forall (m :: * -> *) a. Monad m => a -> m a
return Verbosity
WARNING
         Text
"INFO"    -> Verbosity -> Parser Verbosity
forall a. a -> Parser a
forall (m :: * -> *) a. Monad m => a -> m a
return Verbosity
INFO
         Text
_         -> Parser Verbosity
forall a. Parser a
forall (m :: * -> *) a. MonadPlus m => m a
mzero
  parseJSON Value
_      =  Parser Verbosity
forall a. Parser a
forall (m :: * -> *) a. MonadPlus m => m a
mzero

data LogMessage =
    SkippedContent Text SourcePos
  | IgnoredElement Text
  | DuplicateLinkReference Text SourcePos
  | DuplicateNoteReference Text SourcePos
  | NoteDefinedButNotUsed Text SourcePos
  | DuplicateIdentifier Text SourcePos
  | ReferenceNotFound Text SourcePos
  | CircularReference Text SourcePos
  | UndefinedToggle Text SourcePos
  | ParsingUnescaped Text SourcePos
  | CouldNotLoadIncludeFile Text SourcePos
  | CouldNotParseIncludeFile Text SourcePos
  | MacroAlreadyDefined Text SourcePos
  | InlineNotRendered Inline
  | BlockNotRendered Block
  | DocxParserWarning Text
  | PowerpointTemplateWarning Text
  | IgnoredIOError Text
  | CouldNotFetchResource Text Text
  | CouldNotDetermineImageSize Text Text
  | CouldNotConvertImage Text Text
  | CouldNotDetermineMimeType Text
  | CouldNotConvertTeXMath Text Text
  | CouldNotParseCSS Text
  | Fetching Text
  | Extracting Text
  | LoadedResource FilePath FilePath
  | ScriptingInfo Text (Maybe SourcePos)
  | ScriptingWarning Text (Maybe SourcePos)
  | NoTitleElement Text
  | NoLangSpecified
  | InvalidLang Text
  | CouldNotHighlight Text
  | MissingCharacter Text
  | Deprecated Text Text
  | NoTranslation Text
  | CouldNotLoadTranslations Text Text
  | UnusualConversion Text
  | UnexpectedXmlElement Text Text
  | UnknownOrgExportOption Text
  | CouldNotDeduceFormat [Text] Text
  | RunningFilter FilePath
  | FilterCompleted FilePath Integer
  | CiteprocWarning Text
  | ATXHeadingInLHS Int Text
  | EnvironmentVariableUndefined Text
  | DuplicateAttribute Text Text
  | NotUTF8Encoded FilePath
  | MakePDFInfo Text Text
  | MakePDFWarning Text
  | UnclosedDiv SourcePos SourcePos
  | UnsupportedCodePage Int
  deriving (Int -> LogMessage -> ShowS
[LogMessage] -> ShowS
LogMessage -> [Char]
(Int -> LogMessage -> ShowS)
-> (LogMessage -> [Char])
-> ([LogMessage] -> ShowS)
-> Show LogMessage
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LogMessage -> ShowS
showsPrec :: Int -> LogMessage -> ShowS
$cshow :: LogMessage -> [Char]
show :: LogMessage -> [Char]
$cshowList :: [LogMessage] -> ShowS
showList :: [LogMessage] -> ShowS
Show, LogMessage -> LogMessage -> Bool
(LogMessage -> LogMessage -> Bool)
-> (LogMessage -> LogMessage -> Bool) -> Eq LogMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LogMessage -> LogMessage -> Bool
== :: LogMessage -> LogMessage -> Bool
$c/= :: LogMessage -> LogMessage -> Bool
/= :: LogMessage -> LogMessage -> Bool
Eq, Typeable LogMessage
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 -> Constr
LogMessage -> DataType
(forall b. Data b => b -> b) -> LogMessage -> 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)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LogMessage -> c LogMessage
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LogMessage -> c LogMessage
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LogMessage
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LogMessage
$ctoConstr :: LogMessage -> Constr
toConstr :: LogMessage -> Constr
$cdataTypeOf :: LogMessage -> DataType
dataTypeOf :: LogMessage -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LogMessage)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LogMessage)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LogMessage)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LogMessage)
$cgmapT :: (forall b. Data b => b -> b) -> LogMessage -> LogMessage
gmapT :: (forall b. Data b => b -> b) -> LogMessage -> LogMessage
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LogMessage -> r
gmapQl :: forall r r'.
(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
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LogMessage -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> LogMessage -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> LogMessage -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> LogMessage -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> LogMessage -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> LogMessage -> m LogMessage
gmapM :: forall (m :: * -> *).
Monad m =>
(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
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(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
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LogMessage -> m 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
$ccompare :: LogMessage -> LogMessage -> Ordering
compare :: LogMessage -> LogMessage -> Ordering
$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
>= :: LogMessage -> LogMessage -> Bool
$cmax :: LogMessage -> LogMessage -> LogMessage
max :: LogMessage -> LogMessage -> LogMessage
$cmin :: LogMessage -> LogMessage -> LogMessage
min :: LogMessage -> LogMessage -> 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
$cfrom :: forall x. LogMessage -> Rep LogMessage x
from :: forall x. LogMessage -> Rep LogMessage x
$cto :: forall x. Rep LogMessage x -> LogMessage
to :: forall x. Rep LogMessage x -> LogMessage
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
$
    Key
"verbosity" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Verbosity -> Value
forall a. ToJSON a => a -> Value
toJSON (LogMessage -> Verbosity
messageVerbosity LogMessage
x) Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
:
    Key
"type" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [Char] -> Value
forall a. ToJSON a => a -> Value
toJSON (Constr -> [Char]
forall a. Show a => a -> [Char]
show (Constr -> [Char]) -> Constr -> [Char]
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 ->
           [Key
"contents" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
s,
            Key
"source" Key -> [Char] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= SourcePos -> [Char]
sourceName SourcePos
pos,
            Key
"line" Key -> Int -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= SourcePos -> Int
sourceLine SourcePos
pos,
            Key
"column" Key -> Int -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= SourcePos -> Int
sourceColumn SourcePos
pos]
      IgnoredElement Text
s ->
           [Key
"contents" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
s]
      DuplicateLinkReference Text
s SourcePos
pos ->
           [Key
"contents" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
s,
            Key
"source" Key -> [Char] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= SourcePos -> [Char]
sourceName SourcePos
pos,
            Key
"line" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceLine SourcePos
pos),
            Key
"column" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceColumn SourcePos
pos)]
      NoteDefinedButNotUsed Text
s SourcePos
pos ->
           [Key
"key" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
s,
            Key
"source" Key -> [Char] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= SourcePos -> [Char]
sourceName SourcePos
pos,
            Key
"line" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceLine SourcePos
pos),
            Key
"column" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceColumn SourcePos
pos)]
      DuplicateNoteReference Text
s SourcePos
pos ->
           [Key
"contents" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
s,
            Key
"source" Key -> [Char] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= SourcePos -> [Char]
sourceName SourcePos
pos,
            Key
"line" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceLine SourcePos
pos),
            Key
"column" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceColumn SourcePos
pos)]
      DuplicateIdentifier Text
s SourcePos
pos ->
           [Key
"contents" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
s,
            Key
"source" Key -> [Char] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= SourcePos -> [Char]
sourceName SourcePos
pos,
            Key
"line" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceLine SourcePos
pos),
            Key
"column" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceColumn SourcePos
pos)]
      ReferenceNotFound Text
s SourcePos
pos ->
           [Key
"contents" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
s,
            Key
"source" Key -> [Char] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= SourcePos -> [Char]
sourceName SourcePos
pos,
            Key
"line" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceLine SourcePos
pos),
            Key
"column" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceColumn SourcePos
pos)]
      CircularReference Text
s SourcePos
pos ->
           [Key
"contents" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
s,
            Key
"source" Key -> [Char] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= SourcePos -> [Char]
sourceName SourcePos
pos,
            Key
"line" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceLine SourcePos
pos),
            Key
"column" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceColumn SourcePos
pos)]
      UndefinedToggle Text
s SourcePos
pos ->
           [Key
"contents" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
s,
            Key
"source" Key -> [Char] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= SourcePos -> [Char]
sourceName SourcePos
pos,
            Key
"line" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceLine SourcePos
pos),
            Key
"column" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceColumn SourcePos
pos)]
      ParsingUnescaped Text
s SourcePos
pos ->
           [Key
"contents" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
s,
            Key
"source" Key -> [Char] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= SourcePos -> [Char]
sourceName SourcePos
pos,
            Key
"line" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceLine SourcePos
pos),
            Key
"column" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceColumn SourcePos
pos)]
      CouldNotLoadIncludeFile Text
fp SourcePos
pos ->
           [Key
"path" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
fp,
            Key
"source" Key -> [Char] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= SourcePos -> [Char]
sourceName SourcePos
pos,
            Key
"line" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceLine SourcePos
pos),
            Key
"column" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceColumn SourcePos
pos)]
      CouldNotParseIncludeFile Text
fp SourcePos
pos ->
           [Key
"path" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
fp,
            Key
"source" Key -> [Char] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= SourcePos -> [Char]
sourceName SourcePos
pos,
            Key
"line" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceLine SourcePos
pos),
            Key
"column" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceColumn SourcePos
pos)]
      MacroAlreadyDefined Text
name SourcePos
pos ->
           [Key
"name" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
name,
            Key
"source" Key -> [Char] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= SourcePos -> [Char]
sourceName SourcePos
pos,
            Key
"line" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceLine SourcePos
pos),
            Key
"column" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceColumn SourcePos
pos)]
      InlineNotRendered Inline
il ->
           [Key
"contents" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Inline -> Value
forall a. ToJSON a => a -> Value
toJSON Inline
il]
      BlockNotRendered Block
bl ->
           [Key
"contents" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Block -> Value
forall a. ToJSON a => a -> Value
toJSON Block
bl]
      DocxParserWarning Text
s ->
           [Key
"contents" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
s]
      PowerpointTemplateWarning Text
s ->
           [Key
"contents" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
s]
      IgnoredIOError Text
s ->
           [Key
"contents" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
s]
      CouldNotFetchResource Text
fp Text
s ->
           [Key
"path" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
fp,
            Key
"message" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
s]
      CouldNotDetermineImageSize Text
fp Text
s ->
           [Key
"path" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
fp,
            Key
"message" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
s]
      CouldNotConvertImage Text
fp Text
s ->
           [Key
"path" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
fp,
            Key
"message" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
s]
      CouldNotDetermineMimeType Text
fp ->
           [Key
"path" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
fp]
      CouldNotConvertTeXMath Text
s Text
msg ->
           [Key
"contents" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
s,
            Key
"message" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
msg]
      CouldNotParseCSS Text
msg ->
           [Key
"message" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
msg]
      Fetching Text
fp ->
           [Key
"path" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
fp]
      Extracting Text
fp ->
           [Key
"path" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
fp]
      LoadedResource [Char]
orig [Char]
found ->
           [Key
"for"  Key -> [Char] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [Char]
orig
           ,Key
"from" Key -> [Char] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [Char]
found]
      ScriptingInfo Text
msg Maybe SourcePos
mbpos ->
           [Key
"message" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
msg] [Pair] -> [Pair] -> [Pair]
forall a. Semigroup a => a -> a -> a
<>
           case Maybe SourcePos
mbpos of
             Maybe SourcePos
Nothing  -> []
             Just SourcePos
pos -> [Key
"source" Key -> [Char] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= SourcePos -> [Char]
sourceName SourcePos
pos
                         ,Key
"line" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceLine SourcePos
pos)
                         ,Key
"column" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceColumn SourcePos
pos)
                         ]
      ScriptingWarning Text
msg Maybe SourcePos
mbpos ->
           [Key
"message" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
msg] [Pair] -> [Pair] -> [Pair]
forall a. Semigroup a => a -> a -> a
<>
           case Maybe SourcePos
mbpos of
             Maybe SourcePos
Nothing  -> []
             Just SourcePos
pos -> [Key
"source" Key -> [Char] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= SourcePos -> [Char]
sourceName SourcePos
pos
                         ,Key
"line" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceLine SourcePos
pos)
                         ,Key
"column" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceColumn SourcePos
pos)
                         ]
      NoTitleElement Text
fallback ->
           [Key
"fallback" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
fallback]
      LogMessage
NoLangSpecified -> []
      InvalidLang Text
s ->
           [Key
"lang" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
s]
      CouldNotHighlight Text
msg ->
           [Key
"message" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
msg]
      MissingCharacter Text
msg ->
           [Key
"message" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
msg]
      Deprecated Text
thing Text
msg ->
           [Key
"thing" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
thing,
            Key
"message" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
msg]
      NoTranslation Text
term ->
           [Key
"term" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
term]
      CouldNotLoadTranslations Text
lang Text
msg ->
           [Key
"lang" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
lang,
            Key
"message" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
msg]
      UnusualConversion Text
msg ->
           [Key
"message" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
msg]
      UnexpectedXmlElement Text
element Text
parent ->
           [Key
"element" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
element,
            Key
"parent" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
parent]
      UnknownOrgExportOption Text
option ->
           [Key
"option" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
option]
      CouldNotDeduceFormat [Text]
exts Text
format ->
           [Key
"extensions" Key -> [Text] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [Text]
exts
           ,Key
"format" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
format]
      RunningFilter [Char]
fp ->
           [Key
"path" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [Char] -> Text
Text.pack [Char]
fp ]
      FilterCompleted [Char]
fp Integer
ms ->
           [Key
"path" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [Char] -> Text
Text.pack [Char]
fp
           ,Key
"milliseconds" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [Char] -> Text
Text.pack (Integer -> [Char]
forall a. Show a => a -> [Char]
show Integer
ms) ]
      CiteprocWarning Text
msg ->
           [Key
"message" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
msg]
      ATXHeadingInLHS Int
lvl Text
contents ->
           [Key
"level" Key -> Int -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int
lvl
           ,Key
"contents" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
contents]
      EnvironmentVariableUndefined Text
var ->
           [Key
"variable" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
var ]
      DuplicateAttribute Text
attr Text
val ->
           [Key
"attribute" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
attr
           ,Key
"value" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
val]
      NotUTF8Encoded [Char]
src ->
           [Key
"source" Key -> [Char] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [Char]
src]
      MakePDFInfo Text
description Text
contents ->
           [Key
"description" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
description
           ,Key
"contents" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
contents]
      MakePDFWarning Text
message ->
           [Key
"message" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
message]
      UnclosedDiv SourcePos
openpos SourcePos
closepos ->
           [Key
"openpos" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [Pair] -> Value
object
             [ Key
"source" Key -> [Char] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= SourcePos -> [Char]
sourceName SourcePos
openpos,
               Key
"line" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceLine SourcePos
openpos),
               Key
"column" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceColumn SourcePos
openpos)]
           ,Key
"closepos" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [Pair] -> Value
object
             [ Key
"source" Key -> [Char] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= SourcePos -> [Char]
sourceName SourcePos
closepos,
               Key
"line" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceLine SourcePos
closepos),
               Key
"column" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int -> Value
forall a. ToJSON a => a -> Value
toJSON (SourcePos -> Int
sourceColumn SourcePos
closepos)]
           ]
      UnsupportedCodePage Int
cpg ->
           [Key
"codepage" Key -> Int -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Int
cpg]

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

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

showLogMessage :: LogMessage -> 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
       CouldNotParseIncludeFile Text
fp SourcePos
pos ->
         Text
"Parsing 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
" failed 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
<> [Char] -> Text
Text.pack (Inline -> [Char]
forall a. Show a => a -> [Char]
show Inline
il)
       BlockNotRendered Block
bl ->
         Text
"Not rendering " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> [Char] -> Text
Text.pack (Block -> [Char]
forall a. Show a => a -> [Char]
show Block
bl)
       DocxParserWarning Text
s ->
         Text
"Docx parser warning: " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
s
       PowerpointTemplateWarning Text
s ->
         Text
"Powerpoint template 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
<>
           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
<>
           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
<>
           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
       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
"..."
       LoadedResource [Char]
orig [Char]
found ->
         Text
"Loaded " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> [Char] -> Text
Text.pack [Char]
orig Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
" from " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> [Char] -> Text
Text.pack [Char]
found
       ScriptingInfo Text
s Maybe SourcePos
mbpos ->
         Text
"Scripting info" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>
         Text -> (SourcePos -> Text) -> Maybe SourcePos -> Text
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Text
"" (\SourcePos
pos -> Text
" at " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> SourcePos -> Text
showPos SourcePos
pos) Maybe SourcePos
mbpos  Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
": " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
s
       ScriptingWarning Text
s Maybe SourcePos
mbpos ->
         Text
"Scripting warning" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>
         Text -> (SourcePos -> Text) -> Maybe SourcePos -> Text
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Text
"" (\SourcePos
pos -> Text
" at " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> SourcePos -> Text
showPos SourcePos
pos) Maybe SourcePos
mbpos  Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
": " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
s
       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 [Char]
fp -> Text
"Running filter " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> [Char] -> Text
Text.pack [Char]
fp
       FilterCompleted [Char]
fp Integer
ms -> Text
"Completed filter " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> [Char] -> Text
Text.pack [Char]
fp Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>
          Text
" in " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> [Char] -> Text
Text.pack (Integer -> [Char]
forall a. Show a => a -> [Char]
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
       ATXHeadingInLHS Int
lvl Text
contents ->
         Text
"Rendering heading '" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
contents Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"' as a paragraph.\n" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>
         Text
"ATX headings cannot be used in literate Haskell, because " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>
         Text
"'#' is not\nallowed in column 1." Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>
         if Int
lvl Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< Int
3
            then Text
" Consider using --markdown-headings=setext."
            else Text
""
       EnvironmentVariableUndefined Text
var ->
         Text
"Undefined environment variable " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
var Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
" in defaults file."
       DuplicateAttribute Text
attr Text
val ->
         Text
"Ignoring duplicate attribute " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
attr Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"=" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text -> Text
forall a. Show a => a -> Text
tshow Text
val Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"."
       NotUTF8Encoded [Char]
src ->
         [Char] -> Text
Text.pack [Char]
src Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>
           Text
" is not UTF-8 encoded: falling back to latin1."
       MakePDFInfo Text
description Text
contents ->
         Text
"[makePDF] " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
description Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>
          if Text -> Bool
Text.null Text
contents
             then Text
forall a. Monoid a => a
mempty
             else Text
"\n" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
contents
       MakePDFWarning Text
message -> Text
"[makePDF] " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
message
       UnclosedDiv SourcePos
openpos SourcePos
closepos -> Text
"Div at " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> SourcePos -> Text
showPos SourcePos
openpos Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>
          Text
" unclosed at " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> SourcePos -> Text
showPos SourcePos
closepos Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
", closing implicitly."
       UnsupportedCodePage Int
cpg -> Text
"Unsupported code page " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Int -> Text
forall a. Show a => a -> Text
tshow Int
cpg Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>
          Text
". Text will likely be garbled."

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
       CouldNotParseIncludeFile{}    -> Verbosity
WARNING
       MacroAlreadyDefined{}         -> Verbosity
WARNING
       ParsingUnescaped{}            -> Verbosity
INFO
       InlineNotRendered{}           -> Verbosity
INFO
       BlockNotRendered{}            -> Verbosity
INFO
       DocxParserWarning{}           -> Verbosity
WARNING
       PowerpointTemplateWarning{}   -> Verbosity
WARNING
       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
       LoadedResource{}              -> Verbosity
INFO
       ScriptingInfo{}               -> Verbosity
INFO
       ScriptingWarning{}            -> Verbosity
WARNING
       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
       ATXHeadingInLHS{}             -> Verbosity
WARNING
       EnvironmentVariableUndefined{}-> Verbosity
WARNING
       DuplicateAttribute{}          -> Verbosity
WARNING
       NotUTF8Encoded{}              -> Verbosity
WARNING
       MakePDFInfo{}                 -> Verbosity
INFO
       MakePDFWarning{}              -> Verbosity
WARNING
       UnclosedDiv{}                 -> Verbosity
WARNING
       UnsupportedCodePage{}         -> Verbosity
WARNING