Lines Matching +full:- +full:- +full:log +full:- +full:level
12 or custom log emission is possible if you point it to your own.
14 Currently the following log levels are defined
17 |---|---|---|---|
31 The first four log levels are built into lws even on Release builds, the others
34 You can select between Debug and Release builds using cmake `-DCMAKE_BUILD_TYPE=`
38 see emitted, only log levels that were built in can be enabled since the code for them
41 ## Finegrained control of log level build
43 You can deviate from the default log inclusion for release / debug by overriding it
46 For example you can set `-DLWS_LOGGING_BITFIELD_SET="LLL_INFO|LLL_DEBUG"`, which will
47 cause those log level traces to be built in even in Release mode. Clear works
48 similarly to defeat build of specific log levels.
60 contain various information such as a 64-bit ordinal for the group the object belongs
69 At their simplest the tags look like this (in a log indicating creation)
78 The corresponding object destruction log with the tag is
81 [2020/12/27 08:49:24:4226] N: -- (3) 5.126s [wsi|5|h2]
96 the first log is describing a proxied SS client connection at the proxy, and the second
97 is a wsi bound to the SS object from the first log to do the outgoing client action.
105 |---|
113 "log context" object, one of these is embedded in the lws_context, lws_vhost,
119 before, and if you do not set custom log contexts, the new log apis use the
120 processwide log context emit and mask as before too.
124 |Traditional process scope logs|New log context apis|
125 |---|---|
126 |Single processwide log context|Defaults to processwide, but object can use custom log contexts|
127 |Single processwide emit function|Emit function per log context|
128 |Single processwide log mask|log mask is in log context, objects can be bound to custom log context…
132 |No hierarchy|Log contexts may refer to parent log contexts, which may prepend to child logs|
133 |Macros per level (eg, `lwsl_err(...)`)|Macros per object type / level (eg, `lwsl_wsi_err(wsi, ...)…
135 In addition to being able to control the emit function and log level for
136 individual log contexts, eg, for a particular wsi, the log functions understand
137 how to prepend object-specific information such as tags and `__func__`
140 making the log information more consistent.
142 So comparing this kind of logging the processwide and log context aware ways:
149 |---|---|
151 |New log context apis|`lwsl_wsi_notice(wsi, "mylog %d", n);`|
153 The log context / object-aware apis do not replace the processwide logging but
155 function and log mask, so the behaviours are the same. The original processwide
156 log apis themselves are unchanged.
159 defined log context which is inherited by objects created in that lws_context by
165 This table describes the different ways to issue an ERROR verbosity log, it
169 |---|---|---|
170 |Old, Processwide|lwsl_err(...)|Traditional processwide error log|
171 |lws_context|lwsl_cx_err(context, ...)|error log bound to lws_context|
172 |lws_vhost|lwsl_vhost_err(vh, ...)|error log bound to lws_vhost|
173 |lws_wsi|lwsl_wsi_err(wsi, ...)|error log bound to wsi|
174 |lws_ss|lwsl_ss_err(handle, ...)|error log bound to secure stream|
176 Similarly hexdumps can be bound to different log contexts
179 |---|---|---|
186 ## Creating and using custom log contexts
188 The log context object is public, in `libwebsockets/lws-logs.h`, currently it
192 typedef void (*lws_log_emit_t)(int level, const char *line);
193 typedef void (*lws_log_emit_cx_t)(struct lws_log_cx *cx, int level,
205 * this enables implementing side-effects like opening and closing
206 * log files when the first and last object binds / unbinds */
211 /**< NULL, or points to log ctx we are a child of */
217 /**< mask of log levels we want to emit in this context */
219 /**< refcount of objects bound to this log context */
224 functions are also implemented using the new log contexts internally. For
225 new log context-aware code, you would use `.u.emit_cx` and set the flag
232 |---|---|---|---|---|---|
233 |stderr|`.u.emit`|-|`lwsl_emit_stderr`|NULL|NULL|
236 For example, a custom log context that emits to a configurable file can be
245 .opaque = "/tmp/mylogpath.log" /* also settable at runtime */
249 To bind the lws_context to this log context, set `log_cx` in the context
256 ### Log context hierarchy
258 Log contexts may also point to a parent log context... the top level log context
259 defines the emit function to be used, but parent log contexts are consulted by
263 ### Log context prepend function
267 example the wsi-aware log context layer knows how to provide the wsi tag
273 ### Log context opaque member
278 ### Log context refcounting
280 An expected use for custom log contexts is emitting to a specific file, and
281 then binding one or more objects to that log context. Since it's too expensive
282 to keep opening and closing the output file per log, it means we need to know
286 For this reason the log contexts have a refcount, and an opaque `void *stg`
288 the output log file descriptor.