Monado OpenXR Runtime
|
Files | |
file | u_logging.h |
Basic logging functionality. | |
Macros | |
#define | U_LOG_RAW(...) |
For places where you really want printf, prints a new-line. More... | |
Typedefs | |
typedef 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. More... | |
Enumerations | |
enum | u_logging_level { U_LOGGING_TRACE , U_LOGGING_DEBUG , U_LOGGING_INFO , U_LOGGING_WARN , U_LOGGING_ERROR , U_LOGGING_RAW } |
Logging level enum. More... | |
Base Logging Utilities | |
In most cases, you will want to use another macro from this file, or a module/driver-local macro, to do your logging. | |
enum u_logging_level | u_log_get_global_level (void) |
Returns the global logging level, subsystems own logging level take precedence. More... | |
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. More... | |
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. More... | |
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. More... | |
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, use a macro that wraps it. More... | |
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. More... | |
#define | U_LOG(level, ...) |
Log a message at level , with file, line, and function context (always logs) - typically wrapped in a helper macro. More... | |
#define | U_LOG_IFL(level, cond_level, ...) |
Log at level only if the level is at least cond_level - typically wrapped in a helper macro. More... | |
#define | U_LOG_XDEV(level, xdev, ...) |
Log at level for a given xrt_device - typically wrapped in a helper macro. More... | |
#define | U_LOG_XDEV_IFL(level, cond_level, xdev, ...) |
Log at level for a given xrt_device, only if the level is at least cond_level - typically wrapped in a helper macro. More... | |
#define | U_LOG_IFL_HEX(level, cond_level, data, data_size) |
Log a memory hexdump at level only if the level is at least cond_level - typically wrapped in a helper macro. More... | |
#define | U_LOG_XDEV_IFL_HEX(level, cond_level, xdev, data, data_size) |
Log a memory hexdump at level for a given xrt_device, only if the level is at least cond_level - typically wrapped in a helper macro. More... | |
Logging macros conditional on global log level | |||
These each imply a log level, and will only log if the global log level is equal or lower. They are often used for one-off logging in a module with few other logging needs, where having a module-specific log level would be unnecessary.
| |||
#define | U_LOG_T(...) U_LOG_IFL_T(u_log_get_global_level(), __VA_ARGS__) | ||
Log a message at U_LOGGING_TRACE level, conditional on the global log level. More... | |||
#define | U_LOG_D(...) U_LOG_IFL_D(u_log_get_global_level(), __VA_ARGS__) | ||
Log a message at U_LOGGING_DEBUG level, conditional on the global log level. More... | |||
#define | U_LOG_I(...) U_LOG_IFL_I(u_log_get_global_level(), __VA_ARGS__) | ||
Log a message at U_LOGGING_INFO level, conditional on the global log level. More... | |||
#define | U_LOG_W(...) U_LOG_IFL_W(u_log_get_global_level(), __VA_ARGS__) | ||
Log a message at U_LOGGING_WARN level, conditional on the global log level. More... | |||
#define | U_LOG_E(...) U_LOG_IFL_E(u_log_get_global_level(), __VA_ARGS__) | ||
Log a message at U_LOGGING_ERROR level, conditional on the global log level. More... | |||
Logging macros conditional on provided log level | |||||
These are often wrapped within a module, to automatically supply
| |||||
#define | U_LOG_IFL_T(cond_level, ...) U_LOG_IFL(U_LOGGING_TRACE, cond_level, __VA_ARGS__) | ||||
Conditionally log a message at U_LOGGING_TRACE level. More... | |||||
#define | U_LOG_IFL_D(cond_level, ...) U_LOG_IFL(U_LOGGING_DEBUG, cond_level, __VA_ARGS__) | ||||
Conditionally log a message at U_LOGGING_DEBUG level. More... | |||||
#define | U_LOG_IFL_I(cond_level, ...) U_LOG_IFL(U_LOGGING_INFO, cond_level, __VA_ARGS__) | ||||
Conditionally log a message at U_LOGGING_INFO level. More... | |||||
#define | U_LOG_IFL_W(cond_level, ...) U_LOG_IFL(U_LOGGING_WARN, cond_level, __VA_ARGS__) | ||||
Conditionally log a message at U_LOGGING_WARN level. More... | |||||
#define | U_LOG_IFL_E(cond_level, ...) U_LOG_IFL(U_LOGGING_ERROR, cond_level, __VA_ARGS__) | ||||
Conditionally log a message at U_LOGGING_ERROR level. More... | |||||
#define | U_LOG_IFL_T_HEX(cond_level, data, data_size) U_LOG_IFL_HEX(U_LOGGING_TRACE, cond_level, data, data_size) | ||||
Conditionally log a memory hexdump at U_LOGGING_TRACE level. More... | |||||
#define | U_LOG_IFL_D_HEX(cond_level, data, data_size) U_LOG_IFL_HEX(U_LOGGING_DEBUG, cond_level, data, data_size) | ||||
Conditionally log a memory hexdump at U_LOGGING_DEBUG level. More... | |||||
Device-related logging macros conditional on provided log level | |||||||||
These are often wrapped within a driver, to automatically supply
| |||||||||
#define | U_LOG_XDEV_IFL_T(xdev, cond_level, ...) U_LOG_XDEV_IFL(U_LOGGING_TRACE, cond_level, xdev, __VA_ARGS__) | ||||||||
Conditionally log a device-related message at U_LOGGING_TRACE level. More... | |||||||||
#define | U_LOG_XDEV_IFL_D(xdev, cond_level, ...) U_LOG_XDEV_IFL(U_LOGGING_DEBUG, cond_level, xdev, __VA_ARGS__) | ||||||||
Conditionally log a device-related message at U_LOGGING_DEBUG level. More... | |||||||||
#define | U_LOG_XDEV_IFL_I(xdev, cond_level, ...) U_LOG_XDEV_IFL(U_LOGGING_INFO, cond_level, xdev, __VA_ARGS__) | ||||||||
Conditionally log a device-related message at U_LOGGING_INFO level. More... | |||||||||
#define | U_LOG_XDEV_IFL_W(xdev, cond_level, ...) U_LOG_XDEV_IFL(U_LOGGING_WARN, cond_level, xdev, __VA_ARGS__) | ||||||||
Conditionally log a device-related message at U_LOGGING_WARN level. More... | |||||||||
#define | U_LOG_XDEV_IFL_E(xdev, cond_level, ...) U_LOG_XDEV_IFL(U_LOGGING_ERROR, cond_level, xdev, __VA_ARGS__) | ||||||||
Conditionally log a device-related message at U_LOGGING_ERROR level. More... | |||||||||
#define | U_LOG_XDEV_IFL_T_HEX(xdev, cond_level, data, data_size) U_LOG_XDEV_IFL_HEX(U_LOGGING_TRACE, cond_level, xdev, data, data_size) | ||||||||
Conditionally log a device-related memory hexdump at U_LOGGING_TRACE level. More... | |||||||||
#define | U_LOG_XDEV_IFL_D_HEX(xdev, cond_level, data, data_size) U_LOG_XDEV_IFL_HEX(U_LOGGING_DEBUG, cond_level, xdev, data, data_size) | ||||||||
Conditionally log a device-related memory hexdump message at U_LOGGING_DEBUG level. More... | |||||||||
Device-related error logging macros | |||
These are printed from a driver at error level.
| |||
#define | U_LOG_XDEV_UNSUPPORTED_INPUT(xdev, cond_level, name) | ||
Device-related logging macros that always log. | |||||
These wrap U_LOG_XDEV() to supply the
| |||||
#define | U_LOG_XDEV_T(xdev, ...) U_LOG_XDEV(U_LOGGING_TRACE, xdev, __VA_ARGS__) | ||||
Log a device-related message at U_LOGGING_TRACE level (always logs). More... | |||||
#define | U_LOG_XDEV_D(xdev, ...) U_LOG_XDEV(U_LOGGING_DEBUG, xdev, __VA_ARGS__) | ||||
Log a device-related message at U_LOGGING_DEBUG level (always logs). More... | |||||
#define | U_LOG_XDEV_I(xdev, ...) U_LOG_XDEV(U_LOGGING_INFO, xdev, __VA_ARGS__) | ||||
Log a device-related message at U_LOGGING_INFO level (always logs). More... | |||||
#define | U_LOG_XDEV_W(xdev, ...) U_LOG_XDEV(U_LOGGING_WARN, xdev, __VA_ARGS__) | ||||
Log a device-related message at U_LOGGING_WARN level (always logs). More... | |||||
#define | U_LOG_XDEV_E(xdev, ...) U_LOG_XDEV(U_LOGGING_ERROR, xdev, __VA_ARGS__) | ||||
Log a device-related message at U_LOGGING_ERROR level (always logs). More... | |||||
#define U_LOG | ( | level, | |
... | |||
) |
#include <auxiliary/util/u_logging.h>
Log a message at level
, with file, line, and function context (always logs) - typically wrapped in a helper macro.
level | A u_logging_level value for this message. |
... | Format string and optional format arguments. |
#define U_LOG_D | ( | ... | ) | U_LOG_IFL_D(u_log_get_global_level(), __VA_ARGS__) |
#include <auxiliary/util/u_logging.h>
Log a message at U_LOGGING_DEBUG level, conditional on the global log level.
#define U_LOG_E | ( | ... | ) | U_LOG_IFL_E(u_log_get_global_level(), __VA_ARGS__) |
#include <auxiliary/util/u_logging.h>
Log a message at U_LOGGING_ERROR level, conditional on the global log level.
#define U_LOG_I | ( | ... | ) | U_LOG_IFL_I(u_log_get_global_level(), __VA_ARGS__) |
#include <auxiliary/util/u_logging.h>
Log a message at U_LOGGING_INFO level, conditional on the global log level.
#define U_LOG_IFL | ( | level, | |
cond_level, | |||
... | |||
) |
#include <auxiliary/util/u_logging.h>
Log at level
only if the level is at least cond_level
- typically wrapped in a helper macro.
Adds file, line, and function context. Like U_LOG() but conditional.
level | A u_logging_level value for this message. |
cond_level | The minimum u_logging_level that will be actually output. |
... | Format string and optional format arguments. |
#define U_LOG_IFL_D | ( | cond_level, | |
... | |||
) | U_LOG_IFL(U_LOGGING_DEBUG, cond_level, __VA_ARGS__) |
#include <auxiliary/util/u_logging.h>
Conditionally log a message at U_LOGGING_DEBUG level.
#define U_LOG_IFL_D_HEX | ( | cond_level, | |
data, | |||
data_size | |||
) | U_LOG_IFL_HEX(U_LOGGING_DEBUG, cond_level, data, data_size) |
#include <auxiliary/util/u_logging.h>
Conditionally log a memory hexdump at U_LOGGING_DEBUG level.
#define U_LOG_IFL_E | ( | cond_level, | |
... | |||
) | U_LOG_IFL(U_LOGGING_ERROR, cond_level, __VA_ARGS__) |
#include <auxiliary/util/u_logging.h>
Conditionally log a message at U_LOGGING_ERROR level.
#define U_LOG_IFL_HEX | ( | level, | |
cond_level, | |||
data, | |||
data_size | |||
) |
#include <auxiliary/util/u_logging.h>
Log a memory hexdump at level
only if the level is at least cond_level
- typically wrapped in a helper macro.
Adds file, line, and function context. Like U_LOG_IFL()
level | A u_logging_level value for this message. |
cond_level | The minimum u_logging_level that will be actually output. |
data | The data to print in hexdump format |
data_size | The size (in bytes) of the data block |
#define U_LOG_IFL_I | ( | cond_level, | |
... | |||
) | U_LOG_IFL(U_LOGGING_INFO, cond_level, __VA_ARGS__) |
#include <auxiliary/util/u_logging.h>
Conditionally log a message at U_LOGGING_INFO level.
#define U_LOG_IFL_T | ( | cond_level, | |
... | |||
) | U_LOG_IFL(U_LOGGING_TRACE, cond_level, __VA_ARGS__) |
#include <auxiliary/util/u_logging.h>
Conditionally log a message at U_LOGGING_TRACE level.
#define U_LOG_IFL_T_HEX | ( | cond_level, | |
data, | |||
data_size | |||
) | U_LOG_IFL_HEX(U_LOGGING_TRACE, cond_level, data, data_size) |
#include <auxiliary/util/u_logging.h>
Conditionally log a memory hexdump at U_LOGGING_TRACE level.
#define U_LOG_IFL_W | ( | cond_level, | |
... | |||
) | U_LOG_IFL(U_LOGGING_WARN, cond_level, __VA_ARGS__) |
#include <auxiliary/util/u_logging.h>
Conditionally log a message at U_LOGGING_WARN level.
#define U_LOG_RAW | ( | ... | ) |
#include <auxiliary/util/u_logging.h>
For places where you really want printf, prints a new-line.
#define U_LOG_T | ( | ... | ) | U_LOG_IFL_T(u_log_get_global_level(), __VA_ARGS__) |
#include <auxiliary/util/u_logging.h>
Log a message at U_LOGGING_TRACE level, conditional on the global log level.
#define U_LOG_W | ( | ... | ) | U_LOG_IFL_W(u_log_get_global_level(), __VA_ARGS__) |
#include <auxiliary/util/u_logging.h>
Log a message at U_LOGGING_WARN level, conditional on the global log level.
#define U_LOG_XDEV | ( | level, | |
xdev, | |||
... | |||
) |
#include <auxiliary/util/u_logging.h>
Log at level
for a given xrt_device - typically wrapped in a helper macro.
Adds file, line, and function context, and forwards device context from provided xdev
.
Like U_LOG() but calling u_log_xdev() (which takes a device) instead.
level | A u_logging_level value for this message. |
xdev | The xrt_device pointer associated with this message. |
... | Format string and optional format arguments. |
#define U_LOG_XDEV_D | ( | xdev, | |
... | |||
) | U_LOG_XDEV(U_LOGGING_DEBUG, xdev, __VA_ARGS__) |
#include <auxiliary/util/u_logging.h>
Log a device-related message at U_LOGGING_DEBUG level (always logs).
#define U_LOG_XDEV_E | ( | xdev, | |
... | |||
) | U_LOG_XDEV(U_LOGGING_ERROR, xdev, __VA_ARGS__) |
#include <auxiliary/util/u_logging.h>
Log a device-related message at U_LOGGING_ERROR level (always logs).
#define U_LOG_XDEV_I | ( | xdev, | |
... | |||
) | U_LOG_XDEV(U_LOGGING_INFO, xdev, __VA_ARGS__) |
#include <auxiliary/util/u_logging.h>
Log a device-related message at U_LOGGING_INFO level (always logs).
#define U_LOG_XDEV_IFL | ( | level, | |
cond_level, | |||
xdev, | |||
... | |||
) |
#include <auxiliary/util/u_logging.h>
Log at level
for a given xrt_device, only if the level is at least cond_level
- typically wrapped in a helper macro.
Adds file, line, and function context, and forwards device context from provided xdev
.
level | A u_logging_level value for this message. |
cond_level | The minimum u_logging_level that will be actually output. |
xdev | The xrt_device pointer associated with this message. |
... | Format string and optional format arguments. |
#define U_LOG_XDEV_IFL_D | ( | xdev, | |
cond_level, | |||
... | |||
) | U_LOG_XDEV_IFL(U_LOGGING_DEBUG, cond_level, xdev, __VA_ARGS__) |
#include <auxiliary/util/u_logging.h>
Conditionally log a device-related message at U_LOGGING_DEBUG level.
#define U_LOG_XDEV_IFL_D_HEX | ( | xdev, | |
cond_level, | |||
data, | |||
data_size | |||
) | U_LOG_XDEV_IFL_HEX(U_LOGGING_DEBUG, cond_level, xdev, data, data_size) |
#include <auxiliary/util/u_logging.h>
Conditionally log a device-related memory hexdump message at U_LOGGING_DEBUG level.
#define U_LOG_XDEV_IFL_E | ( | xdev, | |
cond_level, | |||
... | |||
) | U_LOG_XDEV_IFL(U_LOGGING_ERROR, cond_level, xdev, __VA_ARGS__) |
#include <auxiliary/util/u_logging.h>
Conditionally log a device-related message at U_LOGGING_ERROR level.
#define U_LOG_XDEV_IFL_HEX | ( | level, | |
cond_level, | |||
xdev, | |||
data, | |||
data_size | |||
) |
#include <auxiliary/util/u_logging.h>
Log a memory hexdump at level
for a given xrt_device, only if the level is at least cond_level
- typically wrapped in a helper macro.
Adds file, line, and function context, and forwards device context from provided xdev
.
level | A u_logging_level value for this message. |
cond_level | The minimum u_logging_level that will be actually output. |
xdev | The xrt_device pointer associated with this message. |
data | The data to print in hexdump format |
data_size | The size (in bytes) of the data block |
#define U_LOG_XDEV_IFL_I | ( | xdev, | |
cond_level, | |||
... | |||
) | U_LOG_XDEV_IFL(U_LOGGING_INFO, cond_level, xdev, __VA_ARGS__) |
#include <auxiliary/util/u_logging.h>
Conditionally log a device-related message at U_LOGGING_INFO level.
#define U_LOG_XDEV_IFL_T | ( | xdev, | |
cond_level, | |||
... | |||
) | U_LOG_XDEV_IFL(U_LOGGING_TRACE, cond_level, xdev, __VA_ARGS__) |
#include <auxiliary/util/u_logging.h>
Conditionally log a device-related message at U_LOGGING_TRACE level.
#define U_LOG_XDEV_IFL_T_HEX | ( | xdev, | |
cond_level, | |||
data, | |||
data_size | |||
) | U_LOG_XDEV_IFL_HEX(U_LOGGING_TRACE, cond_level, xdev, data, data_size) |
#include <auxiliary/util/u_logging.h>
Conditionally log a device-related memory hexdump at U_LOGGING_TRACE level.
#define U_LOG_XDEV_IFL_W | ( | xdev, | |
cond_level, | |||
... | |||
) | U_LOG_XDEV_IFL(U_LOGGING_WARN, cond_level, xdev, __VA_ARGS__) |
#include <auxiliary/util/u_logging.h>
Conditionally log a device-related message at U_LOGGING_WARN level.
#define U_LOG_XDEV_T | ( | xdev, | |
... | |||
) | U_LOG_XDEV(U_LOGGING_TRACE, xdev, __VA_ARGS__) |
#include <auxiliary/util/u_logging.h>
Log a device-related message at U_LOGGING_TRACE level (always logs).
#define U_LOG_XDEV_UNSUPPORTED_INPUT | ( | xdev, | |
cond_level, | |||
name | |||
) |
#include <auxiliary/util/u_logging.h>
#define U_LOG_XDEV_W | ( | xdev, | |
... | |||
) | U_LOG_XDEV(U_LOGGING_WARN, xdev, __VA_ARGS__) |
#include <auxiliary/util/u_logging.h>
Log a device-related message at U_LOGGING_WARN level (always logs).
typedef 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) |
#include <auxiliary/util/u_logging.h>
Function typedef for setting the logging sink.
file | Source file name associated with a message. |
line | Source file line associated with a message. |
func | Function name associated with a message. |
level | Message level: used for formatting or forwarding to native log functions. |
format | Format string. |
args | Format parameters. |
data | User data. |
enum u_logging_level |
#include <auxiliary/util/u_logging.h>
Logging level enum.
void u_log | ( | const char * | file, |
int | line, | ||
const char * | func, | ||
enum u_logging_level | level, | ||
const char * | format, | ||
... | |||
) |
#include <auxiliary/util/u_logging.h>
Main non-device-related log implementation function: do not call directly, use a macro that wraps it.
This function always logs: level is used for printing or passed to native logging functions.
file | Source file name associated with a message |
line | Source file line associated with a message |
func | Function name associated with a message |
level | Message level: used for formatting or forwarding to native log functions |
format | Format string |
... | Format parameters |
enum u_logging_level u_log_get_global_level | ( | void | ) |
#include <auxiliary/util/u_logging.h>
Returns the global logging level, subsystems own logging level take precedence.
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 | ||
) |
#include <auxiliary/util/u_logging.h>
Log implementation for dumping memory buffers as hex: do not call directly, use a macro that wraps it.
This function always logs: level is used for printing or passed to native logging functions.
file | Source file name associated with a message |
line | Source file line associated with a message |
func | Function name associated with a message |
level | Message level: used for formatting or forwarding to native log functions |
data | Data buffer to dump |
data_size | Size of the data buffer in bytes |
void u_log_set_sink | ( | u_log_sink_func_t | func, |
void * | data | ||
) |
#include <auxiliary/util/u_logging.h>
Sets the logging sink, log is still passed on to the platform defined output as well as the sink.
func | Logging function for the calls to be sent to. |
data | User data to be passed into func . |
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, | ||
... | |||
) |
#include <auxiliary/util/u_logging.h>
Main device-related log implementation function: do not call directly, use a macro that wraps it.
This function always logs: level is used for printing or passed to native logging functions.
file | Source file name associated with a message |
line | Source file line associated with a message |
func | Function name associated with a message |
level | Message level: used for formatting or forwarding to native log functions |
xdev | The associated xrt_device |
format | Format string |
... | Format parameters |
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 | ||
) |
#include <auxiliary/util/u_logging.h>
Device-related log implementation for dumping memory buffers as hex: do not call directly, use a macro that wraps it.
This function always logs: level is used for printing or passed to native logging functions.
file | Source file name associated with a message |
line | Source file line associated with a message |
func | Function name associated with a message |
level | Message level: used for formatting or forwarding to native log functions |
xdev | The associated xrt_device |
data | Data buffer to dump |
data_size | Size of the data buffer in bytes |