libwebsockets
Lightweight C library for HTML5 websockets
Logging

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)
 

Detailed Description

Logging

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.

Traditional logs use a single, processwide logging context. New style log apis (lws_xxx_cx()) can pass the logging context to use in.


Data Structure Documentation

◆ lws_log_cx

struct lws_log_cx

Definition at line 80 of file lws-logs.h.

+ Collaboration diagram for lws_log_cx:
Data Fields
union lws_log_cx u
lws_log_use_cx_t refcount_cb

NULL, or a function called after each change to .refcount below, this enables implementing side-effects like opening and closing log files when the first and last object binds / unbinds

lws_log_prepend_cx_t prepend

NULL, or a cb to optionally prepend a string to logs we are a parent of

struct lws_log_cx * parent

NULL, or points to log ctx we are a child of

void * opaque

ignored by lws, used to pass config to emit_cx, eg, filepath

void * stg

ignored by lws, may be used a storage by refcount_cb / emit_cx

uint32_t lll_flags

mask of log levels we want to emit in this context

int32_t refcount

refcount of objects bound to this log context

◆ lws_log_cx.u

union lws_log_cx.u

Definition at line 81 of file lws-logs.h.

+ Collaboration diagram for lws_log_cx.u:
Data Fields
lws_log_emit_t emit
lws_log_emit_cx_t emit_cx

Macro Definition Documentation

◆ LLL_ERR

#define LLL_ERR   (1 << 0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 40 of file lws-logs.h.

◆ LLL_WARN

#define LLL_WARN   (1 << 1)

#include <include/libwebsockets/lws-logs.h>

Definition at line 41 of file lws-logs.h.

◆ LLL_NOTICE

#define LLL_NOTICE   (1 << 2)

#include <include/libwebsockets/lws-logs.h>

Definition at line 42 of file lws-logs.h.

◆ LLL_INFO

#define LLL_INFO   (1 << 3)

#include <include/libwebsockets/lws-logs.h>

Definition at line 43 of file lws-logs.h.

◆ LLL_DEBUG

#define LLL_DEBUG   (1 << 4)

#include <include/libwebsockets/lws-logs.h>

Definition at line 44 of file lws-logs.h.

◆ LLL_PARSER

#define LLL_PARSER   (1 << 5)

#include <include/libwebsockets/lws-logs.h>

Definition at line 45 of file lws-logs.h.

◆ LLL_HEADER

#define LLL_HEADER   (1 << 6)

#include <include/libwebsockets/lws-logs.h>

Definition at line 46 of file lws-logs.h.

◆ LLL_EXT

#define LLL_EXT   (1 << 7)

#include <include/libwebsockets/lws-logs.h>

Definition at line 47 of file lws-logs.h.

◆ LLL_CLIENT

#define LLL_CLIENT   (1 << 8)

#include <include/libwebsockets/lws-logs.h>

Definition at line 48 of file lws-logs.h.

◆ LLL_LATENCY

#define LLL_LATENCY   (1 << 9)

#include <include/libwebsockets/lws-logs.h>

Definition at line 49 of file lws-logs.h.

◆ LLL_USER

#define LLL_USER   (1 << 10)

#include <include/libwebsockets/lws-logs.h>

Definition at line 50 of file lws-logs.h.

◆ LLL_THREAD

#define LLL_THREAD   (1 << 11)

#include <include/libwebsockets/lws-logs.h>

Definition at line 51 of file lws-logs.h.

◆ LLL_COUNT

#define LLL_COUNT   (12) /* set to count of valid flags */

#include <include/libwebsockets/lws-logs.h>

Definition at line 53 of file lws-logs.h.

◆ LLLF_SECRECY_PII

#define LLLF_SECRECY_PII   (1 << 16)

#include <include/libwebsockets/lws-logs.h>

contains Personally Identifiable Information

Definition at line 56 of file lws-logs.h.

◆ LLLF_SECRECY_BEARER

#define LLLF_SECRECY_BEARER   (1 << 17)

#include <include/libwebsockets/lws-logs.h>

possession of this data allows impersonation

Definition at line 58 of file lws-logs.h.

◆ LLLF_LOG_TIMESTAMP

#define LLLF_LOG_TIMESTAMP   (1 << 18)

