One way to debug apps is by logging information in the code. This enables seeing which code was run when a problem occurred and what the value of variables were. You can directly call GLib.Log () or use the convenience functions listed below.
To view logs from all your applications you can use journalctl.
Debug logs usually give detailed information on the flow through the system and are not printed to Terminal or logs by default.
Log functions, like debug use printf style formatting and can be called like this:
string name = "Bob";
int age = 30;
debug ("Person: %s %i", name, age);
Start your app with G_MESSAGES_DEBUG=all to print debug messages
Use info log level to log informational messages as well as interesting runtime events. These logs are also immediately visible on a status console, and should be kept to a minimum.
info ("An event occured");
Use the message log level to output a message.
message ("An event occured");
The warning log level outputs messages that warn of, for example, use of deprecated APIs, 'almost' errors, or runtime situations that are undesirable or unexpected, but not necessarily "wrong". These logs are immediately visible on a status console.