![]() |
libwebsockets
Lightweight C library for HTML5 websockets
|
Functions | |
LWS_VISIBLE LWS_EXTERN void | _lws_log (int filter, const char *format,...) LWS_FORMAT(2) |
LWS_VISIBLE LWS_EXTERN void | _lws_logv (int filter, const char *format, va_list vl) |
LWS_VISIBLE LWS_EXTERN int | lwsl_timestamp (int level, char *p, int len) |
LWS_VISIBLE LWS_EXTERN void | lwsl_hexdump (void *buf, size_t len) |
LWS_VISIBLE LWS_EXTERN void | lws_set_log_level (int level, void(*log_emit_function)(int level, const char *line)) |
LWS_VISIBLE LWS_EXTERN void | lwsl_emit_syslog (int level, const char *line) |
Lws provides flexible and filterable logging facilities, which can be used inside lws and in user code.
Log categories may be individually filtered bitwise, and directed to built-in sinks for syslog-compatible logging, or a user-defined function.
LWS_VISIBLE LWS_EXTERN void lws_set_log_level | ( | int | level, |
void(*)(int level, const char *line) | log_emit_function | ||
) |
#include <lib/libwebsockets.h>
lws_set_log_level() - Set the logging bitfield
level | OR together the LLL_ debug contexts you want output from |
log_emit_function | NULL to leave it as it is, or a user-supplied function to perform log string emission instead of the default stderr one. |
log level defaults to "err", "warn" and "notice" contexts enabled and emission on stderr.
LWS_VISIBLE LWS_EXTERN void lwsl_emit_syslog | ( | int | level, |
const char * | line | ||
) |
#include <lib/libwebsockets.h>
lwsl_emit_syslog() - helper log emit function writes to system log
level | one of LLL_ log level indexes |
line | log string |
You use this by passing the function pointer to lws_set_log_level(), to set it as the log emit function, it is not called directly.
LWS_VISIBLE LWS_EXTERN void lwsl_hexdump | ( | void * | buf, |
size_t | len | ||
) |
#include <lib/libwebsockets.h>
lwsl_hexdump() - helper to hexdump a buffer (DEBUG builds only)
buf | buffer start to dump |
len | length of buffer to dump |
LWS_VISIBLE LWS_EXTERN int lwsl_timestamp | ( | int | level, |
char * | p, | ||
int | len | ||
) |
#include <lib/libwebsockets.h>
lwsl_timestamp: generate logging timestamp string
level | logging level |
p | char * buffer to take timestamp |
len | length of p |
returns length written in p