NetSurf
NetSurf logging

NetSurf has a large number of internal diagnostic messages which can be viewed by the developer (or user if they wish)

Each message has a category and a level which can be used to control which messages are displayed.

The message category is used to allow filters to separate messages of the same level from different sources.

The logging levels, from low to high, are:

At compilation time the logging behaviour can be controlled by using configuration overrides in a Makefile.config The parameters are:

The main command line switches that control logging are:

Examples:

./nsgtk --log_filter="level:INFO"
./nsgtk -v --verbose_filter="(cat:layout && level:DEBUG)"
./nsgtk -v --verbose_filter="((cat:layout && level:DEBUG) || level:INFO)"

The logging filters can be configured by setting the log_filter and log_verbose_filter options.

Messages can be easily added by including the utils/log.h header and he NSLOG() macro. for example

NSLOG(netsurf, INFO, "An example message %d", example_func());

If the nslog library is used it allows for application of a filter to control which messages are output. The nslog filter syntax is best viewed in its http://source.netsurf-browser.org/libnslog.git/tree/docs/mainpage.md "documentation"