10.6 Warnings, Errors, Progress and Debug Output

Available log levels

LilyPond has several log levels to specify how verbose the output on the console should be, as shown in the following table. Note that only the first few characters of a given value are checked (as indicated); additionally, case doesn’t matter. In other words, ERR is the same as error or ERRO, for example.

NONE

no output at all, even on failure

ERR[OR]

only error messages

WARN

only error messages and warnings

BASIC

warnings, errors, and basic progress (success, etc.)

PROG[RESS]

warnings, errors, and full progress messages

INFO

warnings, errors, progress, and more detailed information (default)

DEBUG

all messages, including full debug messages (very verbose!)

The log level can either be set with the environment variable LILYPOND_LOGLEVEL or on the command line with the --loglevel=... option.

Functions for debug and log output

LilyPond has two different types of error and log functions:

There are also Scheme functions to access all of these logging functions from scheme. In addition, the Grob class contains some convenience wrappers for even easier access to these functions.

The message and debug functions in warn.hh also have an optional argument newline, which specifies whether the message should always start on a new line or continue a previous message. By default, progress_indication does NOT start on a new line, but rather continue the previous output. They also do not have a particular input position associated, so there are no progress functions in the Input class. All other functions by default start their output on a new line.

The error functions come in three different flavors: fatal error messages, programming error messages and normal error messages. Errors written by the error () function will cause LilyPond to exit immediately, errors by Input::error () will continue the compilation, but return a non-zero return value of the LilyPond call (i.e., indicate an unsuccessful program execution). All other errors will be printed on the console, but not exit LilyPond or indicate an unsuccessful return code. Their only differences to a warnings are the displayed text and that they will be shown with log level ERROR.

If the Scheme option warning-as-error is set, any warning will be treated as if Input::error was called.

All logging functions at a glance

C++, no locationC++, from input location
ERRORerror (), programming_error (msg), non_fatal_error (msg)Input::error (msg), Input::programming_error (msg)
WARNwarning (msg)Input::warning (msg)
BASICbasic_progress (msg)
PROGRESSprogress_indication (msg)
INFOmessage (msg)Input::message (msg)
DEBUGdebug_output (msg)Input::debug_output (msg)
C++, from a GrobScheme, music expression
ERRORGrob::programming_error (msg)
WARNGrob::warning (msg)(ly:music-warning music msg)
BASIC
PROGRESS
INFO(ly:music-message music msg)
DEBUG
Scheme, no locationScheme, input location
ERROR(ly:error msg args), (ly:programming-error msg args)
WARN(ly:warning msg args)(ly:input-warning input msg args)
BASIC(ly:basic-progress msg args)
PROGRESS(ly:progress msg args)
INFO(ly:message msg args)(ly:input-message input msg args)
DEBUG(ly:debug msg args)

LilyPond Contributor’s Guide v2.25.21 (development-branch).