Application.Client: Add command line flag for logging SQL results

This commit is contained in:
Michael Gratton 2020-04-16 11:44:26 +10:00
parent f4a4d699be
commit b2e99dcef2

View file

@ -69,6 +69,7 @@ public class Application.Client : Gtk.Application {
private const string OPTION_LOG_REPLAY_QUEUE = "log-replay-queue";
private const string OPTION_LOG_SMTP = "log-smtp";
private const string OPTION_LOG_SQL = "log-sql";
private const string OPTION_LOG_SQL_RESULTS = "log-sql-results";
private const string OPTION_HIDDEN = "hidden";
private const string OPTION_NEW_WINDOW = "new-window";
private const string OPTION_QUIT = "quit";
@ -123,7 +124,10 @@ public class Application.Client : Gtk.Application {
N_("Log SMTP messages"), null },
{ OPTION_LOG_SQL, 0, 0, GLib.OptionArg.NONE, null,
/// Command line option
N_("Log database queries (generates lots of messages)"), null },
N_("Log database queries"), null },
{ OPTION_LOG_SQL_RESULTS, 0, 0, GLib.OptionArg.NONE, null,
/// Command line option
N_("Log database query results (generates lots of messages)"), null },
{ OPTION_QUIT, 'q', 0, GLib.OptionArg.NONE, null,
/// Command line option
N_("Perform a graceful quit"), null },
@ -942,9 +946,13 @@ public class Application.Client : Gtk.Application {
Geary.Smtp.ClientService.PROTOCOL_LOGGING_DOMAIN
);
}
if (!options.contains(OPTION_LOG_SQL)) {
if (!options.contains(OPTION_LOG_SQL) &&
!options.contains(OPTION_LOG_SQL_RESULTS)) {
Geary.Logging.suppress_domain(Geary.Db.Context.LOGGING_DOMAIN);
}
if (options.contains(OPTION_LOG_SQL_RESULTS)) {
Geary.Db.Result.log_results = true;
}
if (options.contains(OPTION_HIDDEN)) {
warning(