19 #ifndef _VMTOOLS_LOG_H_
20 #define _VMTOOLS_LOG_H_
136 #if !defined(G_LOG_DOMAIN)
137 # error "G_LOG_DOMAIN must be defined."
143 #if defined(__GNUC__)
144 # define FUNC __func__
146 # define FUNC __FUNCTION__
162 # define g_info(fmt, ...) g_log(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, fmt, ## __VA_ARGS__)
167 #define VMTOOLS_LOGGING_LEVEL_DEFAULT "info"
169 #define VMTOOLS_LOGGING_LEVEL_DEFAULT "message"
192 #if defined(_WIN32) && GLIB_CHECK_VERSION(2, 46, 0)
194 g_critical_inline(
const gchar *fmt,
199 g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, fmt, args);
216 #define vm_critical(fmt, ...) g_critical_inline("%s: " fmt, FUNC, ## __VA_ARGS__)
219 g_debug_inline(
const gchar *fmt,
224 g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, fmt, args);
229 #define vm_debug(fmt, ...) g_debug_inline("%s: " fmt, FUNC, ## __VA_ARGS__)
232 g_error_inline(
const gchar *fmt,
237 g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, fmt, args);
242 #define vm_error(fmt, ...) g_error_inline("%s: " fmt, FUNC, ## __VA_ARGS__)
246 g_info_inline(
const gchar *fmt,
251 g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, fmt, args);
256 #define vm_info(fmt, ...) g_info_inline("%s: " fmt, FUNC, ## __VA_ARGS__)
259 g_message_inline(
const gchar *fmt,
264 g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, fmt, args);
269 #define vm_message(fmt, ...) g_message_inline("%s: " fmt, FUNC, ## __VA_ARGS__)
272 g_warning_inline(
const gchar *fmt,
277 g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, fmt, args);
282 #define vm_warning(fmt, ...) g_warning_inline("%s: " fmt, FUNC, ## __VA_ARGS__)
299 #define vm_critical(fmt, ...) g_critical("%s: " fmt, FUNC, ## __VA_ARGS__)
302 #define vm_debug(fmt, ...) g_debug("%s: " fmt, FUNC, ## __VA_ARGS__)
305 #define vm_error(fmt, ...) g_error("%s: " fmt, FUNC, ## __VA_ARGS__)
308 #define vm_info(fmt, ...) g_info("%s: " fmt, FUNC, ## __VA_ARGS__)
311 #define vm_message(fmt, ...) g_message("%s: " fmt, FUNC, ## __VA_ARGS__)
314 #define vm_warning(fmt, ...) g_warning("%s: " fmt, FUNC, ## __VA_ARGS__)
318 #define VM_SAFE_STR(string) (string != NULL ? string : "(NULL)")
348 GLogLevelFlags level,
354 VMTools_VmxLog(RpcChannel *chan,
360 #define host_warning(fmt, ...) \
361 VMTools_Log(TO_HOST, G_LOG_LEVEL_WARNING, G_LOG_DOMAIN, fmt, ## __VA_ARGS__)
363 #define guest_warning(fmt, ...) \
364 VMTools_Log(IN_GUEST, G_LOG_LEVEL_WARNING, G_LOG_DOMAIN, fmt, ## __VA_ARGS__)
366 #define host_message(fmt, ...) \
367 VMTools_Log(TO_HOST, G_LOG_LEVEL_MESSAGE, G_LOG_DOMAIN, fmt, ## __VA_ARGS__)
369 #define guest_message(fmt, ...) \
370 VMTools_Log(IN_GUEST, G_LOG_LEVEL_MESSAGE, G_LOG_DOMAIN, fmt, ## __VA_ARGS__)
372 #define host_info(fmt, ...) \
373 VMTools_Log(TO_HOST, G_LOG_LEVEL_INFO, G_LOG_DOMAIN, fmt, ## __VA_ARGS__)
375 #define guest_info(fmt, ...) \
376 VMTools_Log(IN_GUEST, G_LOG_LEVEL_INFO, G_LOG_DOMAIN, fmt, ## __VA_ARGS__)
378 #define host_debug(fmt, ...) \
379 VMTools_Log(TO_HOST, G_LOG_LEVEL_DEBUG, G_LOG_DOMAIN, fmt, ## __VA_ARGS__)
381 #define guest_debug(fmt, ...) \
382 VMTools_Log(IN_GUEST, G_LOG_LEVEL_DEBUG, G_LOG_DOMAIN, fmt, ## __VA_ARGS__)