quarto.log

debug

function quarto.log.debug(...any)

If the log level is >= 2, calls quarto.log.output() with (D) and the supplied arguments.

dump

function quarto.log.dump(value: any, maxlen?: integer)
  -> string

Returns a pandoc-aware string representation of value, which can be an arbitrary lua object.

The returned string is a single line if not longer than maxlen (default 70), and is otherwise multiple lines (with two character indentation). The string is not terminated with a newline.

Map keys are sorted alphabetically in order to ensure that output is repeatable.

error

function quarto.log.error(...any)

If the log level is >= -1, calls quarto.log.output() with (E) and the supplied arguments.

info

function quarto.log.info(...any)

If the log level is >= 1, calls quarto.log.output() with (I) and the supplied arguments.

loglevel

integer

Current log level (call quarto.log.setloglevel() to change the level)

output

function quarto.log.output(...any)

Pass each argument to logging.dump() and output the results to stderr, separated by single spaces and terminated (if necessary) with a newline.

Note: Only table and userdata arguments are passed to logging.dump(). Other arguments are passed to the built-in tostring() function. This is partly an optimization and partly to prevent string arguments from being quoted.

setloglevel

function quarto.log.setloglevel(level: integer)

Set the log level, which controls which of quarto.log.error(), quarto.log.warning(), quarto.log.info() will generate output when called.

  • -2 : (or less) suppress all logging (apart from quarto.log.temp())
  • -1 : output only error messages
  • 0 : output error and warning messages
  • 1 : output error, warning and info messages
  • 2 : output error, warning, info and debug messages
  • 3 : (or more) output error, warning, info, debug and trace messages

The initial log level is 0, unless the following pandoc command-line options are specified:

  • --trace : 3 if --verbose is also specified; otherwise 2
  • --verbose : 1
  • --quiet : -1

spairs

function quarto.log.spairs(list: table, comp?: function)
  -> function

Like pairs() but with sorted keys. Keys are converted to strings and sorted using table.sort(keys, comp) so by default they’re visited in alphabetical order.

temp

function quarto.log.temp(...any)

Unconditionally calls quarto.log.output() with (#) and the supplied arguments.

trace

function quarto.log.trace(...any)

If the log level is >= 3, calls quarto.log.output() with (T) and the supplied arguments.

type

function quarto.log.type(value: any)
  -> string

Returns whatever pandoc.utils.type() returns, modified as follows:

  • Spaces are replaced with periods, e.g., pandoc Row becomes pandoc.Row
  • Inline and Block are replaced with the corresponding tag value, e.g. Emph or Table

warning

function quarto.log.warning(...any)

If the log level is >= 0, calls quarto.log.output() with (W) and the supplied arguments.