From df0237ab94d18806b9cf57c7d4591940bb8a350e Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 24 Dec 2019 20:21:54 +0100 Subject: support -l/-L options, improve logging --- src/auditor/taler-auditor-dbinit.c | 2 ++ src/auditor/taler-auditor-sign.c | 18 ++++++++++++++---- src/auditor/taler-auditor.c | 15 ++++++++++----- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/auditor/taler-auditor-dbinit.c b/src/auditor/taler-auditor-dbinit.c index 6b4e3424e..2664e0914 100644 --- a/src/auditor/taler-auditor-dbinit.c +++ b/src/auditor/taler-auditor-dbinit.c @@ -64,8 +64,10 @@ run (void *cls, return; } if (reset_db) + { (void) plugin->drop_tables (plugin->cls, GNUNET_YES); + } if (GNUNET_OK != plugin->create_tables (plugin->cls)) { diff --git a/src/auditor/taler-auditor-sign.c b/src/auditor/taler-auditor-sign.c index f35b5de5b..9c39b66f3 100644 --- a/src/auditor/taler-auditor-sign.c +++ b/src/auditor/taler-auditor-sign.c @@ -148,6 +148,8 @@ main (int argc, char *const *argv) { char *cfgfile = NULL; + char *loglev = NULL; + char *logfile = NULL; const struct GNUNET_GETOPT_CommandLineOption options[] = { GNUNET_GETOPT_option_filename ('a', "auditor-key", @@ -156,6 +158,8 @@ main (int argc, &auditor_key_file), GNUNET_GETOPT_option_cfgfile (&cfgfile), GNUNET_GETOPT_option_help ("Sign denomination keys of an exchange"), + GNUNET_GETOPT_option_loglevel (&loglev), + GNUNET_GETOPT_option_logfile (&logfile), GNUNET_GETOPT_option_mandatory (GNUNET_GETOPT_option_base32_auto ('m', "exchange-key", @@ -191,14 +195,14 @@ main (int argc, struct TALER_ExchangeKeyValidityPS kv; off_t in_size; - GNUNET_assert (GNUNET_OK == - GNUNET_log_setup ("taler-auditor-sign", - "WARNING", - NULL)); if (GNUNET_GETOPT_run ("taler-auditor-sign", options, argc, argv) <= 0) return 1; + GNUNET_assert (GNUNET_OK == + GNUNET_log_setup ("taler-auditor-sign", + loglev, + logfile)); if (NULL == cfgfile) cfgfile = GNUNET_strdup (GNUNET_OS_project_data_get ()->user_config_file); cfg = GNUNET_CONFIGURATION_create (); @@ -377,6 +381,9 @@ main (int argc, return 3; } + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Taler auditor importing keys for exchange master public key %s\n", + TALER_B2S (&master_public_key)); /* Update DB */ { @@ -398,6 +405,9 @@ main (int argc, { const struct TALER_DenominationKeyValidityPS *dk = &dks[i]; + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Adding denomination key %s to auditor database\n", + TALER_B2S (&dk->denom_hash)); qs = adb->insert_denomination_info (adb->cls, session, dk); diff --git a/src/auditor/taler-auditor.c b/src/auditor/taler-auditor.c index 99c62113d..0cc2868f6 100644 --- a/src/auditor/taler-auditor.c +++ b/src/auditor/taler-auditor.c @@ -33,11 +33,6 @@ * verification to improve parallelism / speed -- we'll need to scale * this eventually anyway! * - * KNOWN BUGS: - * - error handling if denomination keys are used that are not known to the - * auditor is, eh, awful / non-existent. We just throw the DB's constraint - * violation back at the user. Great UX. - * * UNDECIDED: * - do we care about checking the 'done' flag in deposit_cb? */ @@ -766,7 +761,13 @@ get_denomination_info_by_hash (const struct GNUNET_HashCode *dh, &add_denomination, NULL); if (qs <= 0) + { + if (0 == qs) + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Denomination %s not found\n", + TALER_B2S (dh)); return qs; + } i = GNUNET_CONTAINER_multihashmap_get (denominations, dh); if (NULL != i) @@ -5290,6 +5291,10 @@ run (void *cls, GNUNET_free (master_public_key_str); } /* end of -m not given */ + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Taler auditor running for exchange master public key %s\n", + TALER_B2S (&master_pub)); + if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "taler", -- cgit v1.2.3