From 3c1982da4c4353393ce3e843500cea78475e9fcb Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 16 May 2012 09:49:28 +0200 Subject: [PATCH] improve logging verbosity adapt to changes in log module --- src/main.c | 17 +++++++++++++++++ src/monsters.c | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index d860d2fb9..00a277a82 100644 --- a/src/main.c +++ b/src/main.c @@ -105,6 +105,23 @@ static int parse_args(int argc, char **argv, int *exitcode) } } + switch (verbosity) { + case 0: + log_stderr = 0; + break; + case 1: + log_stderr = LOG_CPERROR; + break; + case 2: + log_stderr = LOG_CPERROR|LOG_CPWARNING; + break; + case 3: + log_stderr = LOG_CPERROR|LOG_CPWARNING|LOG_CPDEBUG; + break; + default: + log_stderr = LOG_CPERROR|LOG_CPWARNING|LOG_CPDEBUG|LOG_CPINFO; + break; + } if (run_tests) { *exitcode = RunAllTests(); return 1; diff --git a/src/monsters.c b/src/monsters.c index 1a3ee65b6..3040bbfb5 100644 --- a/src/monsters.c +++ b/src/monsters.c @@ -910,7 +910,7 @@ void spawn_dragons(void) equip_unit(u, get_equipment("monster_dragon")); if (verbosity >= 2) { - log_printf("%d %s in %s.\n", u->number, + log_printf(stdout, "%d %s in %s.\n", u->number, LOC(default_locale, rc_name(u->race, u->number != 1)), regionname(r, NULL)); } @@ -985,7 +985,7 @@ void spawn_undead(void) name_unit(u); if (verbosity >= 2) { - log_printf("%d %s in %s.\n", u->number, + log_printf(stdout, "%d %s in %s.\n", u->number, LOC(default_locale, rc_name(u->race, u->number != 1)), regionname(r, NULL)); }