289
289
set_debug (const char *level)
291
int numok = (level && digitp (level));
292
int numlvl = numok? atoi (level) : 0;
293
else if (!strcmp (level, "none"))
296
else if (!strcmp (level, "none") || (numok && numlvl < 1))
295
else if (!strcmp (level, "basic"))
298
else if (!strcmp (level, "basic") || (numok && numlvl <= 2))
296
299
opt.debug = DBG_ASSUAN_VALUE;
297
else if (!strcmp (level, "advanced"))
300
else if (!strcmp (level, "advanced") || (numok && numlvl <= 5))
298
301
opt.debug = DBG_ASSUAN_VALUE|DBG_COMMAND_VALUE;
299
else if (!strcmp (level, "expert"))
302
else if (!strcmp (level, "expert") || (numok && numlvl <= 8))
300
303
opt.debug = (DBG_ASSUAN_VALUE|DBG_COMMAND_VALUE
301
304
|DBG_CACHE_VALUE|DBG_CARD_IO_VALUE);
302
else if (!strcmp (level, "guru"))
305
else if (!strcmp (level, "guru") || numok)
308
/* Unless the "guru" string has been used we don't want to allow
309
hashing debugging. The rationale is that people tend to
310
select the highest debug value and would then clutter their
311
disk with debug files which may reveal confidential data. */
313
opt.debug &= ~(DBG_HASHING_VALUE);
306
317
log_error (_("invalid debug-level `%s' given\n"), level);
318
329
if (opt.debug & DBG_CRYPTO_VALUE )
319
330
gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1);
320
331
gcry_control (GCRYCTL_SET_VERBOSITY, (int)opt.verbose);
334
log_info ("enabled debug flags:%s%s%s%s%s%s%s%s%s\n",
335
(opt.debug & DBG_COMMAND_VALUE)? " command":"",
336
(opt.debug & DBG_MPI_VALUE )? " mpi":"",
337
(opt.debug & DBG_CRYPTO_VALUE )? " crypto":"",
338
(opt.debug & DBG_MEMORY_VALUE )? " memory":"",
339
(opt.debug & DBG_CACHE_VALUE )? " cache":"",
340
(opt.debug & DBG_MEMSTAT_VALUE)? " memstat":"",
341
(opt.debug & DBG_HASHING_VALUE)? " hashing":"",
342
(opt.debug & DBG_ASSUAN_VALUE )? " assuan":"",
343
(opt.debug & DBG_CARD_IO_VALUE)? " cardio":"");