Add libssh2_trace_sethandler() to the API (even more)
This commit is contained in:

committed by
Daniel Stenberg

parent
474e38119b
commit
44eba0c993
21
src/misc.c
21
src/misc.c
@@ -312,6 +312,13 @@ libssh2_trace(LIBSSH2_SESSION * session, int bitmask)
|
||||
return 0;
|
||||
}
|
||||
|
||||
LIBSSH2_API int
|
||||
libssh2_trace_sethandler(LIBSSH2_SESSION *session, libssh2_trace_handler_func callback)
|
||||
{
|
||||
session->tracehandler = callback;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
_libssh2_debug(LIBSSH2_SESSION * session, int context, const char *format, ...)
|
||||
{
|
||||
@@ -353,8 +360,12 @@ _libssh2_debug(LIBSSH2_SESSION * session, int context, const char *format, ...)
|
||||
len += vsnprintf(buffer + len, 1535 - len, format, vargs);
|
||||
buffer[len] = '\n';
|
||||
va_end(vargs);
|
||||
write(2, buffer, len + 1);
|
||||
|
||||
if (session->tracehandler) {
|
||||
(session->tracehandler)(session, buffer, len + 1);
|
||||
} else {
|
||||
write(2, buffer, len + 1);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -365,6 +376,14 @@ libssh2_trace(LIBSSH2_SESSION * session, int bitmask)
|
||||
(void) bitmask;
|
||||
return 0;
|
||||
}
|
||||
|
||||
LIBSSH2_API int
|
||||
libssh2_trace_sethandler(LIBSSH2_SESSION *session, libssh2_trace_handler_func callback)
|
||||
{
|
||||
(void) session;
|
||||
(void) callback;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* init the list head */
|
||||
|
Reference in New Issue
Block a user