1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
\section{Logging levels}
\label{sec:logging-levels}
\plasTeX uses standard python logging to document what it is doing. The
loggers that are defined by default are
\verb+context+,
\verb+context.macros+,
\verb+context.stack+,
\verb+imager+,
\verb+parse+,
\verb+parse.commands+,
\verb+parse.definitions+,
\verb+parse.digest+,
\verb+parse.environments+,
\verb+parse.mathshift+,
\verb+parse.persistent+,
\verb+parse.sections+,
\verb+parse.tokens+,
\verb+render+,
\verb+render.images+,
\verb+render.images.depth+,
\verb+simpleTAL+,
\verb+simpleTALES+,
\verb+status+,
\verb+tex+,
\verb+tex.kpsewhich+.
When using the main \program{plastex} script, you can change the
corresponding levels to values \verb+CRITICAL+, \verb+ERROR+,
\verb+WARNING+, \verb+INFO+, or \verb+DEBUG+ by using a configuration
file with a \verb+[logging]+ section such as:
\begin{verbatim}
[logging]
parse.environments=DEBUG
\end{verbatim}
if you want more information about environment parsing.
If the renderer you use does not call \LaTeX\ for creating images, you
can also achieve the same result from your \LaTeX\ document
by writing \verb+\usepackage{debugplastex}+ and then
\verb+\setloglevel{parse.environments}{DEBUG}+.
When using \plasTeX\ from python, you can use the function
\verb+plasTeX.Logging.updateLogLevels+ to update logging levels. It takes
a dictionary whose keys are logger names and values are levels (both are
strings). Non-existent loggers are created, loggers whose names are not
keys of the input dictionary are unaffected.
\section{Using the python debugger}
For more drastic debugging, the \verb+debugplastex+ package also
provides the command \verb+settrace+ to drop into the python debugger
while parsing. You can also use
\verb+\usepackage[post_parse_trace]{debugplastex}+ to ask \plasTeX
to drop into the python debugger after parsing the full LaTeX input.
You can also use the \verb+--debug+ command line option for a similar result
without changing the source file.
When using Jinja2 templates with a renderer extending
\verb+PageTemplate+, you can also use \verb+{{ debug() }}+ in a template in
order to drop into the python debugger while rendering the template. In
particular this allows to inspect \verb+obj+ which contains
the node being rendered and \verb+config+ which contains the current
plasTeX configuration.
|