mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-16 21:28:33 +03:00
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:
@@ -447,13 +447,21 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
print_welcome();
|
print_welcome();
|
||||||
|
|
||||||
|
osmo_init_logging2(NULL, &log_info);
|
||||||
|
|
||||||
rc = osmo_libusb_init(NULL);
|
rc = osmo_libusb_init(NULL);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
fprintf(stderr, "libusb initialization failed\n");
|
fprintf(stderr, "libusb initialization failed\n");
|
||||||
return rc;
|
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) {
|
while (1) {
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
|
|||||||
@@ -290,6 +290,8 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
transp->udp_fd = -1;
|
transp->udp_fd = -1;
|
||||||
|
|
||||||
|
print_welcome();
|
||||||
|
|
||||||
osmo_init_logging2(NULL, &log_info);
|
osmo_init_logging2(NULL, &log_info);
|
||||||
|
|
||||||
rc = osmo_libusb_init(NULL);
|
rc = osmo_libusb_init(NULL);
|
||||||
@@ -298,8 +300,6 @@ int main(int argc, char **argv)
|
|||||||
goto do_exit;
|
goto do_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
print_welcome();
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (transp->udp_fd < 0) {
|
if (transp->udp_fd < 0) {
|
||||||
struct usb_interface_match _ifm, *ifm = &_ifm;
|
struct usb_interface_match _ifm, *ifm = &_ifm;
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <osmocom/core/utils.h>
|
#include <osmocom/core/utils.h>
|
||||||
|
#include <osmocom/core/logging.h>
|
||||||
|
#include <osmocom/core/application.h>
|
||||||
|
|
||||||
#include <osmocom/usb/libusb.h>
|
#include <osmocom/usb/libusb.h>
|
||||||
#include <osmocom/simtrace2/simtrace_usb.h>
|
#include <osmocom/simtrace2/simtrace_usb.h>
|
||||||
@@ -71,8 +73,11 @@ static int find_devices(void)
|
|||||||
return num_interfaces;
|
return num_interfaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct log_info log_info = {};
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
osmo_init_logging2(NULL, &log_info);
|
||||||
osmo_libusb_init(NULL);
|
osmo_libusb_init(NULL);
|
||||||
find_devices();
|
find_devices();
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user