@@ -0,0 +1,76 @@
1+{-# LANGUAGE DeriveDataTypeable, DeriveGeneric #-}
3+Copyright (C) 2016-17 John MacFarlane <jgm@berkeley.edu>
5+This program is free software; you can redistribute it and/or modify
6+it under the terms of the GNU General Public License as published by
7+the Free Software Foundation; either version 2 of the License, or
8+(at your option) any later version.
10+This program is distributed in the hope that it will be useful,
11+but WITHOUT ANY WARRANTY; without even the implied warranty of
12+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+GNU General Public License for more details.
15+You should have received a copy of the GNU General Public License
16+along with this program; if not, write to the Free Software
17+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20+ Module : Text.Pandoc.Logging
21+ Copyright : Copyright (C) 2006-2016 John MacFarlane
22+ License : GNU GPL, version 2 or above
24+ Maintainer : John MacFarlane <jgm@berkeley.edu>
26+ Portability : portable
28+This module provides data types and functions for warnings
32+module Text.Pandoc.Logging (
38+import Text.Parsec.Pos
39+import Data.Data (Data)
40+import Data.Generics (Typeable)
41+import GHC.Generics (Generic)
44+data Verbosity = ERROR | WARNING | INFO | DEBUG
45+ deriving (Show, Read, Eq, Data, Enum, Ord, Bounded, Typeable, Generic)
48+ SkippedInput String SourcePos
50+ | YamlSectionNotAnObject SourcePos
51+ | DuplicateLinkReference String SourcePos
52+ | DuplicateNoteReference String SourcePos
53+ | ParsingUnescaped String SourcePos
54+ | DocxCommentWillNotRetainFormatting String
55+ | CouldNotFetchResource String String
56+ | CouldNotDetermineImageSize String
57+ | CouldNotDetermineMimeType String
58+ | CouldNotConvertTeXMath String
59+ deriving (Show, Eq, Data, Ord, Typeable, Generic)
61+messageVerbosity:: LogMessage -> Verbosity
62+messageVerbosity msg =
64+ SkippedInput{} -> INFO
65+ NotRendered{} -> INFO
66+ YamlSectionNotAnObject{} -> WARNING
67+ DuplicateLinkReference{} -> WARNING
68+ DuplicateNoteReference{} -> WARNING
69+ ParsingUnescaped{} -> INFO
70+ DocxCommentWillNotRetainFormatting{} -> INFO
71+ CouldNotFetchResource{} -> WARNING
72+ CouldNotDetermineImageSize{} -> WARNING
73+ CouldNotDetermineMimeType{} -> WARNING
74+ CouldNotConvertTeXMath{} -> WARNING