Function Macro

GLibcritical

Declaration [src]

#define g_critical (
  ...
)

Description [src]

Logs a ‘critical warning’ (G_LOG_LEVEL_CRITICAL).

Critical warnings are intended to be used in the event of an error that originated in the current process (a programmer error). Logging of a critical error is by definition an indication of a bug somewhere in the current program (or its libraries).

g_return_if_fail(), g_return_val_if_fail(), g_return_if_reached() and g_return_val_if_reached() log at G_LOG_LEVEL_CRITICAL.

You can make critical warnings fatal at runtime by setting the G_DEBUG environment variable (see Running GLib Applications):

G_DEBUG=fatal-warnings gdb ./my-program

You can also use g_log_set_always_fatal().

Any unrelated failures can be skipped over in gdb using the continue command.

The message should typically not be translated to the user’s language.

If g_log_default_handler() is used as the log handler function, a new-line 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.

This function is not directly available to language bindings.

Parameters

...

Type: -

Format string, followed by parameters to insert into the format string (as with printf()).