static void setup_logging(void) {
isc_logconfig_t *logcfg = NULL;
+ int level = ISC_LOG_INFO;
/* Create the log context and a default config */
isc_log_create(ctx.memctx, &ctx.log, &logcfg);
- // Crank up debug verbosity
- if (ctx.log_level == LOG_DEBUG)
- isc_log_setdebuglevel(ctx.log, 6); // LOG_DEBUG);
+ // Translate the log level
+ switch (ctx.log_level) {
+ case LOG_DEBUG:
+ level = ISC_LOG_DEBUG(6);
+ break;
+
+ case LOG_ERR:
+ level = ISC_LOG_ERROR;
+ break;
+ }
/* Define a channel that writes everything to stderr */
isc_logdestination_t dest = {
logcfg,
"stderr", /* channel name */
ISC_LOG_TOFILEDESC, /* destination type */
- ISC_LOG_DYNAMIC, /* level — DYNAMIC follows setdebuglevel */
+ level,
&dest,
0);
enum {
OPT_DEBUG = 1,
- OPT_PATH = 2,
- OPT_PRIMARY = 3,
- OPT_SECURE = 4,
+ OPT_QUIET = 2,
+ OPT_PATH = 3,
+ OPT_PRIMARY = 4,
+ OPT_SECURE = 5,
};
static struct argp_option options[] = {
{ "debug", OPT_DEBUG, NULL, 0, "Run in debug mode", 0 },
+ { "quiet", OPT_QUIET, NULL, 0, "Run in quiet mode", 0 },
{ "path", OPT_PATH, "PATH", 1, "Path where to store the zones", 0 },
{ "primary", OPT_PRIMARY, "HOSTNAME", 1, "The hostname of the primary to fetch from", 0 },
{ "secure", OPT_SECURE , NULL, 0, "Use a secure transport to transfer the zone", 0 },
ctx.log_level = LOG_DEBUG;
break;
+ case OPT_QUIET:
+ ctx.log_level = LOG_ERR;
+ break;
+
case OPT_PATH:
ctx.path = arg;
break;