XRPrimer (C++ API)  0.6.0
logging.h
Go to the documentation of this file.
1 // Copyright (c) OpenXRLab. All rights reserved.
2 
3 #ifndef XR_LOGGINHT_H_
4 #define XR_LOGGINHT_H_
5 
6 enum XRLogLevel {
7  XR_LOG_DEBUG = -1,
8  XR_LOG_INFO = 0,
11  XR_LOG_ERR = 3,
15 };
16 
22 void log_message(XRLogLevel level, const char *format, ...);
23 
24 #define xr_log_emergency(...) log_message(XR_LOG_EMERG, __VA_ARGS__)
25 #define xr_log_alert(...) log_message(XR_LOG_ALERT, __VA_ARGS__)
26 #define xr_log_critical(...) log_message(XR_LOG_CRIT, __VA_ARGS__)
27 #define xr_log_error(...) log_message(XR_LOG_ERR, __VA_ARGS__)
28 #define xr_log_warning(...) log_message(XR_LOG_WARNING, __VA_ARGS__)
29 #define xr_log_notice(...) log_message(XR_LOG_NOTICE, __VA_ARGS__)
30 #define xr_log_info(...) log_message(XR_LOG_INFO, __VA_ARGS__)
31 #define xr_log_debug(...) log_message(XR_LOG_DEBUG, __VA_ARGS__)
32 
33 #define xr_runtime_assert(condition, message) \
34  do { \
35  if (!(condition)) { \
36  log_error("Assertion failed at " __FILE__ \
37  ":%d : %s\nWhen testing condition:\n %s", \
38  __LINE__, message, #condition); \
39  abort(); \
40  } \
41  } while (0)
42 
43 #endif // XR_LOGGINHT_H_
Definition: logging.h:12
void log_message(XRLogLevel level, const char *format,...)
Log message.
Definition: logging.cpp:26
Definition: logging.h:14
Definition: logging.h:11
Definition: logging.h:10
Definition: logging.h:9
Definition: logging.h:7
Definition: logging.h:8
Definition: logging.h:13
XRLogLevel
Definition: logging.h:6