qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/4] QGA VSS: Add wrapper to send log to debugger and stderr


From: Konstantin Kostiuk
Subject: [PATCH 1/4] QGA VSS: Add wrapper to send log to debugger and stderr
Date: Wed, 5 Jul 2023 17:12:02 +0300

Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
---
 qga/vss-win32/vss-debug.h | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 qga/vss-win32/vss-debug.h

diff --git a/qga/vss-win32/vss-debug.h b/qga/vss-win32/vss-debug.h
new file mode 100644
index 0000000000..c0bdf7a3fc
--- /dev/null
+++ b/qga/vss-win32/vss-debug.h
@@ -0,0 +1,31 @@
+/*
+ * QEMU Guest Agent VSS debug declarations
+ *
+ * Copyright (C) 2023 Red Hat Inc
+ *
+ * Authors:
+ *  Konstantin Kostiuk <kkostiuk@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <vss-handles.h>
+
+#ifndef VSS_DEBUG_H
+#define VSS_DEBUG_H
+
+#define PRINT_DEBUG(fmt, ...) {                                               \
+    char user_sting[512] = { 0 };                                             \
+    char full_string[640] = { 0 };                                            \
+    snprintf(user_sting, 512, fmt, ## __VA_ARGS__);                           \
+    snprintf(full_string, 640, QGA_PROVIDER_NAME"[%lu]: %s %s\n",             \
+        GetCurrentThreadId(), __func__, user_sting);                          \
+    OutputDebugString(full_string);                                           \
+    fprintf(stderr, "%s", full_string);                                       \
+}
+
+#define PRINT_DEBUG_BEGIN PRINT_DEBUG("begin")
+#define PRINT_DEBUG_END PRINT_DEBUG("end")
+
+#endif
-- 
2.34.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]