support -l/-L options, improve logging

This commit is contained in:
Christian Grothoff 2019-12-24 20:21:54 +01:00
parent 75aec331fb
commit df0237ab94
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
3 changed files with 26 additions and 9 deletions

View File

@ -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))
{

View File

@ -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);

View File

@ -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",