mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-16 00:00:07 +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
e47915c420
commit
39e89328b0
8 changed files with 22 additions and 6 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 */
|
||||
|
||||
/*
|
||||
|
|
|
@ -473,7 +473,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)
|
||||
|
|
|
@ -1263,7 +1263,9 @@ lws_system_cpd_start(struct lws_context *cx)
|
|||
#endif
|
||||
}
|
||||
|
||||
#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)
|
||||
|
@ -1271,7 +1273,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
|
||||
|
||||
|
@ -48,7 +48,7 @@ static const char * log_level_names ="EWNIDPHXCLUT??";
|
|||
int
|
||||
lwsl_timestamp(int level, char *p, int 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;
|
||||
|
|
|
@ -85,7 +85,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);
|
||||
|
||||
|
|
|
@ -141,6 +141,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);
|
||||
|
@ -153,6 +154,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 int
|
||||
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 int
|
|||
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 */
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue