summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-07-29 21:04:25 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2017-07-30 07:43:55 -0700
commit8cbc28415ef7246e9eb5b74d8958f1ab0dc01d4d (patch)
tree4cae5d8dc86fc1e4936e34cdd7fdbd49a38c2287 /src
parent7f9e950d8da52dd2333843d7fd85d000c4a1cbe3 (diff)
Class: more haddocks.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Class.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Class.hs b/src/Text/Pandoc/Class.hs
index df6da5a68..a8db05e5b 100644
--- a/src/Text/Pandoc/Class.hs
+++ b/src/Text/Pandoc/Class.hs
@@ -186,13 +186,21 @@ class (Functor m, Applicative m, Monad m, MonadError PandocError m)
-- * Functions defined for all PandocMonad instances
+-- | Set the verbosity level.
setVerbosity :: PandocMonad m => Verbosity -> m ()
setVerbosity verbosity =
modifyCommonState $ \st -> st{ stVerbosity = verbosity }
+-- Get the accomulated log messages (in temporal order).
getLog :: PandocMonad m => m [LogMessage]
getLog = reverse <$> getsCommonState stLog
+-- | Log a message using 'logOutput'. Note that
+-- 'logOutput' is called only if the verbosity
+-- level exceeds the level of the message, but
+-- the message is added to the list of log messages
+-- that will be retrieved by 'getLog' regardless
+-- of its verbosity level.
report :: PandocMonad m => LogMessage -> m ()
report msg = do
verbosity <- getsCommonState stVerbosity
@@ -200,9 +208,13 @@ report msg = do
when (level <= verbosity) $ logOutput msg
modifyCommonState $ \st -> st{ stLog = msg : stLog st }
+-- | Determine whether tracing is enabled. This affects
+-- the behavior of 'trace'. If tracing is not enabled,
+-- 'trace' does nothing.
setTrace :: PandocMonad m => Bool -> m ()
setTrace useTracing = modifyCommonState $ \st -> st{stTrace = useTracing}
+-- | Initialize the media bag.
setMediaBag :: PandocMonad m => MediaBag -> m ()
setMediaBag mb = modifyCommonState $ \st -> st{stMediaBag = mb}