#include <include/libwebsockets/lws-logs.h>

set to prepend logs with timestamp

Definition at line 61 of file lws-logs.h.

◆ LLLF_LOG_CONTEXT_AWARE

#define LLLF_LOG_CONTEXT_AWARE   (1 << 30)

#include <include/libwebsockets/lws-logs.h>

set if the context uses an emit function that takes the logctx, auto- applied when setting emit using lws_set_log_level_cx() api

Definition at line 65 of file lws-logs.h.

◆ lwsl_cx

#define lwsl_cx (   _c,
  _fil,
  ... 
)

#include <include/libwebsockets/lws-logs.h>

Value:
_c, _fil, __func__, __VA_ARGS__)
LWS_VISIBLE LWS_EXTERN struct lws_log_cx * lwsl_context_get_cx(struct lws_context *cx)
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 lws_log_prepend_context(struct lws_log_cx *cx, void *obj, char **p, char *e)

Definition at line 180 of file lws-logs.h.

◆ lwsl_vhost

#define lwsl_vhost (   _v,
  _fil,
  ... 
)

#include <include/libwebsockets/lws-logs.h>

Value:
_fil, __func__, __VA_ARGS__)
LWS_VISIBLE LWS_EXTERN struct lws_log_cx * lwsl_vhost_get_cx(struct lws_vhost *vh)
LWS_VISIBLE LWS_EXTERN void lws_log_prepend_vhost(struct lws_log_cx *cx, void *obj, char **p, char *e)

Definition at line 183 of file lws-logs.h.

◆ lwsl_wsi

#define lwsl_wsi (   _w,
  _fil,
  ... 
)

#include <include/libwebsockets/lws-logs.h>

Value:
_fil, __func__, __VA_ARGS__)
LWS_VISIBLE LWS_EXTERN struct lws_log_cx * lwsl_wsi_get_cx(struct lws *wsi)
LWS_VISIBLE LWS_EXTERN void lws_log_prepend_wsi(struct lws_log_cx *cx, void *obj, char **p, char *e)

Definition at line 186 of file lws-logs.h.

◆ lwsl_ss

#define lwsl_ss (   _h,
  _fil,
  ... 
)

#include <include/libwebsockets/lws-logs.h>

Value:
_lws_log_cx(lwsl_ss_get_cx(_h), lws_log_prepend_ss, _h, \
_fil, __func__, __VA_ARGS__)

Definition at line 189 of file lws-logs.h.

◆ lwsl_hexdump_context

#define lwsl_hexdump_context (   _c,
  _fil,
  _buf,
  _len 
)

#include <include/libwebsockets/lws-logs.h>

Value:
_c, _fil, _buf, _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)

Definition at line 193 of file lws-logs.h.

◆ lwsl_hexdump_vhost

#define lwsl_hexdump_vhost (   _v,
  _fil,
  _buf,
  _len 
)

#include <include/libwebsockets/lws-logs.h>

Value:

Definition at line 197 of file lws-logs.h.

◆ lwsl_hexdump_wsi

#define lwsl_hexdump_wsi (   _w,
  _fil,
  _buf,
  _len 
)

#include <include/libwebsockets/lws-logs.h>

Value:

Definition at line 201 of file lws-logs.h.

◆ lwsl_hexdump_ss

#define lwsl_hexdump_ss (   _h,
  _fil,
  _buf,
  _len 
)

#include <include/libwebsockets/lws-logs.h>

Value:
lwsl_hexdump_level_cx(lwsl_ss_get_cx(_h), \
lws_log_prepend_ss, \
_h, _fil, _buf, _len)

Definition at line 205 of file lws-logs.h.

◆ _LWS_LINIT

#define _LWS_LINIT   (LLL_ERR | LLL_USER | LLL_WARN | LLL_NOTICE)

#include <include/libwebsockets/lws-logs.h>

Definition at line 227 of file lws-logs.h.

◆ _LWS_LBS

#define _LWS_LBS   0

#include <include/libwebsockets/lws-logs.h>

Definition at line 243 of file lws-logs.h.

◆ _LWS_LBC

#define _LWS_LBC   0

#include <include/libwebsockets/lws-logs.h>

Definition at line 249 of file lws-logs.h.

