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

logs: make tag lifecycle optional default on

The elaborated tags for ls owsi, vh, and ss objects are very useful
signposts to understand what's happening in the logs.  But for busy
h1 servers, they're just a lot of noise.

This lets you stop the logging of tagged object lifecycle by cmake
-DLWS_LOG_TAG_LIFECYCLE=0
This commit is contained in:
Andy Green 2021-02-01 10:45:23 +00:00
parent 0e6df74409
commit 0d588b292c
3 changed files with 6 additions and 0 deletions

View file

@ -245,6 +245,7 @@ option(LWS_WITH_NO_LOGS "Disable all logging other than _err and _user from bein
set(LWS_LOGGING_BITFIELD_SET 0 CACHE STRING "Bitfield describing which log levels to force included into the build")
set(LWS_LOGGING_BITFIELD_CLEAR 0 CACHE STRING "Bitfield describing which log levels to force removed from the build")
option(LWS_LOGS_TIMESTAMP "Timestamp at start of logs" ON)
option(LWS_LOG_TAG_LIFECYCLE "Log tagged object lifecycle as NOTICE" ON)
option(LWS_AVOID_SIGPIPE_IGN "Android 7+ reportedly needs this" OFF)
option(LWS_WITH_STATS "Keep statistics of lws internal operations" OFF)
option(LWS_WITH_JOSE "JSON Web Signature / Encryption / Keys (RFC7515/6/) API" OFF)

View file

@ -95,6 +95,7 @@
#cmakedefine LWS_LIBRARY_VERSION "${LWS_LIBRARY_VERSION}"
#define LWS_LOGGING_BITFIELD_CLEAR ${LWS_LOGGING_BITFIELD_CLEAR}
#define LWS_LOGGING_BITFIELD_SET ${LWS_LOGGING_BITFIELD_SET}
#cmakedefine LWS_LOG_TAG_LIFECYCLE
#cmakedefine LWS_MINGW_SUPPORT
#cmakedefine LWS_NO_CLIENT
#cmakedefine LWS_NO_DAEMONIZE

View file

@ -82,7 +82,9 @@ __lws_lc_tag(lws_lifecycle_group_t *grp, lws_lifecycle_t *lc,
lc->us_creation = (uint64_t)lws_now_usecs();
lws_dll2_add_tail(&lc->list, &grp->owner);
#if defined(LWS_LOG_TAG_LIFECYCLE)
lwsl_notice(" ++ %s (%d)\n", lc->gutag, (int)grp->owner.count);
#endif
}
/*
@ -139,7 +141,9 @@ __lws_lc_untag(lws_lifecycle_t *lc)
lws_humanize(buf, sizeof(buf), (uint64_t)lws_now_usecs() - lc->us_creation,
humanize_schema_us);
#if defined(LWS_LOG_TAG_LIFECYCLE)
lwsl_notice(" -- %s (%d) %s\n", lc->gutag, (int)lc->list.owner->count - 1, buf);
#endif
lws_dll2_remove(&lc->list);
}