The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

d/dummy: Switch to logging API

+7 -30
+7 -30
src/xrt/drivers/dummy/dummy_hmd.c
··· 19 19 #include "util/u_time.h" 20 20 #include "util/u_debug.h" 21 21 #include "util/u_device.h" 22 + #include "util/u_logging.h" 22 23 #include "util/u_distortion_mesh.h" 23 24 24 25 #include <stdio.h> ··· 45 46 uint64_t created_ns; 46 47 float diameter_m; 47 48 48 - bool print_spew; 49 - bool print_debug; 49 + enum u_logging_level log_level; 50 50 }; 51 51 52 52 ··· 62 62 return (struct dummy_hmd *)xdev; 63 63 } 64 64 65 - DEBUG_GET_ONCE_BOOL_OPTION(dummy_spew, "DUMMY_PRINT_SPEW", false) 66 - DEBUG_GET_ONCE_BOOL_OPTION(dummy_debug, "DUMMY_PRINT_DEBUG", false) 67 - 68 - #define DH_SPEW(dh, ...) \ 69 - do { \ 70 - if (dh->print_spew) { \ 71 - fprintf(stderr, "%s - ", __func__); \ 72 - fprintf(stderr, __VA_ARGS__); \ 73 - fprintf(stderr, "\n"); \ 74 - } \ 75 - } while (false) 76 - 77 - #define DH_DEBUG(dh, ...) \ 78 - do { \ 79 - if (dh->print_debug) { \ 80 - fprintf(stderr, "%s - ", __func__); \ 81 - fprintf(stderr, __VA_ARGS__); \ 82 - fprintf(stderr, "\n"); \ 83 - } \ 84 - } while (false) 65 + DEBUG_GET_ONCE_LOG_OPTION(dummy_log, "DUMMY_LOG", U_LOGGING_WARN) 85 66 86 - #define DH_ERROR(dh, ...) \ 87 - do { \ 88 - fprintf(stderr, "%s - ", __func__); \ 89 - fprintf(stderr, __VA_ARGS__); \ 90 - fprintf(stderr, "\n"); \ 91 - } while (false) 67 + #define DH_TRACE(p, ...) U_LOG_XDEV_IFL_T(&dh->base, dh->log_level, __VA_ARGS__) 68 + #define DH_DEBUG(p, ...) U_LOG_XDEV_IFL_D(&dh->base, dh->log_level, __VA_ARGS__) 69 + #define DH_ERROR(p, ...) U_LOG_XDEV_IFL_E(&dh->base, dh->log_level, __VA_ARGS__) 92 70 93 71 static void 94 72 dummy_hmd_destroy(struct xrt_device *xdev) ··· 184 162 dh->pose.orientation.w = 1.0f; // All other values set to zero. 185 163 dh->created_ns = os_monotonic_get_ns(); 186 164 dh->diameter_m = 0.05; 187 - dh->print_spew = debug_get_bool_option_dummy_spew(); 188 - dh->print_debug = debug_get_bool_option_dummy_debug(); 165 + dh->log_level = debug_get_log_option_dummy_log(); 189 166 190 167 // Print name. 191 168 snprintf(dh->base.str, XRT_DEVICE_NAME_LEN, "Dummy HMD");