◆ _LWS_ENABLED_LOGS

#define _LWS_ENABLED_LOGS   (((_LWS_LINIT) | (_LWS_LBS)) & ~(_LWS_LBC))

#include <include/libwebsockets/lws-logs.h>

Definition at line 255 of file lws-logs.h.

◆ lwsl_err

#define lwsl_err (   ...)    _lws_log(LLL_ERR, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 267 of file lws-logs.h.

◆ lwsl_warn

#define lwsl_warn (   ...)    _lws_log(LLL_WARN, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 273 of file lws-logs.h.

◆ lwsl_notice

#define lwsl_notice (   ...)    _lws_log(LLL_NOTICE, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 279 of file lws-logs.h.

◆ lwsl_info

#define lwsl_info (   ...)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 287 of file lws-logs.h.

◆ lwsl_debug

#define lwsl_debug (   ...)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 293 of file lws-logs.h.

◆ lwsl_parser

#define lwsl_parser (   ...)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 299 of file lws-logs.h.

◆ lwsl_header

#define lwsl_header (   ...)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 305 of file lws-logs.h.

◆ lwsl_ext

#define lwsl_ext (   ...)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 311 of file lws-logs.h.

◆ lwsl_client

#define lwsl_client (   ...)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 317 of file lws-logs.h.

◆ lwsl_latency

#define lwsl_latency (   ...)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 323 of file lws-logs.h.

◆ lwsl_thread

#define lwsl_thread (   ...)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 329 of file lws-logs.h.

◆ lwsl_user

#define lwsl_user (   ...)    _lws_log(LLL_USER, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 333 of file lws-logs.h.

◆ lwsl_hexdump_err

#define lwsl_hexdump_err (   ...)    lwsl_hexdump_level(LLL_ERR, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 338 of file lws-logs.h.

◆ lwsl_hexdump_warn

#define lwsl_hexdump_warn (   ...)    lwsl_hexdump_level(LLL_WARN, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 339 of file lws-logs.h.

◆ lwsl_hexdump_notice

#define lwsl_hexdump_notice (   ...)    lwsl_hexdump_level(LLL_NOTICE, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 340 of file lws-logs.h.

◆ lwsl_hexdump_info

#define lwsl_hexdump_info (   ...)    lwsl_hexdump_level(LLL_INFO, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 341 of file lws-logs.h.

◆ lwsl_hexdump_debug

#define lwsl_hexdump_debug (   ...)    lwsl_hexdump_level(LLL_DEBUG, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 342 of file lws-logs.h.

◆ lwsl_cx_err

