wslog: Add function to log directly without filtering

Used to write custom logging functions.
This commit is contained in:
João Valverde 2021-07-29 19:42:26 +01:00
parent 7b845e7194
commit 0693674494
4 changed files with 27 additions and 1 deletions

View File

@ -356,6 +356,7 @@ libwsutil.so.0 libwsutil0 #MINVER#
ws_log_set_fatal_str@Base 3.5.0
ws_log_set_level@Base 3.5.0
ws_log_set_level_str@Base 3.5.0
ws_log_write_always_full@Base 3.5.0
ws_logv@Base 3.5.0
ws_logv_full@Base 3.5.0
ws_mempbrk_compile@Base 1.99.4

View File

@ -27,7 +27,7 @@ debug_dump(const char *file, int line, const char* func,
if (!ws_log_msg_is_active(WS_LOG_DOMAIN, level))
return;
char* tmp_str = bytes_to_str(NULL, y, (z));
ws_log_full(WS_LOG_DOMAIN, level, file, line, func, "%s: %s", x, tmp_str);
ws_log_write_always_full(WS_LOG_DOMAIN, level, file, line, func, "%s: %s", x, tmp_str);
wmem_free(NULL, tmp_str);
}

View File

@ -896,6 +896,18 @@ void ws_log_full(const char *domain, enum ws_log_level level,
}
void ws_log_write_always_full(const char *domain, enum ws_log_level level,
const char *file, int line, const char *func,
const char *format, ...)
{
va_list ap;
va_start(ap, format);
log_write_dispatch(domain, level, file, line, func, format, ap);
va_end(ap);
}
void ws_log_default_writer(const char *domain, enum ws_log_level level,
ws_log_time_t timestamp,
const char *file, int line, const char *func,

View File

@ -296,6 +296,19 @@ void ws_logv_full(const char *domain, enum ws_log_level level,
#define ws_noisy(...) _LOG_DEBUG(LOG_LEVEL_NOISY, __VA_ARGS__)
/** Auxiliary function to write custom logging functions.
*
* This function is the same as ws_log_full() but does not perform any
* domain/level filtering to avoid a useless double activation check.
* It should only be used in conjunction with a pre-check using
* ws_log_msg_is_active().
*/
WS_DLL_PUBLIC
void ws_log_write_always_full(const char *domain, enum ws_log_level level,
const char *file, int line, const char *func,
const char *format, ...) G_GNUC_PRINTF(6,7);
/** Define an auxiliary file pointer where messages should be written.
*
* This file, if set, functions in addition to the registered or