From 3a68696bbc221cf80514d296283326a90c96dbce Mon Sep 17 00:00:00 2001 From: ChinYikMing Date: Mon, 10 Feb 2025 12:30:43 +0800 Subject: [PATCH] Suppress logging outputs to honor -q option After introducing log.[ch] in 2e87a75, the behavior of -q option is not honored. This fix it. Close #561 --- src/main.c | 3 +++ src/riscv.c | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index 0ebaed56..dfb67b7b 100644 --- a/src/main.c +++ b/src/main.c @@ -273,6 +273,9 @@ int main(int argc, char **args) attr.data.user.elf_program = opt_prog_name; #endif + /* enable or disable the logging outputs */ + rv_log_set_quiet(opt_quiet_outputs); + /* create the RISC-V runtime */ rv = rv_create(&attr); if (!rv) { diff --git a/src/riscv.c b/src/riscv.c index 95ff4ddb..d277618e 100644 --- a/src/riscv.c +++ b/src/riscv.c @@ -417,9 +417,6 @@ riscv_t *rv_create(riscv_user_t rv_attr) rv_log_set_level(attr->log_level); rv_log_info("Log level: %s", rv_log_level_string(attr->log_level)); - /* enable the log */ - rv_log_set_quiet(false); - #if !RV32_HAS(SYSTEM) || (RV32_HAS(SYSTEM) && RV32_HAS(ELF_LOADER)) elf_t *elf = elf_new(); assert(elf);