#define lwsl_cx_err (   _c,
  ... 
)    lwsl_cx(_c, LLL_ERR, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 349 of file lws-logs.h.

◆ lwsl_cx_warn

#define lwsl_cx_warn (   _c,
  ... 
)    lwsl_cx(_c, LLL_WARN, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 355 of file lws-logs.h.

◆ lwsl_cx_notice

#define lwsl_cx_notice (   _c,
  ... 
)    lwsl_cx(_c, LLL_NOTICE, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 361 of file lws-logs.h.

◆ lwsl_cx_info

#define lwsl_cx_info (   _c,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 369 of file lws-logs.h.

◆ lwsl_cx_debug

#define lwsl_cx_debug (   _c,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 375 of file lws-logs.h.

◆ lwsl_cx_parser

#define lwsl_cx_parser (   _c,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 381 of file lws-logs.h.

◆ lwsl_cx_header

#define lwsl_cx_header (   _c,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 387 of file lws-logs.h.

◆ lwsl_cx_ext

#define lwsl_cx_ext (   _c,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 393 of file lws-logs.h.

◆ lwsl_cx_client

#define lwsl_cx_client (   _c,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 399 of file lws-logs.h.

◆ lwsl_cx_latency

#define lwsl_cx_latency (   _c,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 405 of file lws-logs.h.

◆ lwsl_cx_thread

#define lwsl_cx_thread (   _c,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 411 of file lws-logs.h.

◆ lwsl_cx_user

#define lwsl_cx_user (   _c,
  ... 
)    lwsl_cx(_c, LLL_USER, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 415 of file lws-logs.h.

◆ lwsl_hexdump_cx_err

#define lwsl_hexdump_cx_err (   _c,
  ... 
)    lwsl_hexdump_context(_c, LLL_ERR, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 420 of file lws-logs.h.

◆ lwsl_hexdump_cx_warn

#define lwsl_hexdump_cx_warn (   _c,
  ... 
)    lwsl_hexdump_context(_c, LLL_WARN, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 421 of file lws-logs.h.

◆ lwsl_hexdump_cx_notice

#define lwsl_hexdump_cx_notice (   _c,
  ... 
)    lwsl_hexdump_context(_c, LLL_NOTICE, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 422 of file lws-logs.h.

◆ lwsl_hexdump_cx_info

#define lwsl_hexdump_cx_info (   _c,
  ... 
)    lwsl_hexdump_context(_c, LLL_INFO, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 423 of file lws-logs.h.

◆ lwsl_hexdump_cx_debug

#define lwsl_hexdump_cx_debug (   _c,
  ... 
)    lwsl_hexdump_context(_c, LLL_DEBUG, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 424 of file lws-logs.h.

◆ lwsl_vhost_err

#define lwsl_vhost_err (   _v,
  ... 
)    lwsl_vhost(_v, LLL_ERR, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 431 of file lws-logs.h.

◆ lwsl_vhost_warn

#define lwsl_vhost_warn (   _v,
  ... 
)    lwsl_vhost(_v, LLL_WARN, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 437 of file lws-logs.h.

◆ lwsl_vhost_notice

#define lwsl_vhost_notice (   _v,
  ... 
)    lwsl_vhost(_v, LLL_NOTICE, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 443 of file lws-logs.h.

◆ lwsl_vhost_info

#define lwsl_vhost_info (   _v,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 451 of file lws-logs.h.

◆ lwsl_vhost_debug

#define lwsl_vhost_debug (   _v,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 457 of file lws-logs.h.

◆ lwsl_vhost_parser

#define lwsl_vhost_parser (   _v,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 463 of file lws-logs.h.

◆ lwsl_vhost_header

#define lwsl_vhost_header (   _v,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 469 of file lws-logs.h.

◆ lwsl_vhost_ext

#define lwsl_vhost_ext (   _v,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 475 of file lws-logs.h.

◆ lwsl_vhost_client

#define lwsl_vhost_client (   _v,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 481 of file lws-logs.h.

◆ lwsl_vhost_latency

#define lwsl_vhost_latency (   _v,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 487 of file lws-logs.h.

◆ lwsl_vhost_thread

#define lwsl_vhost_thread (   _v,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 493 of file lws-logs.h.

◆ lwsl_vhost_user

#define lwsl_vhost_user (   _v,
  ... 
)    lwsl_vhost(_v, LLL_USER, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 497 of file lws-logs.h.

◆ lwsl_hexdump_vhost_err

#define lwsl_hexdump_vhost_err (   _v,
  ... 
)    lwsl_hexdump_vhost(_v, LLL_ERR, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 502 of file lws-logs.h.

◆ lwsl_hexdump_vhost_warn

#define lwsl_hexdump_vhost_warn (   _v,
  ... 
)    lwsl_hexdump_vhost(_v, LLL_WARN, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 503 of file lws-logs.h.

◆ lwsl_hexdump_vhost_notice

#define lwsl_hexdump_vhost_notice (   _v,
  ... 
)    lwsl_hexdump_vhost(_v, LLL_NOTICE, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 504 of file lws-logs.h.

◆ lwsl_hexdump_vhost_info

#define lwsl_hexdump_vhost_info (   _v,
  ... 
)    lwsl_hexdump_vhost(_v, LLL_INFO, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 505 of file lws-logs.h.

◆ lwsl_hexdump_vhost_debug

#define lwsl_hexdump_vhost_debug (   _v,
  ... 
)    lwsl_hexdump_vhost(_v, LLL_DEBUG, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 506 of file lws-logs.h.

◆ lwsl_wsi_err

#define lwsl_wsi_err (   _w,
  ... 
)    lwsl_wsi(_w, LLL_ERR, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 514 of file lws-logs.h.

◆ lwsl_wsi_warn

#define lwsl_wsi_warn (   _w,
  ... 
)    lwsl_wsi(_w, LLL_WARN, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 520 of file lws-logs.h.

◆ lwsl_wsi_notice

#define lwsl_wsi_notice (   _w,
  ... 
)    lwsl_wsi(_w, LLL_NOTICE, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 526 of file lws-logs.h.

◆ lwsl_wsi_info

#define lwsl_wsi_info (   _w,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 534 of file lws-logs.h.

◆ lwsl_wsi_debug

#define lwsl_wsi_debug (   _w,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 540 of file lws-logs.h.

◆ lwsl_wsi_parser

#define lwsl_wsi_parser (   _w,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 546 of file lws-logs.h.

◆ lwsl_wsi_header

#define lwsl_wsi_header (   _w,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 552 of file lws-logs.h.

◆ lwsl_wsi_ext

#define lwsl_wsi_ext (   _w,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 558 of file lws-logs.h.

◆ lwsl_wsi_client

#define lwsl_wsi_client (   _w,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 564 of file lws-logs.h.

◆ lwsl_wsi_latency

#define lwsl_wsi_latency (   _w,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 570 of file lws-logs.h.

◆ lwsl_wsi_thread

#define lwsl_wsi_thread (   _w,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 576 of file lws-logs.h.

◆ lwsl_wsi_user

#define lwsl_wsi_user (   _w,
  ... 
)    lwsl_wsi(_w, LLL_USER, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 580 of file lws-logs.h.

◆ lwsl_hexdump_wsi_err

#define lwsl_hexdump_wsi_err (   _v,
  ... 
)    lwsl_hexdump_wsi(_v, LLL_ERR, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 585 of file lws-logs.h.

◆ lwsl_hexdump_wsi_warn

#define lwsl_hexdump_wsi_warn (   _v,
  ... 
)    lwsl_hexdump_wsi(_v, LLL_WARN, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 586 of file lws-logs.h.

◆ lwsl_hexdump_wsi_notice

#define lwsl_hexdump_wsi_notice (   _v,
  ... 
)    lwsl_hexdump_wsi(_v, LLL_NOTICE, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 587 of file lws-logs.h.

◆ lwsl_hexdump_wsi_info

#define lwsl_hexdump_wsi_info (   _v,
  ... 
)    lwsl_hexdump_wsi(_v, LLL_INFO, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 588 of file lws-logs.h.

◆ lwsl_hexdump_wsi_debug

#define lwsl_hexdump_wsi_debug (   _v,
  ... 
)    lwsl_hexdump_wsi(_v, LLL_DEBUG, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 589 of file lws-logs.h.

◆ lwsl_ss_err

#define lwsl_ss_err (   _w,
  ... 
)    lwsl_ss(_w, LLL_ERR, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 597 of file lws-logs.h.

◆ lwsl_ss_warn

#define lwsl_ss_warn (   _w,
  ... 
)    lwsl_ss(_w, LLL_WARN, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 603 of file lws-logs.h.

◆ lwsl_ss_notice

#define lwsl_ss_notice (   _w,
  ... 
)    lwsl_ss(_w, LLL_NOTICE, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 609 of file lws-logs.h.

◆ lwsl_ss_info

#define lwsl_ss_info (   _w,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 617 of file lws-logs.h.

◆ lwsl_ss_debug

#define lwsl_ss_debug (   _w,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 623 of file lws-logs.h.

◆ lwsl_ss_parser

#define lwsl_ss_parser (   _w,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 629 of file lws-logs.h.

◆ lwsl_ss_header

#define lwsl_ss_header (   _w,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 635 of file lws-logs.h.

◆ lwsl_ss_ext

#define lwsl_ss_ext (   _w,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 641 of file lws-logs.h.

◆ lwsl_ss_client

#define lwsl_ss_client (   _w,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 647 of file lws-logs.h.

◆ lwsl_ss_latency

#define lwsl_ss_latency (   _w,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 653 of file lws-logs.h.

◆ lwsl_ss_thread

#define lwsl_ss_thread (   _w,
  ... 
)    do {} while(0)

