u/logging: add U_LOG_XDEV_UNSUPPORTED_INPUT macro

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2271>
This commit is contained in:
Simon Zeni 2024-11-13 16:42:09 -05:00
parent e113b532b6
commit d13a36beec

View file

@ -1,9 +1,10 @@
// Copyright 2020, Collabora, Ltd.
// Copyright 2020-2024, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
* @brief Basic logging functionality.
* @author Jakob Bornecrantz <jakob@collabora.com>
* @author Simon Zeni <simon.zeni@collabora.com>
* @ingroup aux_log
*/
@ -12,6 +13,8 @@
#include "xrt/xrt_compiler.h"
#include "util/u_pretty_print.h"
#include <stdarg.h>
@ -371,6 +374,27 @@ u_log_set_sink(u_log_sink_func_t func, void *data);
* @}
*/
/*!
* @name Device-related error logging macros
*
* These are printed from a driver at error level.
*
* @param xdev The @ref xrt_device pointer associated with this message
*
* @{
*/
#define U_LOG_XDEV_UNSUPPORTED_INPUT(xdev, cond_level, name) \
do { \
struct u_pp_sink_stack_only sink; \
u_pp_delegate_t dg = u_pp_sink_stack_only_init(&sink); \
u_pp_xrt_input_name(dg, name); \
U_LOG_XDEV_IFL_E(xdev, cond_level, "Unsupported input: %s", sink.buffer); \
} while (false);
/*!
* @}
*/
/*!
* @name Device-related logging macros that always log.
*