void _ssh_log(int verbosity, const char *function, const char *format, ...) { char buffer[1024]; va_list va; if (verbosity <= ssh_get_log_level()) { va_start(va, format); vsnprintf(buffer, sizeof(buffer), format, va); va_end(va); ssh_log_function(verbosity, function, buffer); } }
void _ssh_log2(ssh_session_t * session, int verbosity, const char *format, ...) { char buffer[1024]; va_list va; if (verbosity <= session->common.log_verbosity) { va_start(va, format); vsnprintf(buffer, sizeof(buffer), format, va); va_end(va); ssh_log_function(verbosity, "", buffer); } }
/** @internal * @brief log a SSH event with a common pointer * @param common The SSH/bind session. * @param verbosity The verbosity of the event. * @param format The format string of the log entry. */ void ssh_log_common(struct ssh_common_struct *common, int verbosity, const char *function, const char *format, ...) { char buffer[1024]; va_list va; if (verbosity <= common->log_verbosity) { va_start(va, format); vsnprintf(buffer, sizeof(buffer), format, va); va_end(va); ssh_log_function(verbosity, function, buffer); } }
void _ssh_pki_log(const char *function, const char *format, ...) { #ifdef DEBUG_CRYPTO char buffer[1024]; va_list va; va_start(va, format); vsnprintf(buffer, sizeof(buffer), format, va); va_end(va); ssh_log_function(SSH_LOG_DEBUG, function, buffer); #else (void) function; (void) format; #endif return; }
static void do_ssh_log(struct ssh_common_struct *common, int verbosity, const char *function, const char *buffer) { if (common->callbacks && common->callbacks->log_function) { char buf[1024]; snprintf(buf, sizeof(buf), "%s: %s", function, buffer); common->callbacks->log_function((ssh_session)common, verbosity, buf, common->callbacks->userdata); return; } ssh_log_function(verbosity, function, buffer); }