#include <include/libwebsockets/lws-logs.h>

Definition at line 659 of file lws-logs.h.

◆ lwsl_ss_user

#define lwsl_ss_user (   _w,
  ... 
)    lwsl_ss(_w, LLL_USER, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 663 of file lws-logs.h.

◆ lwsl_hexdump_ss_err

#define lwsl_hexdump_ss_err (   _v,
  ... 
)    lwsl_hexdump_ss(_v, LLL_ERR, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 668 of file lws-logs.h.

◆ lwsl_hexdump_ss_warn

#define lwsl_hexdump_ss_warn (   _v,
  ... 
)    lwsl_hexdump_ss(_v, LLL_WARN, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 669 of file lws-logs.h.

◆ lwsl_hexdump_ss_notice

#define lwsl_hexdump_ss_notice (   _v,
  ... 
)    lwsl_hexdump_ss(_v, LLL_NOTICE, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 670 of file lws-logs.h.

◆ lwsl_hexdump_ss_info

#define lwsl_hexdump_ss_info (   _v,
  ... 
)    lwsl_hexdump_ss(_v, LLL_INFO, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 671 of file lws-logs.h.

◆ lwsl_hexdump_ss_debug

#define lwsl_hexdump_ss_debug (   _v,
  ... 
)    lwsl_hexdump_ss(_v, LLL_DEBUG, __VA_ARGS__)

