host: Always initialize libosmocore logging before using it

This avoids related ASSERTs or error messages in case any of the
libosmocore / libosmousb API functions internally tries to log
something.

Change-Id: I611c435516856c5c8928d7810fd9a9b831adc199
This commit is contained in:
Harald Welte
2022-03-03 15:25:43 +01:00
parent 039680a8d4
commit ee9ddb8da1
3 changed files with 16 additions and 3 deletions

View File

@@ -447,13 +447,21 @@ int main(int argc, char **argv)
print_welcome();
osmo_init_logging2(NULL, &log_info);
rc = osmo_libusb_init(NULL);
if (rc < 0) {
fprintf(stderr, "libusb initialization failed\n");
return rc;
}
osmo_init_logging2(NULL, &log_info);
log_set_print_category_hex(osmo_stderr_target, false);
log_set_print_category(osmo_stderr_target, true);
log_set_print_level(osmo_stderr_target, true);
log_set_print_filename_pos(osmo_stderr_target, LOG_FILENAME_POS_LINE_END);
log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_NONE);
log_set_category_filter(osmo_stderr_target, DLINP, 1, LOGL_DEBUG);
log_set_category_filter(osmo_stderr_target, DLGLOBAL, 1, LOGL_DEBUG);
while (1) {
int option_index = 0;