Monado OpenXR Runtime
u_logging.h
Go to the documentation of this file.
1// Copyright 2020-2025, Collabora, Ltd.
2// Copyright 2025, NVIDIA CORPORATION.
3// SPDX-License-Identifier: BSL-1.0
4/*!
5 * @file
6 * @brief Basic logging functionality.
7 * @author Jakob Bornecrantz <jakob@collabora.com>
8 * @author Simon Zeni <simon.zeni@collabora.com>
9 * @ingroup aux_log
10 */
11
12
13#pragma once
14
15#include "xrt/xrt_compiler.h"
16#include "xrt/xrt_results.h"
17
18#include "util/u_pretty_print.h"
19
20#include <stdarg.h>
21
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27
28struct xrt_device;
29
30
31/*!
32 * @defgroup aux_log Logging functions
33 * @ingroup aux_util
34 */
35
36/*!
37 * @addtogroup aux_log
38 * @{
39 */
40
41/*!
42 * @brief Logging level enum
43 */
45{
46 U_LOGGING_TRACE, //!< Trace messages, highly verbose.
47 U_LOGGING_DEBUG, //!< Debug messages, verbose.
48 U_LOGGING_INFO, //!< Info messages: not very verbose, not indicating a problem.
49 U_LOGGING_WARN, //!< Warning messages: indicating a potential problem
50 U_LOGGING_ERROR, //!< Error messages: indicating a problem
51 U_LOGGING_RAW, //!< Special level for raw printing, prints a new-line.
52};
53
54/*!
55 * Function typedef for setting the logging sink.
56 *
57 * @param file Source file name associated with a message.
58 * @param line Source file line associated with a message.
59 * @param func Function name associated with a message.
60 * @param level Message level: used for formatting or forwarding to native log functions.
61 * @param format Format string.
62 * @param args Format parameters.
63 * @param data User data.
64 */
65typedef void (*u_log_sink_func_t)(const char *file,
66 int line,
67 const char *func,
68 enum u_logging_level level,
69 const char *format,
70 va_list args,
71 void *data);
72
73/*!
74 * Function typedef for filtering log messages.
75 *
76 * @param file Source file name associated with a message.
77 * @param line Source file line associated with a message.
78 * @param func Function name associated with a message.
79 * @param level Message level: used for formatting or forwarding to native log functions.
80 * @return true if message should be logged, false to filter it out.
81 */
82typedef bool (*u_log_filter_func_t)(const char *file, int line, const char *func, enum u_logging_level level);
83
84/*!
85 * For places where you really want printf, prints a new-line.
86 */
87#define U_LOG_RAW(...) \
88 do { \
89 u_log(__FILE__, __LINE__, __func__, U_LOGGING_RAW, __VA_ARGS__); \
90 } while (false)
91
92/*!
93 * @name Base Logging Utilities
94 * In most cases, you will want to use another macro from this file, or a module/driver-local macro, to do your logging.
95 * @{
96 */
97/*!
98 * @brief Log a message at @p level , with file, line, and function context (always logs) - typically wrapped
99 * in a helper macro.
100 *
101 * @param level A @ref u_logging_level value for this message.
102 * @param ... Format string and optional format arguments.
103 */
104#define U_LOG(level, ...) \
105 do { \
106 u_log(__FILE__, __LINE__, __func__, level, __VA_ARGS__); \
107 } while (false)
108
109/*!
110 * @brief Log at @p level only if the level is at least @p cond_level - typically wrapped in a helper macro.
111 *
112 * Adds file, line, and function context. Like U_LOG() but conditional.
113 *
114 * @param level A @ref u_logging_level value for this message.
115 * @param cond_level The minimum @ref u_logging_level that will be actually output.
116 * @param ... Format string and optional format arguments.
117 */
118#define U_LOG_IFL(level, cond_level, ...) \
119 do { \
120 if (cond_level <= level) { \
121 u_log(__FILE__, __LINE__, __func__, level, __VA_ARGS__); \
122 } \
123 } while (false)
124/*!
125 * @brief Log at @p level for a given @ref xrt_device - typically wrapped in a helper macro.
126 *
127 * Adds file, line, and function context, and forwards device context from provided @p xdev .
128 *
129 * Like U_LOG() but calling u_log_xdev() (which takes a device) instead.
130 *
131 * @param level A @ref u_logging_level value for this message.
132 * @param xdev The @ref xrt_device pointer associated with this message.
133 * @param ... Format string and optional format arguments.
134 */
135#define U_LOG_XDEV(level, xdev, ...) \
136 do { \
137 u_log_xdev(__FILE__, __LINE__, __func__, level, xdev, __VA_ARGS__); \
138 } while (false)
139/*!
140 * @brief Log at @p level for a given @ref xrt_device, only if the level is at least @p cond_level - typically wrapped
141 * in a helper macro.
142 *
143 * Adds file, line, and function context, and forwards device context from provided @p xdev .
144 * @param level A @ref u_logging_level value for this message.
145 * @param cond_level The minimum @ref u_logging_level that will be actually output.
146 * @param xdev The @ref xrt_device pointer associated with this message.
147 * @param ... Format string and optional format arguments.
148 */
149#define U_LOG_XDEV_IFL(level, cond_level, xdev, ...) \
150 do { \
151 if (cond_level <= level) { \
152 u_log_xdev(__FILE__, __LINE__, __func__, level, xdev, __VA_ARGS__); \
153 } \
154 } while (false)
155
156/*!
157 * @brief Log a memory hexdump at @p level only if the level is at least @p cond_level - typically wrapped in a helper
158 * macro.
159 *
160 * Adds file, line, and function context. Like U_LOG_IFL()
161 *
162 * @param level A @ref u_logging_level value for this message.
163 * @param cond_level The minimum @ref u_logging_level that will be actually output.
164 * @param data The data to print in hexdump format
165 * @param data_size The size (in bytes) of the data block
166 */
167#define U_LOG_IFL_HEX(level, cond_level, data, data_size) \
168 do { \
169 if (cond_level <= level) { \
170 u_log_hex(__FILE__, __LINE__, __func__, level, data, data_size); \
171 } \
172 } while (false)
173
174/*!
175 * @brief Log a memory hexdump at @p level for a given @ref xrt_device, only if the level is at least @p cond_level -
176 * typically wrapped in a helper macro.
177 *
178 * Adds file, line, and function context, and forwards device context from provided @p xdev .
179 * @param level A @ref u_logging_level value for this message.
180 * @param cond_level The minimum @ref u_logging_level that will be actually output.
181 * @param xdev The @ref xrt_device pointer associated with this message.
182 * @param data The data to print in hexdump format
183 * @param data_size The size (in bytes) of the data block
184 */
185#define U_LOG_XDEV_IFL_HEX(level, cond_level, xdev, data, data_size) \
186 do { \
187 if (cond_level <= level) { \
188 u_log_xdev_hex(__FILE__, __LINE__, __func__, level, xdev, data, data_size); \
189 } \
190 } while (false)
191
192/*!
193 * This define will error if `XRET` is not `XRT_SUCCESS`, printing out that the
194 * @p FUNC_STR string has failed, then returns @p XRET.
195 *
196 * @param COND_LEVEL Log level used for @p cond_level, in logging helpers.
197 * @param XRET The @p xrt_result_t to check.
198 * @param FUNC_STR String literal with the function name, used for logging.
199 */
200#define U_LOG_CHK_AND_RET(COND_LEVEL, XRET, FUNC_STR) \
201 do { \
202 xrt_result_t _ret = XRET; \
203 if (_ret != XRT_SUCCESS) { \
204 u_log_print_result(COND_LEVEL, __FILE__, __LINE__, __func__, _ret, FUNC_STR); \
205 return _ret; \
206 } \
207 } while (false)
208
209/*!
210 * This define will error if `XRET` is not `XRT_SUCCESS`, printing out that the
211 * @p FUNC_STR string has failed, then gotos @p GOTO.
212 *
213 * @param COND_LEVEL Log level used for @p cond_level, in logging helpers.
214 * @param XRET The @p xrt_result_t to check.
215 * @param FUNC_STR String literal with the function name, used for logging.
216 * @param GOTO Goto label to jump to on error.
217 */
218#define U_LOG_CHK_WITH_GOTO(COND_LEVEL, XRET, FUNC_STR, GOTO) \
219 do { \
220 xrt_result_t _ret = XRET; \
221 if (_ret != XRT_SUCCESS) { \
222 u_log_print_result(COND_LEVEL, __FILE__, __LINE__, __func__, _ret, FUNC_STR); \
223 goto GOTO; \
224 } \
225 } while (false)
226
227/*!
228 * This define will error if `XRET` is not `XRT_SUCCESS`, printing out that the
229 * @p FUNC_STR string has failed, then returns @p RET.
230 *
231 * @param COND_LEVEL Log level used for @p cond_level, in logging helpers.
232 * @param XRET The @p xrt_result_t to check.
233 * @param FUNC_STR String literal with the function name, used for logging.
234 * @param RET The value that is returned on error.
235 */
236#define U_LOG_CHK_WITH_RET(COND_LEVEL, XRET, FUNC_STR, RET) \
237 do { \
238 xrt_result_t _ret = XRET; \
239 if (_ret != XRT_SUCCESS) { \
240 u_log_print_result(COND_LEVEL, __FILE__, __LINE__, __func__, _ret, FUNC_STR); \
241 return RET; \
242 } \
243 } while (false)
244
245/*!
246 * This define will error if `XRET` is not `XRT_SUCCESS`, printing out that the
247 * @p FUNC_STR string has failed, it only prints and does nothing else.
248 *
249 * @param COND_LEVEL Log level used for @p cond_level, in logging helpers.
250 * @param XRET The @p xrt_result_t to check.
251 * @param FUNC_STR String literal with the function name, used for logging.
252 */
253#define U_LOG_CHK_ONLY_PRINT(COND_LEVEL, XRET, FUNC_STR) \
254 do { \
255 xrt_result_t _ret = XRET; \
256 if (_ret != XRT_SUCCESS) { \
257 u_log_print_result(COND_LEVEL, __FILE__, __LINE__, __func__, _ret, FUNC_STR); \
258 } \
259 } while (false)
260
261/*!
262 * This define will error if `XRET` is not `XRT_SUCCESS`, printing out that the
263 * @p FUNC_STR string has failed, then it will always return the value.
264 *
265 * @param COND_LEVEL Log level used for @p cond_level, in logging helpers.
266 * @param XRET The @p xrt_result_t to check and always return.
267 * @param FUNC_STR String literal with the function name, used for logging.
268 */
269#define U_LOG_CHK_ALWAYS_RET(COND_LEVEL, XRET, FUNC_STR) \
270 do { \
271 xrt_result_t _ret = XRET; \
272 if (_ret != XRT_SUCCESS) { \
273 u_log_print_result(COND_LEVEL, __FILE__, __LINE__, __func__, _ret, FUNC_STR); \
274 } \
275 return _ret; \
276 } while (false)
277
278/*!
279 * Returns the global logging level, subsystems own logging level take precedence.
280 */
283
284/*!
285 * Sets the output file for the logging instead of stderr, this function is
286 * externally synchronized with ALL other logging functions. Which means do not
287 * call any other logging function from different threads during a call to this
288 * function. Also to avoid leaks call this function with NULL to close the
289 * internally managed FILE object.
290 *
291 * WANRING THIS FUNCTION IS EXTERNALLY SYNCHRONIZED WITH ALL OTHER FUNCTIONS.
292 */
293void
294u_log_set_output_file(const char *filename);
295
296/*!
297 * @brief Main non-device-related log implementation function: do not call directly, use a macro that wraps it.
298 *
299 * This function always logs: level is used for printing or passed to native logging functions.
300 *
301 * @param file Source file name associated with a message
302 * @param line Source file line associated with a message
303 * @param func Function name associated with a message
304 * @param level Message level: used for formatting or forwarding to native log functions
305 * @param format Format string
306 * @param ... Format parameters
307 */
308void
309u_log(const char *file, int line, const char *func, enum u_logging_level level, const char *format, ...)
310 XRT_PRINTF_FORMAT(5, 6);
311
312/*!
313 * @brief Main device-related log implementation function: do not call directly, use a macro that wraps it.
314 *
315 * This function always logs: level is used for printing or passed to native logging functions.
316 * @param file Source file name associated with a message
317 * @param line Source file line associated with a message
318 * @param func Function name associated with a message
319 * @param level Message level: used for formatting or forwarding to native log functions
320 * @param xdev The associated @ref xrt_device
321 * @param format Format string
322 * @param ... Format parameters
323 */
324void
325u_log_xdev(const char *file,
326 int line,
327 const char *func,
328 enum u_logging_level level,
329 struct xrt_device *xdev,
330 const char *format,
331 ...) XRT_PRINTF_FORMAT(6, 7);
332
333/*!
334 * @brief Log implementation for dumping memory buffers as hex: do not call directly, use a macro that wraps it.
335 *
336 * This function always logs: level is used for printing or passed to native logging functions.
337 *
338 * @param file Source file name associated with a message
339 * @param line Source file line associated with a message
340 * @param func Function name associated with a message
341 * @param level Message level: used for formatting or forwarding to native log functions
342 * @param data Data buffer to dump
343 * @param data_size Size of the data buffer in bytes
344 */
345void
346u_log_hex(const char *file,
347 int line,
348 const char *func,
349 enum u_logging_level level,
350 const uint8_t *data,
351 const size_t data_size);
352
353/*!
354 * @brief Device-related log implementation for dumping memory buffers as hex: do not call directly, use a macro that
355 * wraps it.
356 *
357 * This function always logs: level is used for printing or passed to native logging functions.
358 * @param file Source file name associated with a message
359 * @param line Source file line associated with a message
360 * @param func Function name associated with a message
361 * @param level Message level: used for formatting or forwarding to native log functions
362 * @param xdev The associated @ref xrt_device
363 * @param data Data buffer to dump
364 * @param data_size Size of the data buffer in bytes
365 */
366void
367u_log_xdev_hex(const char *file,
368 int line,
369 const char *func,
370 enum u_logging_level level,
371 struct xrt_device *xdev,
372 const uint8_t *data,
373 const size_t data_size);
374
375/*!
376 * Sets the logging sink, log is still passed on to the platform defined output
377 * as well as the sink.
378 *
379 * @param func Logging function for the calls to be sent to.
380 * @param data User data to be passed into @p func.
381 */
382void
383u_log_set_sink(u_log_sink_func_t func, void *data);
384
385/*!
386 * Helper to print the results of called functions that return xret results, if
387 * the result is @p XRT_SUCCESS will log with info, otherwise error. Will also
388 * check if logging should be done with @p cond_level.
389 *
390 * @param cond_level What the current logging level is.
391 * @param file Callee site (__FILE__).
392 * @param line Callee site (__LINE__).
393 * @param calling_fn Callee site (__func__).
394 * @param xret Result from the called function.
395 * @param called_fn Which function that this return is from.
396 */
397void
398u_log_print_result(enum u_logging_level cond_level,
399 const char *file,
400 int line,
401 const char *calling_fn,
402 xrt_result_t xret,
403 const char *called_fn);
404
405/*!
406 * @brief Add function to set the filter
407 *
408 * @param filter Filter function to set
409 */
410void
412
413/*!
414 * @}
415 */
416
417
418/*!
419 * @name Logging macros conditional on global log level
420 *
421 * These each imply a log level, and will only log if the global log level is equal or lower.
422 * They are often used for one-off logging in a module with few other logging needs,
423 * where having a module-specific log level would be unnecessary.
424 *
425 * @see U_LOG_IFL, u_log_get_global_level()
426 * @param ... Format string and optional format arguments.
427 * @{
428 */
429//! Log a message at U_LOGGING_TRACE level, conditional on the global log level
430#define U_LOG_T(...) U_LOG_IFL_T(u_log_get_global_level(), __VA_ARGS__)
431
432//! Log a message at U_LOGGING_DEBUG level, conditional on the global log level
433#define U_LOG_D(...) U_LOG_IFL_D(u_log_get_global_level(), __VA_ARGS__)
434
435//! Log a message at U_LOGGING_INFO level, conditional on the global log level
436#define U_LOG_I(...) U_LOG_IFL_I(u_log_get_global_level(), __VA_ARGS__)
437
438//! Log a message at U_LOGGING_WARN level, conditional on the global log level
439#define U_LOG_W(...) U_LOG_IFL_W(u_log_get_global_level(), __VA_ARGS__)
440
441//! Log a message at U_LOGGING_ERROR level, conditional on the global log level
442#define U_LOG_E(...) U_LOG_IFL_E(u_log_get_global_level(), __VA_ARGS__)
443
444/*!
445 * @}
446 */
447
448/*!
449 * @name Logging macros conditional on provided log level
450 *
451 * These are often wrapped within a module, to automatically supply
452 * @p cond_level as appropriate for that module.
453 *
454 * @see U_LOG_IFL
455 * @param cond_level The minimum @ref u_logging_level that will be actually output.
456 * @param ... Format string and optional format arguments.
457 *
458 * @{
459 */
460//! Conditionally log a message at U_LOGGING_TRACE level.
461#define U_LOG_IFL_T(cond_level, ...) U_LOG_IFL(U_LOGGING_TRACE, cond_level, __VA_ARGS__)
462//! Conditionally log a message at U_LOGGING_DEBUG level.
463#define U_LOG_IFL_D(cond_level, ...) U_LOG_IFL(U_LOGGING_DEBUG, cond_level, __VA_ARGS__)
464//! Conditionally log a message at U_LOGGING_INFO level.
465#define U_LOG_IFL_I(cond_level, ...) U_LOG_IFL(U_LOGGING_INFO, cond_level, __VA_ARGS__)
466//! Conditionally log a message at U_LOGGING_WARN level.
467#define U_LOG_IFL_W(cond_level, ...) U_LOG_IFL(U_LOGGING_WARN, cond_level, __VA_ARGS__)
468//! Conditionally log a message at U_LOGGING_ERROR level.
469#define U_LOG_IFL_E(cond_level, ...) U_LOG_IFL(U_LOGGING_ERROR, cond_level, __VA_ARGS__)
470
471//! Conditionally log a memory hexdump at U_LOGGING_TRACE level.
472#define U_LOG_IFL_T_HEX(cond_level, data, data_size) U_LOG_IFL_HEX(U_LOGGING_TRACE, cond_level, data, data_size)
473//! Conditionally log a memory hexdump at U_LOGGING_DEBUG level.
474#define U_LOG_IFL_D_HEX(cond_level, data, data_size) U_LOG_IFL_HEX(U_LOGGING_DEBUG, cond_level, data, data_size)
475/*!
476 * @}
477 */
478
479
480
481/*!
482 * @name Device-related logging macros conditional on provided log level
483 *
484 * These are often wrapped within a driver, to automatically supply @p xdev and
485 * @p cond_level from their conventional names and log level member variable.
486 *
487 * @param level A @ref u_logging_level value for this message.
488 * @param cond_level The minimum @ref u_logging_level that will be actually output.
489 * @param xdev The @ref xrt_device pointer associated with this message.
490 * @param ... Format string and optional format arguments.
491 *
492 * @{
493 */
494//! Conditionally log a device-related message at U_LOGGING_TRACE level.
495#define U_LOG_XDEV_IFL_T(xdev, cond_level, ...) U_LOG_XDEV_IFL(U_LOGGING_TRACE, cond_level, xdev, __VA_ARGS__)
496//! Conditionally log a device-related message at U_LOGGING_DEBUG level.
497#define U_LOG_XDEV_IFL_D(xdev, cond_level, ...) U_LOG_XDEV_IFL(U_LOGGING_DEBUG, cond_level, xdev, __VA_ARGS__)
498//! Conditionally log a device-related message at U_LOGGING_INFO level.
499#define U_LOG_XDEV_IFL_I(xdev, cond_level, ...) U_LOG_XDEV_IFL(U_LOGGING_INFO, cond_level, xdev, __VA_ARGS__)
500//! Conditionally log a device-related message at U_LOGGING_WARN level.
501#define U_LOG_XDEV_IFL_W(xdev, cond_level, ...) U_LOG_XDEV_IFL(U_LOGGING_WARN, cond_level, xdev, __VA_ARGS__)
502//! Conditionally log a device-related message at U_LOGGING_ERROR level.
503#define U_LOG_XDEV_IFL_E(xdev, cond_level, ...) U_LOG_XDEV_IFL(U_LOGGING_ERROR, cond_level, xdev, __VA_ARGS__)
504
505//! Conditionally log a device-related memory hexdump at U_LOGGING_TRACE level.
506#define U_LOG_XDEV_IFL_T_HEX(xdev, cond_level, data, data_size) \
507 U_LOG_XDEV_IFL_HEX(U_LOGGING_TRACE, cond_level, xdev, data, data_size)
508//! Conditionally log a device-related memory hexdump message at U_LOGGING_DEBUG level.
509#define U_LOG_XDEV_IFL_D_HEX(xdev, cond_level, data, data_size) \
510 U_LOG_XDEV_IFL_HEX(U_LOGGING_DEBUG, cond_level, xdev, data, data_size)
511/*!
512 * @}
513 */
514
515/*!
516 * @name Device-related error logging macros
517 *
518 * These are printed from a driver at error level.
519 *
520 * @param xdev The @ref xrt_device pointer associated with this message
521 *
522 * @{
523 */
524#define U_LOG_XDEV_UNSUPPORTED_INPUT(xdev, cond_level, name) \
525 do { \
526 struct u_pp_sink_stack_only sink; \
527 u_pp_delegate_t dg = u_pp_sink_stack_only_init(&sink); \
528 u_pp_xrt_input_name(dg, name); \
529 U_LOG_XDEV_IFL_E(xdev, cond_level, "Unsupported input: %s", sink.buffer); \
530 } while (false);
531
532#define U_LOG_XDEV_UNSUPPORTED_OUTPUT(xdev, cond_level, name) \
533 do { \
534 struct u_pp_sink_stack_only sink; \
535 u_pp_delegate_t dg = u_pp_sink_stack_only_init(&sink); \
536 u_pp_xrt_output_name(dg, name); \
537 U_LOG_XDEV_IFL_E(xdev, cond_level, "Unsupported output: %s", sink.buffer); \
538 } while (false);
539
540/*!
541 * @}
542 */
543
544/*!
545 * @name Device-related logging macros that always log.
546 *
547 * These wrap U_LOG_XDEV() to supply the @p level - which is only used for formatting the output, these macros always
548 * log regardless of level.
549 *
550 * @param xdev The @ref xrt_device pointer associated with this message.
551 * @param ... Format string and optional format arguments.
552 * @{
553 */
554//! Log a device-related message at U_LOGGING_TRACE level (always logs).
555#define U_LOG_XDEV_T(xdev, ...) U_LOG_XDEV(U_LOGGING_TRACE, xdev, __VA_ARGS__)
556//! Log a device-related message at U_LOGGING_DEBUG level (always logs).
557#define U_LOG_XDEV_D(xdev, ...) U_LOG_XDEV(U_LOGGING_DEBUG, xdev, __VA_ARGS__)
558//! Log a device-related message at U_LOGGING_INFO level (always logs).
559#define U_LOG_XDEV_I(xdev, ...) U_LOG_XDEV(U_LOGGING_INFO, xdev, __VA_ARGS__)
560//! Log a device-related message at U_LOGGING_WARN level (always logs).
561#define U_LOG_XDEV_W(xdev, ...) U_LOG_XDEV(U_LOGGING_WARN, xdev, __VA_ARGS__)
562//! Log a device-related message at U_LOGGING_ERROR level (always logs).
563#define U_LOG_XDEV_E(xdev, ...) U_LOG_XDEV(U_LOGGING_ERROR, xdev, __VA_ARGS__)
564/*!
565 * @}
566 */
567
568/*!
569 * @}
570 */
571
572
573#ifdef __cplusplus
574}
575#endif
u_logging_level
Logging level enum.
Definition: u_logging.h:45
void u_log(const char *file, int line, const char *func, enum u_logging_level level, const char *format,...) XRT_PRINTF_FORMAT(5
Main non-device-related log implementation function: do not call directly, use a macro that wraps it.
bool(* u_log_filter_func_t)(const char *file, int line, const char *func, enum u_logging_level level)
Function typedef for filtering log messages.
Definition: u_logging.h:82
enum u_logging_level u_log_get_global_level(void)
Returns the global logging level, subsystems own logging level take precedence.
Definition: u_logging.c:70
void u_log_print_result(enum u_logging_level cond_level, const char *file, int line, const char *calling_fn, xrt_result_t xret, const char *called_fn)
Helper to print the results of called functions that return xret results, if the result is XRT_SUCCES...
Definition: u_logging.c:469
void(* u_log_sink_func_t)(const char *file, int line, const char *func, enum u_logging_level level, const char *format, va_list args, void *data)
Function typedef for setting the logging sink.
Definition: u_logging.h:65
void u_log_set_output_file(const char *filename)
Sets the output file for the logging instead of stderr, this function is externally synchronized with...
Definition: u_logging.c:85
void void void u_log_hex(const char *file, int line, const char *func, enum u_logging_level level, const uint8_t *data, const size_t data_size)
Log implementation for dumping memory buffers as hex: do not call directly, use a macro that wraps it...
Definition: u_logging.c:175
void void u_log_xdev(const char *file, int line, const char *func, enum u_logging_level level, struct xrt_device *xdev, const char *format,...) XRT_PRINTF_FORMAT(6
Main device-related log implementation function: do not call directly, use a macro that wraps it.
void u_log_set_filter(u_log_filter_func_t filter)
Add function to set the filter.
Definition: u_logging.c:502
void u_log_set_sink(u_log_sink_func_t func, void *data)
Sets the logging sink, log is still passed on to the platform defined output as well as the sink.
Definition: u_logging.c:119
void u_log_xdev_hex(const char *file, int line, const char *func, enum u_logging_level level, struct xrt_device *xdev, const uint8_t *data, const size_t data_size)
Device-related log implementation for dumping memory buffers as hex: do not call directly,...
Definition: u_logging.c:203
@ U_LOGGING_WARN
Warning messages: indicating a potential problem.
Definition: u_logging.h:49
@ U_LOGGING_DEBUG
Debug messages, verbose.
Definition: u_logging.h:47
@ U_LOGGING_TRACE
Trace messages, highly verbose.
Definition: u_logging.h:46
@ U_LOGGING_RAW
Special level for raw printing, prints a new-line.
Definition: u_logging.h:51
@ U_LOGGING_ERROR
Error messages: indicating a problem.
Definition: u_logging.h:50
@ U_LOGGING_INFO
Info messages: not very verbose, not indicating a problem.
Definition: u_logging.h:48
enum xrt_result xrt_result_t
Result type used across Monado.
A single HMD or input device.
Definition: xrt_device.h:284
Pretty printing various Monado things.
Header holding common defines.
Internal result type for XRT.