From 5b5d949fab8e9f55b5cc87bbbd64c11c9ba4cc8e Mon Sep 17 00:00:00 2001 From: James Muehlner Date: Fri, 26 Jan 2024 22:41:45 +0000 Subject: [PATCH] Fix logging. --- src/protocols/vnc/log.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/protocols/vnc/log.c b/src/protocols/vnc/log.c index ba593e81d0..6d3f85ac94 100644 --- a/src/protocols/vnc/log.c +++ b/src/protocols/vnc/log.c @@ -34,7 +34,15 @@ #include #include #include + +/* + * Syslog does not exist on Windows, so we'll just log directly to std error. + * TODO: ReportEvent() might be sort of equivalent? Look into + * https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-reporteventa + */ +#ifndef WINDOWS_BUILD #include +#endif void guac_vnc_client_log_info(const char* format, ...) { @@ -46,8 +54,12 @@ void guac_vnc_client_log_info(const char* format, ...) { vsnprintf(message, sizeof(message), format, args); va_end(args); +#ifndef WINDOWS_BUILD /* Log to syslog */ syslog(LOG_INFO, "%s", message); +#else + fprintf(stderr, "INFO: %s\n", message); +#endif } @@ -61,8 +73,12 @@ void guac_vnc_client_log_error(const char* format, ...) { vsnprintf(message, sizeof(message), format, args); va_end(args); +#ifndef WINDOWS_BUILD /* Log to syslog */ syslog(LOG_ERR, "%s", message); +#else + fprintf(stderr, "ERROR: %s\n", message); +#endif }