1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

tags: prefix tags with pid if SS_PROXY_API

Make the logs a bit easier to understand when dealing with tagged objects,
when multiple client processes active, including at the proxy
This commit is contained in:
Andy Green 2021-01-01 15:14:01 +00:00
parent 0ceba15d9c
commit b5d656058f

View file

@ -53,12 +53,18 @@ __lws_lc_tag(lws_lifecycle_group_t *grp, lws_lifecycle_t *lc,
const char *format, ...)
{
va_list ap;
int n;
int n = 1;
assert(grp->tag_prefix); /* lc group must have a tag prefix string */
n = lws_snprintf(lc->gutag, sizeof(lc->gutag) - 1u, "[%s|%lx|",
grp->tag_prefix, (unsigned long)grp->ordinal++);
lc->gutag[0] = '[';
#if defined(LWS_WITH_SECURE_STREAMS_PROXY_API) /* ie, will have getpid if set */
n += lws_snprintf(&lc->gutag[n], sizeof(lc->gutag) - (unsigned int)n - 1u,
"%u|", getpid());
#endif
n += lws_snprintf(&lc->gutag[n], sizeof(lc->gutag) - (unsigned int)n - 1u,
"%s|%lx|", grp->tag_prefix, (unsigned long)grp->ordinal++);
va_start(ap, format);
n += vsnprintf(&lc->gutag[n], sizeof(lc->gutag) - (unsigned int)n -