19 #ifndef _VMTOOLS_LOG_H_ 20 #define _VMTOOLS_LOG_H_ 136 #if !defined(G_LOG_DOMAIN) 137 # error "G_LOG_DOMAIN must be defined." 142 #include "vm_basic_types.h" 144 #if defined(__GNUC__) 145 # define FUNC __func__ 147 # define FUNC __FUNCTION__ 163 # define g_info(fmt, ...) g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, fmt, ## __VA_ARGS__) 168 #define VMTOOLS_LOGGING_LEVEL_DEFAULT "info" 170 #define VMTOOLS_LOGGING_LEVEL_DEFAULT "message" 193 #if defined(_WIN32) && GLIB_CHECK_VERSION(2, 46, 0) 195 g_critical_inline(
const gchar *fmt,
200 g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, fmt, args);
217 #define vm_critical(fmt, ...) g_critical_inline("%s: " fmt, FUNC, ## __VA_ARGS__) 220 g_debug_inline(
const gchar *fmt,
225 g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, fmt, args);
230 #define vm_debug(fmt, ...) g_debug_inline("%s: " fmt, FUNC, ## __VA_ARGS__) 233 g_error_inline(
const gchar *fmt,
238 g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, fmt, args);
243 #define vm_error(fmt, ...) g_error_inline("%s: " fmt, FUNC, ## __VA_ARGS__) 247 g_info_inline(
const gchar *fmt,
252 g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, fmt, args);
257 #define vm_info(fmt, ...) g_info_inline("%s: " fmt, FUNC, ## __VA_ARGS__) 260 g_message_inline(
const gchar *fmt,
265 g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, fmt, args);
270 #define vm_message(fmt, ...) g_message_inline("%s: " fmt, FUNC, ## __VA_ARGS__) 273 g_warning_inline(
const gchar *fmt,
278 g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, fmt, args);
283 #define vm_warning(fmt, ...) g_warning_inline("%s: " fmt, FUNC, ## __VA_ARGS__) 285 #else // ! (windows & glib >= 2.46) 300 #define vm_critical(fmt, ...) g_critical("%s: " fmt, FUNC, ## __VA_ARGS__) 303 #define vm_debug(fmt, ...) g_debug("%s: " fmt, FUNC, ## __VA_ARGS__) 306 #define vm_error(fmt, ...) g_error("%s: " fmt, FUNC, ## __VA_ARGS__) 309 #define vm_info(fmt, ...) g_info("%s: " fmt, FUNC, ## __VA_ARGS__) 312 #define vm_message(fmt, ...) g_message("%s: " fmt, FUNC, ## __VA_ARGS__) 315 #define vm_warning(fmt, ...) g_warning("%s: " fmt, FUNC, ## __VA_ARGS__) 316 #endif // ! (windows & glib >= 2.46) 319 #define VM_SAFE_STR(string) (string != NULL ? string : "(NULL)") 349 GLogLevelFlags level,
355 VMTools_VmxLog(RpcChannel *chan,
360 VMTools_VmxLogThrottled(uint32 *count,
367 #define host_warning(fmt, ...) \ 368 VMTools_Log(TO_HOST, G_LOG_LEVEL_WARNING, G_LOG_DOMAIN, fmt, ## __VA_ARGS__) 370 #define guest_warning(fmt, ...) \ 371 VMTools_Log(IN_GUEST, G_LOG_LEVEL_WARNING, G_LOG_DOMAIN, fmt, ## __VA_ARGS__) 373 #define host_message(fmt, ...) \ 374 VMTools_Log(TO_HOST, G_LOG_LEVEL_MESSAGE, G_LOG_DOMAIN, fmt, ## __VA_ARGS__) 376 #define guest_message(fmt, ...) \ 377 VMTools_Log(IN_GUEST, G_LOG_LEVEL_MESSAGE, G_LOG_DOMAIN, fmt, ## __VA_ARGS__) 379 #define host_info(fmt, ...) \ 380 VMTools_Log(TO_HOST, G_LOG_LEVEL_INFO, G_LOG_DOMAIN, fmt, ## __VA_ARGS__) 382 #define guest_info(fmt, ...) \ 383 VMTools_Log(IN_GUEST, G_LOG_LEVEL_INFO, G_LOG_DOMAIN, fmt, ## __VA_ARGS__) 385 #define host_debug(fmt, ...) \ 386 VMTools_Log(TO_HOST, G_LOG_LEVEL_DEBUG, G_LOG_DOMAIN, fmt, ## __VA_ARGS__) 388 #define guest_debug(fmt, ...) \ 389 VMTools_Log(IN_GUEST, G_LOG_LEVEL_DEBUG, G_LOG_DOMAIN, fmt, ## __VA_ARGS__)