log.c   log.c 
skipping to change at line 29 skipping to change at line 29
* along with the SSH Library; see the file COPYING. If not, write to * along with the SSH Library; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA. * MA 02111-1307, USA.
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#include "libssh/priv.h" #include "libssh/priv.h"
#include "libssh/session.h"
/** /**
* @defgroup ssh_log SSH Logging * @defgroup ssh_log SSH Logging
* *
* @brief Logging functions for debugging and problem resolving * @brief Logging functions for debugging and problem resolving
*/ */
/** \addtogroup ssh_log /** \addtogroup ssh_log
* @{ */ * @{ */
/** /**
* @brief Log a SSH event. * @brief Log a SSH event.
* *
* @param session The SSH session. * @param session The SSH session.
* *
* @param verbosity The verbosity of the event. * @param verbosity The verbosity of the event.
* *
* @param format The format string of the log entry. * @param format The format string of the log entry.
*/ */
void ssh_log(SSH_SESSION *session, int verbosity, const char *format, ...) { void ssh_log(ssh_session session, int verbosity, const char *format, ...) {
char buffer[1024]; char buffer[1024];
char indent[256]; char indent[256];
int min; int min;
va_list va; va_list va;
if (verbosity <= session->log_verbosity) { if (verbosity <= session->log_verbosity) {
va_start(va, format); va_start(va, format);
vsnprintf(buffer, sizeof(buffer), format, va); vsnprintf(buffer, sizeof(buffer), format, va);
va_end(va); va_end(va);
if (session->options->log_function) { if (session->callbacks && session->callbacks->log_function) {
session->options->log_function(buffer, session, verbosity); session->callbacks->log_function(session, verbosity, buffer,
session->callbacks->userdata);
} else if (verbosity == SSH_LOG_FUNCTIONS) { } else if (verbosity == SSH_LOG_FUNCTIONS) {
if (session->log_indent > 255) { if (session->log_indent > 255) {
min = 255; min = 255;
} else { } else {
min = session->log_indent; min = session->log_indent;
} }
memset(indent, ' ', min); memset(indent, ' ', min);
indent[min] = '\0'; indent[min] = '\0';
 End of changes. 3 change blocks. 
3 lines changed or deleted 5 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/