Monado OpenXR Runtime
Loading...
Searching...
No Matches
openvr_logger.hpp File Reference

Logging functions. More...

#include "util/u_pretty_print.h"
#include "util/u_logging.h"
#include <type_traits>
#include <typeinfo>
Include dependency graph for openvr_logger.hpp:

Go to the source code of this file.

Data Structures

struct  xrt::state_trackers::openvr::openvr_logger
 

Macros

#define CURRENT_CLASSNAME   typeid(std::remove_reference<decltype(classMacroImpl(this))>::type).name()
 
#define OPENVR_LOGGER_INIT(logger)   openvr_log_init(logger, CURRENT_CLASSNAME, __FUNCTION__)
 
#define OPENVR_LOG_TRACE(logger, fmt, ...)   openvr_log(logger, U_LOGGING_TRACE, fmt __VA_OPT__(, ) __VA_ARGS__)
 
#define OPENVR_LOG_DEBUG(logger, fmt, ...)   openvr_log(logger, U_LOGGING_DEBUG, fmt __VA_OPT__(, ) __VA_ARGS__)
 
#define OPENVR_LOG_INFO(logger, fmt, ...)   openvr_log(logger, U_LOGGING_INFO, fmt __VA_OPT__(, ) __VA_ARGS__)
 
#define OPENVR_LOG_WARN(logger, fmt, ...)   openvr_log(logger, U_LOGGING_WARN, fmt __VA_OPT__(, ) __VA_ARGS__)
 
#define OPENVR_LOG_ERROR(logger, fmt, ...)   openvr_log(logger, U_LOGGING_ERROR, fmt __VA_OPT__(, ) __VA_ARGS__)
 
#define OPENVR_LOG_UNIMPLEMENTED(logger, fmt, ...)
 Specialized macro for logging an unimplemented function.
 
#define OPENVR_LOG_UNIMPLEMENTED_RET(logger, fmt, ret, ...)
 Specialized macro for logging an unimplemented function and returning a value.
 
#define OPENVR_LOG_ERROR_XRET(logger, fmt, xret, ...)
 Logs an xrt_result_t error with a formatted message.
 

Functions

template<class T >
T & xrt::state_trackers::openvr::classMacroImpl (const T *t)
 
void xrt::state_trackers::openvr::openvr_log_init (struct openvr_logger &logger, const char *class_name, const char *api_func_name)
 
void xrt::state_trackers::openvr::openvr_log (struct openvr_logger &logger, u_logging_level log_level, const char *fmt,...)
 

Detailed Description

Macro Definition Documentation

◆ OPENVR_LOG_ERROR_XRET

#define OPENVR_LOG_ERROR_XRET (   logger,
  fmt,
  xret,
  ... 
)
Value:
do { \
u_pp_delegate_t dg = u_pp_sink_stack_only_init(&sink); \
u_pp_xrt_result(dg, xret); \
OPENVR_LOG_ERROR(logger, fmt " (xrt_result: %s)" __VA_OPT__(, ) __VA_ARGS__, sink.buffer); \
} while (false)
Helper struct to hold a function pointer and data pointer.
Definition u_pretty_print.h:102
Stack only pretty printer sink, no need to free, must be inited before use.
Definition u_pretty_print.h:290
char buffer[1024 *8]
Storage for the sink.
Definition u_pretty_print.h:295

Logs an xrt_result_t error with a formatted message.

◆ OPENVR_LOG_UNIMPLEMENTED

#define OPENVR_LOG_UNIMPLEMENTED (   logger,
  fmt,
  ... 
)
Value:
do { \
OPENVR_LOG_WARN(logger, "[UNIMPLEMENTED] " fmt __VA_OPT__(, ) __VA_ARGS__); \
} while (false)

Specialized macro for logging an unimplemented function.

◆ OPENVR_LOG_UNIMPLEMENTED_RET

#define OPENVR_LOG_UNIMPLEMENTED_RET (   logger,
  fmt,
  ret,
  ... 
)
Value:
do { \
OPENVR_LOG_UNIMPLEMENTED(logger, fmt __VA_OPT__(, ) __VA_ARGS__); \
return ret; \
} while (false)

Specialized macro for logging an unimplemented function and returning a value.