Skip to content

Commit 41a14fe

Browse files
committed
krun: Propagate crun log level to libkrun
Rather than hard-coding the krun log level to ERROR, align with the log verbosity of crun. Signed-off-by: Jake Correnti <[email protected]>
1 parent 617e653 commit 41a14fe

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/libcrun/handlers/krun.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,19 @@ libkrun_exec (void *cookie, libcrun_container_t *container, const char *pathname
343343
if (krun_set_log_level == NULL || krun_start_enter == NULL)
344344
error (EXIT_FAILURE, 0, "could not find symbol in the krun library");
345345

346-
/* Set log level to "error" */
347-
krun_set_log_level (1);
346+
/* Set log level according to crun's verbosity. */
347+
switch (libcrun_get_verbosity ())
348+
{
349+
case LIBCRUN_VERBOSITY_DEBUG:
350+
krun_set_log_level (KRUN_LOG_LEVEL_DEBUG);
351+
break;
352+
case LIBCRUN_VERBOSITY_WARNING:
353+
krun_set_log_level (KRUN_LOG_LEVEL_WARN);
354+
break;
355+
default:
356+
krun_set_log_level (KRUN_LOG_LEVEL_ERROR);
357+
break;
358+
}
348359

349360
if (kconf->sev)
350361
{

0 commit comments

Comments
 (0)