20 #ifndef _VMTOOLS_LOG_H_ 21 #define _VMTOOLS_LOG_H_ 132 #if !defined(G_LOG_DOMAIN) 133 # error "G_LOG_DOMAIN must be defined." 138 #include "vm_basic_types.h" 140 #if defined(__GNUC__) 141 # define FUNC __func__ 143 # define FUNC __FUNCTION__ 159 # define g_info(fmt, ...) g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, fmt, ## __VA_ARGS__) 164 #define VMTOOLS_LOGGING_LEVEL_DEFAULT "info" 166 #define VMTOOLS_LOGGING_LEVEL_DEFAULT "message" 189 #if defined(_WIN32) && GLIB_CHECK_VERSION(2, 46, 0) 191 g_critical_inline(
const gchar *fmt,
196 g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, fmt, args);
213 #define vm_critical(fmt, ...) g_critical_inline("%s: " fmt, FUNC, ## __VA_ARGS__) 216 g_debug_inline(
const gchar *fmt,
221 g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, fmt, args);
226 #define vm_debug(fmt, ...) g_debug_inline("%s: " fmt, FUNC, ## __VA_ARGS__) 229 g_error_inline(
const gchar *fmt,
234 g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, fmt, args);
239 #define vm_error(fmt, ...) g_error_inline("%s: " fmt, FUNC, ## __VA_ARGS__) 243 g_info_inline(
const gchar *fmt,
248 g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, fmt, args);
253 #define vm_info(fmt, ...) g_info_inline("%s: " fmt, FUNC, ## __VA_ARGS__) 256 g_message_inline(
const gchar *fmt,
261 g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, fmt, args);
266 #define vm_message(fmt, ...) g_message_inline("%s: " fmt, FUNC, ## __VA_ARGS__) 269 g_warning_inline(
const gchar *fmt,
274 g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, fmt, args);
279 #define vm_warning(fmt, ...) g_warning_inline("%s: " fmt, FUNC, ## __VA_ARGS__) 281 #else // ! (windows & glib >= 2.46) 296 #define vm_critical(fmt, ...) g_critical("%s: " fmt, FUNC, ## __VA_ARGS__) 299 #define vm_debug(fmt, ...) g_debug("%s: " fmt, FUNC, ## __VA_ARGS__) 302 #define vm_error(fmt, ...) g_error("%s: " fmt, FUNC, ## __VA_ARGS__) 305 #define vm_info(fmt, ...) g_info("%s: " fmt, FUNC, ## __VA_ARGS__) 308 #define vm_message(fmt, ...) g_message("%s: " fmt, FUNC, ## __VA_ARGS__) 311 #define vm_warning(fmt, ...) g_warning("%s: " fmt, FUNC, ## __VA_ARGS__) 312 #endif // ! (windows & glib >= 2.46) 315 #define VM_SAFE_STR(string) (string != NULL ? string : "(NULL)") 345 GLogLevelFlags level,
351 VMTools_VmxLog(RpcChannel *chan,
356 VMTools_VmxLogThrottled(uint32 *count,
362 VMTools_LogThrottled(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__)