libwebsockets
Lightweight C library for HTML5 websockets
lws-logs.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  lws_log_cx
 
union  lws_log_cx.u
 

Macros

#define LLL_ERR   (1 << 0)
 
#define LLL_WARN   (1 << 1)
 
#define LLL_NOTICE   (1 << 2)
 
#define LLL_INFO   (1 << 3)
 
#define LLL_DEBUG   (1 << 4)
 
#define LLL_PARSER   (1 << 5)
 
#define LLL_HEADER   (1 << 6)
 
#define LLL_EXT   (1 << 7)
 
#define LLL_CLIENT   (1 << 8)
 
#define LLL_LATENCY   (1 << 9)
 
#define LLL_USER   (1 << 10)
 
#define LLL_THREAD   (1 << 11)
 
#define LLL_COUNT   (12) /* set to count of valid flags */
 
#define LLLF_SECRECY_PII   (1 << 16)
 
#define LLLF_SECRECY_BEARER   (1 << 17)
 
#define LLLF_LOG_TIMESTAMP   (1 << 18)
 
#define LLLF_LOG_CONTEXT_AWARE   (1 << 30)
 
#define lwsl_cx(_c, _fil, ...)
 
#define lwsl_vhost(_v, _fil, ...)
 
#define lwsl_wsi(_w, _fil, ...)
 
#define lwsl_ss(_h, _fil, ...)
 
#define lwsl_hexdump_context(_c, _fil, _buf, _len)
 
#define lwsl_hexdump_vhost(_v, _fil, _buf, _len)
 
#define lwsl_hexdump_wsi(_w, _fil, _buf, _len)
 
#define lwsl_hexdump_ss(_h, _fil, _buf, _len)
 
#define _LWS_LINIT   (LLL_ERR | LLL_USER | LLL_WARN | LLL_NOTICE)
 
#define _LWS_LBS   0
 
#define _LWS_LBC   0
 
#define _LWS_ENABLED_LOGS   (((_LWS_LINIT) | (_LWS_LBS)) & ~(_LWS_LBC))
 
#define lwsl_err(...)   _lws_log(LLL_ERR, __VA_ARGS__)
 
#define lwsl_warn(...)   _lws_log(LLL_WARN, __VA_ARGS__)
 
#define lwsl_notice(...)   _lws_log(LLL_NOTICE, __VA_ARGS__)
 
#define lwsl_info(...)   do {} while(0)
 
#define lwsl_debug(...)   do {} while(0)
 
#define lwsl_parser(...)   do {} while(0)
 
#define lwsl_header(...)   do {} while(0)
 
#define lwsl_ext(...)   do {} while(0)
 
#define lwsl_client(...)   do {} while(0)
 
#define lwsl_latency(...)   do {} while(0)
 
#define lwsl_thread(...)   do {} while(0)
 
#define lwsl_user(...)   _lws_log(LLL_USER, __VA_ARGS__)
 
#define lwsl_hexdump_err(...)   lwsl_hexdump_level(LLL_ERR, __VA_ARGS__)
 
#define lwsl_hexdump_warn(...)   lwsl_hexdump_level(LLL_WARN, __VA_ARGS__)
 
#define lwsl_hexdump_notice(...)   lwsl_hexdump_level(LLL_NOTICE, __VA_ARGS__)
 
#define lwsl_hexdump_info(...)   lwsl_hexdump_level(LLL_INFO, __VA_ARGS__)
 
#define lwsl_hexdump_debug(...)   lwsl_hexdump_level(LLL_DEBUG, __VA_ARGS__)
 
#define lwsl_cx_err(_c, ...)   lwsl_cx(_c, LLL_ERR, __VA_ARGS__)
 
#define lwsl_cx_warn(_c, ...)   lwsl_cx(_c, LLL_WARN, __VA_ARGS__)
 
#define lwsl_cx_notice(_c, ...)   lwsl_cx(_c, LLL_NOTICE, __VA_ARGS__)
 
#define lwsl_cx_info(_c, ...)   do {} while(0)
 
#define lwsl_cx_debug(_c, ...)   do {} while(0)
 
#define lwsl_cx_parser(_c, ...)   do {} while(0)
 
#define lwsl_cx_header(_c, ...)   do {} while(0)
 
#define lwsl_cx_ext(_c, ...)   do {} while(0)
 
#define lwsl_cx_client(_c, ...)   do {} while(0)
 
#define lwsl_cx_latency(_c, ...)   do {} while(0)
 
#define lwsl_cx_thread(_c, ...)   do {} while(0)
 
#define lwsl_cx_user(_c, ...)   lwsl_cx(_c, LLL_USER, __VA_ARGS__)
 
#define lwsl_hexdump_cx_err(_c, ...)   lwsl_hexdump_context(_c, LLL_ERR, __VA_ARGS__)
 
