mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 18:50:28 +09:00
doc: Document public functions.
This commit is contained in:
32
src/log.c
32
src/log.c
@@ -168,39 +168,63 @@ void ssh_log_common(struct ssh_common_struct *common,
|
|||||||
|
|
||||||
/* PUBLIC */
|
/* PUBLIC */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the log level of the library.
|
||||||
|
*
|
||||||
|
* @param[in] level The level to set.
|
||||||
|
*
|
||||||
|
* @return SSH_OK on success, SSH_ERROR on error.
|
||||||
|
*/
|
||||||
int ssh_set_log_level(int level) {
|
int ssh_set_log_level(int level) {
|
||||||
if (level < 0) {
|
if (level < 0) {
|
||||||
return -1;
|
return SSH_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssh_log_level = level;
|
ssh_log_level = level;
|
||||||
|
|
||||||
return 0;
|
return SSH_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the log level of the library.
|
||||||
|
*
|
||||||
|
* @return The value of the log level.
|
||||||
|
*/
|
||||||
int ssh_get_log_level(void) {
|
int ssh_get_log_level(void) {
|
||||||
return ssh_log_level;
|
return ssh_log_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ssh_set_log_callback(ssh_logging_callback cb) {
|
int ssh_set_log_callback(ssh_logging_callback cb) {
|
||||||
if (cb == NULL) {
|
if (cb == NULL) {
|
||||||
return -1;
|
return SSH_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssh_log_cb = cb;
|
ssh_log_cb = cb;
|
||||||
|
|
||||||
return 0;
|
return SSH_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssh_logging_callback ssh_get_log_callback(void) {
|
ssh_logging_callback ssh_get_log_callback(void) {
|
||||||
return ssh_log_cb;
|
return ssh_log_cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the userdata of the logging function.
|
||||||
|
*
|
||||||
|
* @return The userdata if set or NULL.
|
||||||
|
*/
|
||||||
void *ssh_get_log_userdata(void)
|
void *ssh_get_log_userdata(void)
|
||||||
{
|
{
|
||||||
return ssh_log_userdata;
|
return ssh_log_userdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the userdata for the logging function.
|
||||||
|
*
|
||||||
|
* @param[in] data The userdata to set.
|
||||||
|
*
|
||||||
|
* @return SSH_OK on success.
|
||||||
|
*/
|
||||||
int ssh_set_log_userdata(void *data)
|
int ssh_set_log_userdata(void *data)
|
||||||
{
|
{
|
||||||
ssh_log_userdata = data;
|
ssh_log_userdata = data;
|
||||||
|
|||||||
Reference in New Issue
Block a user