if 1 it uses g_print(). If 2, it uses g_printerr(). If 0, it uses the same output as internal libnm debug logging does. That is, depending on LIBNM_CLIENT_DEBUG's "stdout" flag it uses g_print() or g_printerr() and if LIBNM_CLIENT_DEBUG_FILE is set, it writes the output to file instead
the message to print. The function does not append a trailing newline.
The only purpose of this function is to give access to
g_print()org_printerr()from pygobject. libnm can do debug logging by setting LIBNM_CLIENT_DEBUG and uses therebyg_printerr()org_print(). A plain "print()" function in python is not in sync with these functions (it implements additional buffering). By usingnm_utils_print(), the same logging mechanisms can be used.LIBNM_CLIENT_DEBUG is a list of keywords separated by commas. The keyword "trace" enables printing messages of the lowest up to the highest severity. Likewise, the severities "debug", "warn" ("warning") and "error" are honored in similar way. Setting the flags "ERROR" or "WARN" ("WARNING") implies that respective levels are enabled, but also are ERROR messages printed with
g_critical()and WARN messages withg_warning(). Together with G_DEBUG="fatal-warnings" or G_DEBUG="fatal-critical" this can be used to abort the program on errors. Note that all <error> messages imply an unexpected data on the D-Bus API (due to a bug). <warn> also implies unexepected data, but that can happen when using different versions of libnm and daemon. For testing, it is good to turn these into assertions.By default, messages are printed to stderr, unless LIBNM_CLIENT_DEBUG contains "stdout" flag. Also, libnm honors LIBNM_CLIENT_DEBUG_FILE environment. If this is set to a filename pattern (accepting "%%p" for the process ID), then the debug log is written to that file instead of stderr/stdout. With
output_modezero, the same location will be written.LIBNM_CLIENT_DEBUG_FILE is supported since 1.44. "ERROR", "WARN" and "WARNING" are supported since 1.46.