#define lwsl_hexdump_cx_warn(_c, ...)   lwsl_hexdump_context(_c, LLL_WARN, __VA_ARGS__)
 
#define lwsl_hexdump_cx_notice(_c, ...)   lwsl_hexdump_context(_c, LLL_NOTICE, __VA_ARGS__)
 
#define lwsl_hexdump_cx_info(_c, ...)   lwsl_hexdump_context(_c, LLL_INFO, __VA_ARGS__)
 
#define lwsl_hexdump_cx_debug(_c, ...)   lwsl_hexdump_context(_c, LLL_DEBUG, __VA_ARGS__)
 
#define lwsl_vhost_err(_v, ...)   lwsl_vhost(_v, LLL_ERR, __VA_ARGS__)
 
#define lwsl_vhost_warn(_v, ...)   lwsl_vhost(_v, LLL_WARN, __VA_ARGS__)
 
#define lwsl_vhost_notice(_v, ...)   lwsl_vhost(_v, LLL_NOTICE, __VA_ARGS__)
 
#define lwsl_vhost_info(_v, ...)   do {} while(0)
 
#define lwsl_vhost_debug(_v, ...)   do {} while(0)
 
#define lwsl_vhost_parser(_v, ...)   do {} while(0)
 
#define lwsl_vhost_header(_v, ...)   do {} while(0)
 
#define lwsl_vhost_ext(_v, ...)   do {} while(0)
 
#define lwsl_vhost_client(_v, ...)   do {} while(0)
 
#define lwsl_vhost_latency(_v, ...)   do {} while(0)
 
#define lwsl_vhost_thread(_v, ...)   do {} while(0)
 
#define lwsl_vhost_user(_v, ...)   lwsl_vhost(_v, LLL_USER, __VA_ARGS__)
 
#define lwsl_hexdump_vhost_err(_v, ...)   lwsl_hexdump_vhost(_v, LLL_ERR, __VA_ARGS__)
 
#define lwsl_hexdump_vhost_warn(_v, ...)   lwsl_hexdump_vhost(_v, LLL_WARN, __VA_ARGS__)
 
#define lwsl_hexdump_vhost_notice(_v, ...)   lwsl_hexdump_vhost(_v, LLL_NOTICE, __VA_ARGS__)
 
#define lwsl_hexdump_vhost_info(_v, ...)   lwsl_hexdump_vhost(_v, LLL_INFO, __VA_ARGS__)
 
#define lwsl_hexdump_vhost_debug(_v, ...)   lwsl_hexdump_vhost(_v, LLL_DEBUG, __VA_ARGS__)
 
#define lwsl_wsi_err(_w, ...)   lwsl_wsi(_w, LLL_ERR, __VA_ARGS__)
 
#define lwsl_wsi_warn(_w, ...)   lwsl_wsi(_w, LLL_WARN, __VA_ARGS__)
 
#define lwsl_wsi_notice(_w, ...)   lwsl_wsi(_w, LLL_NOTICE, __VA_ARGS__)
 
#define lwsl_wsi_info(_w, ...)   do {} while(0)
 
#define lwsl_wsi_debug(_w, ...)   do {} while(0)
 
#define lwsl_wsi_parser(_w, ...)   do {} while(0)
 
#define lwsl_wsi_header(_w, ...)   do {} while(0)
 
#define lwsl_wsi_ext(_w, ...)   do {} while(0)
 
#define lwsl_wsi_client(_w, ...)   do {} while(0)
 
#define lwsl_wsi_latency(_w, ...)   do {} while(0)
 
#define lwsl_wsi_thread(_w, ...)   do {} while(0)
 
#define lwsl_wsi_user(_w, ...)   lwsl_wsi(_w, LLL_USER, __VA_ARGS__)
 
#define lwsl_hexdump_wsi_err(_v, ...)   lwsl_hexdump_wsi(_v, LLL_ERR, __VA_ARGS__)
 
#define lwsl_hexdump_wsi_warn(_v, ...)   lwsl_hexdump_wsi(_v, LLL_WARN, __VA_ARGS__)
 
#define lwsl_hexdump_wsi_notice(_v, ...)   lwsl_hexdump_wsi(_v, LLL_NOTICE, __VA_ARGS__)
 
#define lwsl_hexdump_wsi_info(_v, ...)   lwsl_hexdump_wsi(_v, LLL_INFO, __VA_ARGS__)
 
#define lwsl_hexdump_wsi_debug(_v, ...)   lwsl_hexdump_wsi(_v, LLL_DEBUG, __VA_ARGS__)
 
#define lwsl_ss_err(_w, ...)   lwsl_ss(_w, LLL_ERR, __VA_ARGS__)
 
#define lwsl_ss_warn(_w, ...)   lwsl_ss(_w, LLL_WARN, __VA_ARGS__)
 
