The SSH logging functions.

Overview

Logging functions for debugging and problem resolving. Moreā€¦

// enums

enum {
    @0::SSH_LOG_NOLOG     =0,
    @0::SSH_LOG_WARNING,
    @0::SSH_LOG_PROTOCOL,
    @0::SSH_LOG_PACKET,
    @0::SSH_LOG_FUNCTIONS,
};

// global functions

LIBSSH_API int
ssh_set_log_callback(ssh_logging_callback cb);

LIBSSH_API ssh_logging_callback
ssh_get_log_callback(void);

int
ssh_get_log_level(void);

void*
ssh_get_log_userdata(void);

int
ssh_set_log_level(int level);

int
ssh_set_log_userdata(void* data);

void
_ssh_log(
    int verbosity,
    const char* function,
    const char* format,
    ...
);

static
int
current_timestring(
    int hires,
    char* buf,
    size_t len
);

void
ssh_log(
    ssh_session session,
    int verbosity,
    const char* format,
    ...
);

void
ssh_log_common(
    struct ssh_common_struct* common,
    int verbosity,
    const char* function,
    const char* format,
    ...
);

void
ssh_log_function(
    int verbosity,
    const char* function,
    const char* buffer
);

static
void
ssh_log_stderr(
    int verbosity,
    const char* function,
    const char* buffer
);

Detailed Documentation

Logging functions for debugging and problem resolving.

Enum Values

SSH_LOG_NOLOG

No logging at all.

SSH_LOG_WARNING

Only warnings.

SSH_LOG_PROTOCOL

High level protocol information.

SSH_LOG_PACKET

Lower level protocol infomations, packet level.

SSH_LOG_FUNCTIONS

Every function path.

Global Functions

LIBSSH_API int
ssh_set_log_callback(ssh_logging_callback cb)

Set the logging callback function.

Parameters:

cb

The callback to set.

Returns:

0 on success, < 0 on errror.

LIBSSH_API ssh_logging_callback
ssh_get_log_callback(void)

Get the pointer to the logging callback function.

Returns:

The pointer the the callback or NULL if none set.

int
ssh_get_log_level(void)

Get the log level of the library.

Returns:

The value of the log level.

void*
ssh_get_log_userdata(void)

Get the userdata of the logging function.

Returns:

The userdata if set or NULL.

int
ssh_set_log_level(int level)

Set the log level of the library.

Parameters:

level

The level to set.

Returns:

SSH_OK on success, SSH_ERROR on error.

int
ssh_set_log_userdata(void* data)

Set the userdata for the logging function.

Parameters:

data

The userdata to set.

Returns:

SSH_OK on success.