#include <include/libwebsockets/lws-logs.h>

Definition at line 672 of file lws-logs.h.

Typedef Documentation

◆ lws_log_emit_t

typedef void(* lws_log_emit_t) (int level, const char *line)

#include <include/libwebsockets/lws-logs.h>

Definition at line 69 of file lws-logs.h.

◆ lws_log_emit_cx_t

typedef void(* lws_log_emit_cx_t) (struct lws_log_cx *cx, int level, const char *line, size_t len)

#include <include/libwebsockets/lws-logs.h>

Definition at line 70 of file lws-logs.h.

◆ lws_log_prepend_cx_t

typedef void(* lws_log_prepend_cx_t) (struct lws_log_cx *cx, void *obj, char **p, char *e)

#include <include/libwebsockets/lws-logs.h>

Definition at line 72 of file lws-logs.h.

◆ lws_log_use_cx_t

typedef void(* lws_log_use_cx_t) (struct lws_log_cx *cx, int _new)

#include <include/libwebsockets/lws-logs.h>

Definition at line 74 of file lws-logs.h.

◆ lws_log_cx_t

Function Documentation

◆ lwsl_timestamp()

LWS_VISIBLE LWS_EXTERN int lwsl_timestamp ( int  level,
char *  p,
size_t  len 
)

#include <include/libwebsockets/lws-logs.h>

lwsl_timestamp: generate logging timestamp string

Parameters
levellogging level
pchar * buffer to take timestamp
lenlength of p

returns length written in p

◆ _lws_log()

LWS_VISIBLE LWS_EXTERN void _lws_log ( int  filter,
const char *  format,
  ... 
)

◆ _lws_logv()

LWS_VISIBLE LWS_EXTERN void _lws_logv ( int  filter,
const char *  format,
va_list  vl 
)

◆ lwsl_context_get_cx()

LWS_VISIBLE LWS_EXTERN struct lws_log_cx* lwsl_context_get_cx ( struct lws_context *  cx)

◆ lwsl_vhost_get_cx()

LWS_VISIBLE LWS_EXTERN struct lws_log_cx* lwsl_vhost_get_cx ( struct lws_vhost *  vh)

◆ lwsl_wsi_get_cx()

LWS_VISIBLE LWS_EXTERN struct lws_log_cx* lwsl_wsi_get_cx ( struct lws *  wsi)

◆ lws_log_emit_cx_file()

LWS_VISIBLE LWS_EXTERN void lws_log_emit_cx_file ( struct lws_log_cx cx,
int  level,
const char *  line,
size_t  len 
)

◆ lws_log_use_cx_file()

LWS_VISIBLE LWS_EXTERN void lws_log_use_cx_file ( struct lws_log_cx cx,
int  _new 
)

◆ lws_log_prepend_context()

LWS_VISIBLE LWS_EXTERN void lws_log_prepend_context ( struct lws_log_cx cx,
void *  obj,
char **  p,
char *  e 
)

◆ lws_log_prepend_vhost()

