mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
logs: prioritize WITH_NO_LOGS even in release
Really not having any logs makes it difficult to know what is really happening, but if that's you're thing this will align debug and release modes to just have ERR and USER if you give WITH_NO_LOGS
This commit is contained in:
parent
ad5047a687
commit
1000a52df3
9 changed files with 26 additions and 10 deletions
|
@ -82,7 +82,11 @@ LWS_VISIBLE LWS_EXTERN void _lws_logv(int filter, const char *format, va_list vl
|
|||
#define _LWS_LINIT ((1 << LLL_COUNT) - 1)
|
||||
#endif
|
||||
#else /* not _DEBUG */
|
||||
#if defined(LWS_WITH_NO_LOGS)
|
||||
#define _LWS_LINIT (LLL_ERR | LLL_USER)
|
||||
#else
|
||||
#define _LWS_LINIT (LLL_ERR | LLL_USER | LLL_WARN | LLL_NOTICE)
|
||||
#endif
|
||||
#endif /* _DEBUG */
|
||||
|
||||
/*
|
||||
|
|
|
@ -490,7 +490,7 @@ lws_dsh_get_head(lws_dsh_t *dsh, int kind, void **obj, size_t *size)
|
|||
return 0; /* we returned the head */
|
||||
}
|
||||
|
||||
#if defined(_DEBUG)
|
||||
#if defined(_DEBUG) && !defined(LWS_WITH_NO_LOGS)
|
||||
|
||||
static int
|
||||
describe_kind(struct lws_dll2 *d, void *user)
|
||||
|
|
|
@ -387,7 +387,7 @@ lws_create_context(const struct lws_context_creation_info *info)
|
|||
unsigned int lpf = info->fd_limit_per_thread;
|
||||
#if defined(LWS_WITH_EVLIB_PLUGINS) && defined(LWS_WITH_EVENT_LIBS)
|
||||
struct lws_plugin *evlib_plugin_list = NULL;
|
||||
#if defined(_DEBUG)
|
||||
#if defined(_DEBUG) && !defined(LWS_WITH_NO_LOGS)
|
||||
char *ld_env;
|
||||
#endif
|
||||
#endif
|
||||
|
@ -461,7 +461,7 @@ lws_create_context(const struct lws_context_creation_info *info)
|
|||
* the context object, so we can overallocate it correctly
|
||||
*/
|
||||
|
||||
#if defined(_DEBUG)
|
||||
#if defined(_DEBUG) && !defined(LWS_WITH_NO_LOGS)
|
||||
ld_env = getenv("LD_LIBRARY_PATH");
|
||||
lwsl_info("%s: ev lib path %s, '%s'\n", __func__,
|
||||
LWS_INSTALL_LIBDIR, ld_env);
|
||||
|
@ -1461,7 +1461,9 @@ lws_system_cpd_start_defer(struct lws_context *cx, lws_usec_t defer_us)
|
|||
lws_system_deferred_cb, defer_us);
|
||||
}
|
||||
|
||||
#if (defined(LWS_WITH_SYS_STATE) && defined(LWS_WITH_SYS_SMD)) || !defined(LWS_WITH_NO_LOGS)
|
||||
static const char *cname[] = { "Unknown", "OK", "Captive", "No internet" };
|
||||
#endif
|
||||
|
||||
void
|
||||
lws_system_cpd_set(struct lws_context *cx, lws_cpd_result_t result)
|
||||
|
@ -1469,7 +1471,9 @@ lws_system_cpd_set(struct lws_context *cx, lws_cpd_result_t result)
|
|||
if (cx->captive_portal_detect != LWS_CPD_UNKNOWN)
|
||||
return;
|
||||
|
||||
#if !defined(LWS_WITH_NO_LOGS)
|
||||
lwsl_notice("%s: setting CPD result %s\n", __func__, cname[result]);
|
||||
#endif
|
||||
|
||||
cx->captive_portal_detect = (uint8_t)result;
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ static void (*lwsl_emit)(int level, const char *line)
|
|||
= lwsl_emit_optee;
|
||||
#endif
|
||||
;
|
||||
#ifndef LWS_PLAT_OPTEE
|
||||
#if !defined(LWS_PLAT_OPTEE) && !defined(LWS_WITH_NO_LOGS)
|
||||
static const char * log_level_names ="EWNIDPHXCLUT??";
|
||||
#endif
|
||||
|
||||
|
@ -195,7 +195,7 @@ lws_lc_tag(lws_lifecycle_t *lc)
|
|||
int
|
||||
lwsl_timestamp(int level, char *p, size_t len)
|
||||
{
|
||||
#ifndef LWS_PLAT_OPTEE
|
||||
#if !defined(LWS_PLAT_OPTEE) && !defined(LWS_WITH_NO_LOGS)
|
||||
time_t o_now;
|
||||
unsigned long long now;
|
||||
struct timeval tv;
|
||||
|
|
|
@ -88,7 +88,7 @@ typedef enum {
|
|||
RPAR_ORD0,
|
||||
} rx_parser_t;
|
||||
|
||||
#if defined(_DEBUG)
|
||||
#if defined(_DEBUG) && !defined(LWS_WITH_NO_LOGS)
|
||||
static const char *sn[] = {
|
||||
"unset",
|
||||
|
||||
|
|
|
@ -116,7 +116,9 @@ ss_api_amazon_auth_rx(void *userobj, const uint8_t *buf, size_t len, int flags)
|
|||
ss_api_amazon_auth_t *m = (ss_api_amazon_auth_t *)userobj;
|
||||
struct lws_context *context = (struct lws_context *)m->opaque_data;
|
||||
lws_system_blob_t *ab;
|
||||
#if !defined(LWS_WITH_NO_LOGS)
|
||||
size_t total;
|
||||
#endif
|
||||
int n;
|
||||
|
||||
ab = lws_system_get_blob(context, LWS_SYSBLOB_TYPE_AUTH, AUTH_IDX_LWA);
|
||||
|
@ -148,9 +150,11 @@ ss_api_amazon_auth_rx(void *userobj, const uint8_t *buf, size_t len, int flags)
|
|||
|
||||
/* we should have the auth token now */
|
||||
|
||||
#if !defined(LWS_WITH_NO_LOGS)
|
||||
total = lws_system_blob_get_size(ab);
|
||||
lwsl_notice("%s: acquired %u-byte api.amazon.com auth token, exp %ds\n",
|
||||
__func__, (unsigned int)total, m->expires_secs);
|
||||
#endif
|
||||
|
||||
lejp_destruct(&m->jctx);
|
||||
|
||||
|
|
|
@ -133,6 +133,7 @@ static const lws_struct_map_t lsm_schema[] = {
|
|||
static int
|
||||
t2_config_dump(struct lws_dll2 *d, void *user)
|
||||
{
|
||||
#if !defined(LWS_WITH_NO_LOGS)
|
||||
t2_config_t *c = lws_container_of(d, t2_config_t, list);
|
||||
|
||||
lwsl_notice("%s: id1 '%s'\n", __func__, c->id1);
|
||||
|
@ -145,6 +146,7 @@ t2_config_dump(struct lws_dll2 *d, void *user)
|
|||
|
||||
lwsl_notice("%s: key1: %s, key2: %s\n", __func__,
|
||||
c->creds->key1, c->creds->key2);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -265,12 +265,13 @@ ss_avs_metadata_state(void *userobj, void *sh,
|
|||
static lws_ss_state_return_t
|
||||
ss_avs_event_rx(void *userobj, const uint8_t *buf, size_t len, int flags)
|
||||
{
|
||||
#if !defined(LWS_WITH_NO_LOGS)
|
||||
ss_avs_event_t *m = (ss_avs_event_t *)userobj;
|
||||
// struct lws_context *context = (struct lws_context *)m->opaque_data;
|
||||
|
||||
lwsl_notice("%s: rideshare %s, len %d, flags 0x%x\n", __func__,
|
||||
lws_ss_rideshare(m->ss), (int)len, flags);
|
||||
|
||||
#endif
|
||||
// lwsl_hexdump_warn(buf, len);
|
||||
|
||||
bad = 0; /* for this demo, receiving something here == success */
|
||||
|
@ -282,9 +283,10 @@ static lws_ss_state_return_t
|
|||
ss_avs_event_tx(void *userobj, lws_ss_tx_ordinal_t ord, uint8_t *buf,
|
||||
size_t *len, int *flags)
|
||||
{
|
||||
#if !defined(LWS_WITH_NO_LOGS)
|
||||
ss_avs_event_t *m = (ss_avs_event_t *)userobj;
|
||||
lwsl_notice("%s: rideshare %s\n", __func__, lws_ss_rideshare(m->ss));
|
||||
|
||||
#endif
|
||||
return 1; /* don't transmit anything */
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ callback(struct lws *wsi, enum lws_callback_reasons reason,
|
|||
{
|
||||
int m= 0, n = 0;
|
||||
short r;
|
||||
#if defined(_DEBUG)
|
||||
#if defined(_DEBUG) && !defined(LWS_WITH_NO_LOGS)
|
||||
size_t remain;
|
||||
int first = 0, final = 0;
|
||||
#endif
|
||||
|
@ -103,7 +103,7 @@ callback(struct lws *wsi, enum lws_callback_reasons reason,
|
|||
break;
|
||||
|
||||
case LWS_CALLBACK_CLIENT_RECEIVE:
|
||||
#if defined(_DEBUG)
|
||||
#if defined(_DEBUG) && !defined(LWS_WITH_NO_LOGS)
|
||||
first = lws_is_first_fragment(wsi);
|
||||
final = lws_is_final_fragment(wsi);
|
||||
remain = lws_remaining_packet_payload(wsi);
|
||||
|
|
Loading…
Add table
Reference in a new issue