#define lwsl_ss_notice(_w, ...)   lwsl_ss(_w, LLL_NOTICE, __VA_ARGS__)
 
#define lwsl_ss_info(_w, ...)   do {} while(0)
 
#define lwsl_ss_debug(_w, ...)   do {} while(0)
 
#define lwsl_ss_parser(_w, ...)   do {} while(0)
 
#define lwsl_ss_header(_w, ...)   do {} while(0)
 
#define lwsl_ss_ext(_w, ...)   do {} while(0)
 
#define lwsl_ss_client(_w, ...)   do {} while(0)
 
#define lwsl_ss_latency(_w, ...)   do {} while(0)
 
#define lwsl_ss_thread(_w, ...)   do {} while(0)
 
#define lwsl_ss_user(_w, ...)   lwsl_ss(_w, LLL_USER, __VA_ARGS__)
 
#define lwsl_hexdump_ss_err(_v, ...)   lwsl_hexdump_ss(_v, LLL_ERR, __VA_ARGS__)
 
#define lwsl_hexdump_ss_warn(_v, ...)   lwsl_hexdump_ss(_v, LLL_WARN, __VA_ARGS__)
 
#define lwsl_hexdump_ss_notice(_v, ...)   lwsl_hexdump_ss(_v, LLL_NOTICE, __VA_ARGS__)
 
#define lwsl_hexdump_ss_info(_v, ...)   lwsl_hexdump_ss(_v, LLL_INFO, __VA_ARGS__)
 
#define lwsl_hexdump_ss_debug(_v, ...)   lwsl_hexdump_ss(_v, LLL_DEBUG, __VA_ARGS__)
 

Typedefs

typedef void(* lws_log_emit_t) (int level, const char *line)
 
typedef void(* lws_log_emit_cx_t) (struct lws_log_cx *cx, int level, const char *line, size_t len)
 
typedef void(* lws_log_prepend_cx_t) (struct lws_log_cx *cx, void *obj, char **p, char *e)
 
typedef void(* lws_log_use_cx_t) (struct lws_log_cx *cx, int _new)
 
typedef struct lws_log_cx lws_log_cx_t
 

Functions

LWS_VISIBLE LWS_EXTERN int lwsl_timestamp (int level, char *p, size_t len)
 
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 struct lws_log_cxlwsl_context_get_cx (struct lws_context *cx)
 
LWS_VISIBLE LWS_EXTERN struct lws_log_cxlwsl_vhost_get_cx (struct lws_vhost *vh)
 
LWS_VISIBLE LWS_EXTERN struct lws_log_cxlwsl_wsi_get_cx (struct lws *wsi)
 
LWS_VISIBLE LWS_EXTERN void lws_log_emit_cx_file (struct lws_log_cx *cx, int level, const char *line, size_t len)
 
LWS_VISIBLE LWS_EXTERN void lws_log_use_cx_file (struct lws_log_cx *cx, int _new)
 
LWS_VISIBLE LWS_EXTERN void lws_log_prepend_context (struct lws_log_cx *cx, void *obj, char **p, char *e)
 
LWS_VISIBLE LWS_EXTERN void lws_log_prepend_vhost (struct lws_log_cx *cx, void *obj, char **p, char *e)
 
LWS_VISIBLE LWS_EXTERN void lws_log_prepend_wsi (struct lws_log_cx *cx, void *obj, char **p, char *e)
 
LWS_VISIBLE LWS_EXTERN void _lws_log_cx (lws_log_cx_t *cx, lws_log_prepend_cx_t prep, void *obj, int filter, const char *_fun, const char *format,...) LWS_FORMAT(6)
 
LWS_VISIBLE LWS_EXTERN void lwsl_hexdump_level (int level, const void *vbuf, size_t len)
 
LWS_VISIBLE LWS_EXTERN void lwsl_hexdump_level_cx (lws_log_cx_t *cx, lws_log_prepend_cx_t prep, void *obj, int hexdump_level, const void *vbuf, size_t len)
 
LWS_VISIBLE LWS_EXTERN void lwsl_hexdump (const void *buf, size_t len)
 
LWS_VISIBLE LWS_EXTERN void lws_set_log_level (int level, lws_log_emit_t log_emit_function)
 
LWS_VISIBLE LWS_EXTERN void lwsl_emit_syslog (int level, const char *line)
 
LWS_VISIBLE LWS_EXTERN void lwsl_emit_stderr (int level, const char *line)
 
LWS_VISIBLE LWS_EXTERN void lwsl_emit_stderr_notimestamp (int level, const char *line)
 
LWS_VISIBLE LWS_EXTERN int lwsl_visible (int level)
 
LWS_VISIBLE LWS_EXTERN const char * lws_wsi_tag (struct lws *wsi)
 
LWS_VISIBLE LWS_EXTERN void lwsl_refcount_cx (lws_log_cx_t *cx, int _new)