LWS_VISIBLE LWS_EXTERN void lws_log_prepend_vhost ( struct lws_log_cx cx,
void *  obj,
char **  p,
char *  e 
)

◆ lws_log_prepend_wsi()

LWS_VISIBLE LWS_EXTERN void lws_log_prepend_wsi ( struct lws_log_cx cx,
void *  obj,
char **  p,
char *  e 
)

◆ _lws_log_cx()

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,
  ... 
)

◆ lwsl_hexdump_level()

LWS_VISIBLE LWS_EXTERN void lwsl_hexdump_level ( int  level,
const void *  vbuf,
size_t  len 
)

#include <include/libwebsockets/lws-logs.h>

lwsl_hexdump_level() - helper to hexdump a buffer at a selected debug level

Parameters
levelone of LLL_ constants
vbufbuffer start to dump
lenlength of buffer to dump

If level is visible, does a nice hexdump -C style dump of vbuf for len bytes. This can be extremely convenient while debugging.

◆ lwsl_hexdump_level_cx()

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 
)

◆ lwsl_hexdump()

LWS_VISIBLE LWS_EXTERN void lwsl_hexdump ( const void *  buf,
size_t  len 
)

#include <include/libwebsockets/lws-logs.h>

lwsl_hexdump() - helper to hexdump a buffer (DEBUG builds only)

Parameters
bufbuffer start to dump
lenlength of buffer to dump

Calls through to lwsl_hexdump_level(LLL_DEBUG, ... for compatability. It's better to use lwsl_hexdump_level(level, ... directly so you can control the visibility.

◆ lws_set_log_level()

LWS_VISIBLE LWS_EXTERN void lws_set_log_level ( int  level,
lws_log_emit_t  log_emit_function 
)

#include <include/libwebsockets/lws-logs.h>

lws_set_log_level() - Set the logging bitfield

Parameters
levelOR together the LLL_ debug contexts you want output from
log_emit_functionNULL 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. If stderr is a tty (according to isatty()) then the output is coloured according to the log level using ANSI escapes.

You can set the default security level for logging using the secrecy_and_log_level() macro to set the level parameter, eg

lws_set_log_level(secrecy_and_log_level(LWS_SECRECY_PII, LLL_ERR | LLL_WARN), my_emit_function);

Normally you can just leave it at the default.

◆ lwsl_emit_syslog()

LWS_VISIBLE LWS_EXTERN void lwsl_emit_syslog ( int  level,
const char *  line 
)

#include <include/libwebsockets/lws-logs.h>

lwsl_emit_syslog() - helper log emit function writes to system log

Parameters
levelone of LLL_ log level indexes
linelog 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.

◆ lwsl_emit_stderr()

LWS_VISIBLE LWS_EXTERN void lwsl_emit_stderr ( int  level,
const char *  line 
)

#include <include/libwebsockets/lws-logs.h>

lwsl_emit_stderr() - helper log emit function writes to stderr

Parameters
levelone of LLL_ log level indexes
linelog 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.

It prepends a system timestamp like [2018/11/13 07:41:57:3989]

If stderr is a tty, then ansi colour codes are added.

◆ lwsl_emit_stderr_notimestamp()

LWS_VISIBLE LWS_EXTERN void lwsl_emit_stderr_notimestamp ( int  level,
const char *  line 
)

#include <include/libwebsockets/lws-logs.h>

lwsl_emit_stderr_notimestamp() - helper log emit function writes to stderr

Parameters
levelone of LLL_ log level indexes
linelog 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.

If stderr is a tty, then ansi colour codes are added.

◆ lwsl_visible()

LWS_VISIBLE LWS_EXTERN int lwsl_visible ( int  level)

#include <include/libwebsockets/lws-logs.h>

lwsl_visible() - returns true if the log level should be printed

Parameters
levelone of LLL_ log level indexes

This is useful if you have to do work to generate the log content, you can skip the work if the log level used to print it is not actually enabled at runtime.

◆ lws_wsi_tag()

LWS_VISIBLE LWS_EXTERN const char* lws_wsi_tag ( struct lws *  wsi)

◆ lwsl_refcount_cx()

LWS_VISIBLE LWS_EXTERN void lwsl_refcount_cx ( lws_log_cx_t cx,
int  _new 
)