log: add ssh_vlog to save the stack space

and add LOG_SIZE macro to control the buffer size

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Change-Id: I3eaeea001fc531fdb55074fc3a9d140b27847c1f
This commit is contained in:
Xiang Xiao
2021-05-10 19:27:31 +08:00
committed by Jakub Jelen
parent 672c1f8a3a
commit 14276f0b51
4 changed files with 39 additions and 20 deletions

View File

@@ -369,13 +369,11 @@ public:
return state;
}
void log(int priority, const char *format, ...){
char buffer[1024];
va_list va;
va_start(va, format);
vsnprintf(buffer, sizeof(buffer), format, va);
ssh_vlog(priority, "libsshpp", format, &va);
va_end(va);
_ssh_log(priority, "libsshpp", "%s", buffer);
}
/** @brief copies options from a session to another