Add --debug-json switch and log level.

The JSON structures should not be printed by default to debug log.

This flag introduces new debug level that prints JSON structures
and keeps default debug output separate.
This commit is contained in:
Milan Broz
2019-01-10 14:52:49 +01:00
parent cf31bdb65c
commit 51dd2762a9
10 changed files with 19 additions and 10 deletions

View File

@@ -27,6 +27,7 @@
int opt_verbose = 0;
int opt_debug = 0;
int opt_debug_json = 0;
int opt_batch_mode = 0;
int opt_progress_frequency = 0;
@@ -112,6 +113,7 @@ void tool_log(int level, const char *msg, void *usrptr __attribute__((unused)))
case CRYPT_LOG_ERROR:
fprintf(stderr, "%s", msg);
break;
case CRYPT_LOG_DEBUG_JSON:
case CRYPT_LOG_DEBUG:
if (opt_debug)
fprintf(stdout, "# %s\n", msg);