Add va_list variants of the guac_log_* functions
This commit is contained in:
parent
97a63fae3e
commit
220035746b
@ -50,10 +50,22 @@
|
||||
* log to syslog for platforms supporting it, and stderr for
|
||||
* all others.
|
||||
*
|
||||
* @param str A printf-style format string to log.
|
||||
* @param format A printf-style format string to log.
|
||||
* @param ... Arguments to use when filling the format string for printing.
|
||||
*/
|
||||
void guac_log_info(const char* str, ...);
|
||||
void guac_log_info(const char* format, ...);
|
||||
|
||||
/**
|
||||
* Logs an informational message in the system log, whatever
|
||||
* that may be for the system being used. This will currently
|
||||
* log to syslog for platforms supporting it, and stderr for
|
||||
* all others.
|
||||
*
|
||||
* @param format A printf-style format string to log.
|
||||
* @param ap The va_list containing the arguments to be used when filling the
|
||||
* format string for printing.
|
||||
*/
|
||||
void vguac_log_info(const char* format, va_list ap);
|
||||
|
||||
/**
|
||||
* Logs an error message in the system log, whatever
|
||||
@ -61,9 +73,21 @@ void guac_log_info(const char* str, ...);
|
||||
* log to syslog for platforms supporting it, and stderr for
|
||||
* all others.
|
||||
*
|
||||
* @param str A printf-style format string to log.
|
||||
* @param format A printf-style format string to log.
|
||||
* @param ... Arguments to use when filling the format string for printing.
|
||||
*/
|
||||
void guac_log_error(const char* str, ...);
|
||||
void guac_log_error(const char* format, ...);
|
||||
|
||||
/**
|
||||
* Logs an error message in the system log, whatever
|
||||
* that may be for the system being used. This will currently
|
||||
* log to syslog for platforms supporting it, and stderr for
|
||||
* all others.
|
||||
*
|
||||
* @param format A printf-style format string to log.
|
||||
* @param ap The va_list containing the arguments to be used when filling the
|
||||
* format string for printing.
|
||||
*/
|
||||
void vguac_log_error(const char* format, va_list ap);
|
||||
|
||||
#endif
|
||||
|
@ -45,35 +45,43 @@
|
||||
|
||||
#include "log.h"
|
||||
|
||||
void guac_log_info(const char* str, ...) {
|
||||
|
||||
va_list args;
|
||||
va_start(args, str);
|
||||
|
||||
void vguac_log_info(const char* format, va_list ap) {
|
||||
#ifdef HAVE_SYSLOG_H
|
||||
vsyslog(LOG_ERR, str, args);
|
||||
vsyslog(LOG_ERR, format, ap);
|
||||
#else
|
||||
fprintf(stderr, "guacamole: info: ");
|
||||
vfprintf(stderr, str, args);
|
||||
vfprintf(stderr, format, ap);
|
||||
fprintf(stderr, "\n");
|
||||
#endif
|
||||
|
||||
va_end(args);
|
||||
|
||||
}
|
||||
|
||||
void guac_log_error(const char* str, ...) {
|
||||
|
||||
va_list args;
|
||||
va_start(args, str);
|
||||
|
||||
void vguac_log_error(const char* format, va_list ap) {
|
||||
#ifdef HAVE_SYSLOG_H
|
||||
vsyslog(LOG_INFO, str, args);
|
||||
vsyslog(LOG_INFO, format, ap);
|
||||
#else
|
||||
fprintf(stderr, "guacamole: error: ");
|
||||
vfprintf(stderr, str, args);
|
||||
vfprintf(stderr, format, ap);
|
||||
fprintf(stderr, "\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
void guac_log_info(const char* format, ...) {
|
||||
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
|
||||
vguac_log_info(format, args);
|
||||
|
||||
va_end(args);
|
||||
|
||||
}
|
||||
|
||||
void guac_log_error(const char* format, ...) {
|
||||
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
|
||||
vguac_log_error(format, args);
|
||||
|
||||
va_end(args);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user