A convenience function/macro to log a warning message. The message should typically not be translated to the user’s language.
This is not intended for end user error reporting. Use of
preferred for that instead, as it allows calling functions to perform actions
conditional on the type of error.
Warning messages are intended to be used in the event of unexpected external conditions (system misconfiguration, missing files, other trusted programs violating protocol, invalid contents in trusted files, etc.)
If attempting to deal with programmer errors (for example, incorrect function
parameters) then you should use
g_warn_if_fail() log at
You can make warnings fatal at runtime by setting the
environment variable (see
Running GLib Applications):
G_DEBUG=fatal-warnings gdb ./my-program
Any unrelated failures can be skipped over in
gdb using the
g_log_default_handler() is used as the log handler function,
a newline character will automatically be appended to @…, and
need not be entered manually.
If structured logging is enabled, this will use g_log_structured(); otherwise it will use g_log(). See [Using Structured Logging][using-structured-logging].
Available since: 2.0
This function is not directly available to language bindings.