Commit b5e721eb authored by Philipp Schafft's avatar Philipp Schafft 🦁

Merge branch 'ph3-fix-debug-spam'

Closes: #2358
parents bb6ecd31 8589c1a0
Pipeline #502 failed with stage
in 16 seconds
......@@ -274,6 +274,15 @@ AS_IF([test "$with_default_config" != "no"], [
])
AC_ARG_ENABLE([devel-logging],
AS_HELP_STRING([--enable-devel-logging],
[enable development logging (default: disabled)])
)
AS_IF([test "x$enable_devel_logging" == "xyes"], [
AC_DEFINE([DEVEL_LOGGING], 1, [Define to enable development logging])
], [enable_devel_logging="no"])
dnl Make substitutions
AC_SUBST(XIPH_LIBS)
AC_SUBST(XIPH_CPPFLAGS)
......@@ -316,4 +325,6 @@ Format/Codec support:
Features:
YP support : ${enable_yp}
Client tests : ${enable_client_tests}"])
Client tests : ${enable_client_tests}
Development logging: ${enable_devel_logging}"])
......@@ -164,7 +164,7 @@ static void queue_auth_client (auth_client *auth_user)
return;
}
auth = auth_user->client->auth;
ICECAST_LOG_DEBUG("...refcount on auth_t %s is now %d", auth->mount, (int)auth->refcount);
ICECAST_LOG_DDEBUG("...refcount on auth_t %s is now %d", auth->mount, (int)auth->refcount);
if (auth->immediate) {
__handle_auth_client(auth, auth_user);
} else {
......@@ -189,7 +189,7 @@ void auth_release (auth_t *authenticator) {
thread_mutex_lock(&authenticator->lock);
authenticator->refcount--;
ICECAST_LOG_DEBUG("...refcount on auth_t %s is now %d", authenticator->mount, (int)authenticator->refcount);
ICECAST_LOG_DDEBUG("...refcount on auth_t %s is now %d", authenticator->mount, (int)authenticator->refcount);
if (authenticator->refcount)
{
thread_mutex_unlock(&authenticator->lock);
......@@ -235,7 +235,7 @@ void auth_addref (auth_t *authenticator) {
thread_mutex_lock (&authenticator->lock);
authenticator->refcount++;
ICECAST_LOG_DEBUG("...refcount on auth_t %s is now %d", authenticator->mount, (int)authenticator->refcount);
ICECAST_LOG_DDEBUG("...refcount on auth_t %s is now %d", authenticator->mount, (int)authenticator->refcount);
thread_mutex_unlock (&authenticator->lock);
}
......@@ -418,7 +418,7 @@ static void *auth_run_thread (void *arg)
thread_mutex_unlock (&auth->lock);
continue;
}
ICECAST_LOG_DEBUG("%d client(s) pending on %s (role %s)", auth->pending_count, auth->mount, auth->role);
ICECAST_LOG_DDEBUG("%d client(s) pending on %s (role %s)", auth->pending_count, auth->mount, auth->role);
auth->head = auth_user->next;
if (auth->head == NULL)
auth->tailp = &auth->head;
......@@ -447,7 +447,7 @@ static void auth_add_client(auth_t *auth, client_t *client, void (*on_no_match)(
const char *origin;
size_t i;
ICECAST_LOG_DEBUG("Trying to add client %p to auth %p's (role %s) queue.", client, auth, auth->role);
ICECAST_LOG_DDEBUG("Trying to add client %p to auth %p's (role %s) queue.", client, auth, auth->role);
/* TODO: replace that magic number */
if (auth->pending_count > 100) {
......@@ -525,7 +525,7 @@ static void auth_add_client(auth_t *auth, client_t *client, void (*on_no_match)(
auth_user->on_no_match = on_no_match;
auth_user->on_result = on_result;
auth_user->userdata = userdata;
ICECAST_LOG_DEBUG("adding client %p for authentication on %p", client, auth);
ICECAST_LOG_DDEBUG("adding client %p for authentication on %p", client, auth);
queue_auth_client(auth_user);
}
......@@ -569,7 +569,7 @@ static int get_authenticator (auth_t *auth, config_options_t *options)
}
do
{
ICECAST_LOG_DEBUG("type is %s", auth->type);
ICECAST_LOG_DDEBUG("type is %s", auth->type);
if (strcmp(auth->type, AUTH_TYPE_URL) == 0) {
#ifdef HAVE_CURL
......
......@@ -585,9 +585,9 @@ static void process_request_body_queue (void)
time_t timeout;
size_t body_size_limit;
ICECAST_LOG_DEBUG("Processing body queue.");
ICECAST_LOG_DDEBUG("Processing body queue.");
ICECAST_LOG_DEBUG("_body_queue=%p, &_body_queue=%p, _body_queue_tail=%p", _body_queue, &_body_queue, _body_queue_tail);
ICECAST_LOG_DDEBUG("_body_queue=%p, &_body_queue=%p, _body_queue_tail=%p", _body_queue, &_body_queue, _body_queue_tail);
config = config_get_config();
timeout = time(NULL) - config->body_timeout;
......
......@@ -27,7 +27,8 @@ typedef struct event_log {
static int event_log_emit(void *state, event_t *event) {
event_log_t *self = state;
ICECAST_LOG(self->level, "%s%strigger=\"%s\" uri=\"%s\" "
ICECAST_LOG(self->level, ICECAST_LOGFLAG_NONE,
"%s%strigger=\"%s\" uri=\"%s\" "
"connection_id=%lu connection_ip=\"%s\" connection_time=%lli "
"client_role=\"%s\" client_username=\"%s\" client_useragent=\"%s\" client_admin_command=%i",
self->prefix ? self->prefix : "", self->prefix ? ": " : "",
......
......@@ -191,7 +191,7 @@ void fastevent_emit(fastevent_type_t type, fastevent_flag_t flags, fastevent_dat
va_list ap, apx;
size_t i;
ICECAST_LOG_DEBUG("event: type=%i, flags=%i, datatype=%i, ...", (int)type, (int)flags, (int)datatype);
ICECAST_LOG_DDEBUG("event: type=%i, flags=%i, datatype=%i, ...", (int)type, (int)flags, (int)datatype);
thread_rwlock_rlock(&fastevent_lock);
row = __get_row(type);
......
......@@ -35,15 +35,32 @@ extern int playlistlog;
#define ICECAST_LOGLEVEL_INFO 3
#define ICECAST_LOGLEVEL_DEBUG 4
/* Log flags */
#define ICECAST_LOGFLAG_NONE 0
#define ICECAST_LOGFLAG_DEVEL 1
/*
** Variadic macros for logging
*/
#define ICECAST_LOG(level,...) log_write(errorlog, (level), CATMODULE "/", __func__, __VA_ARGS__)
#define ICECAST_LOG_ERROR(...) ICECAST_LOG(ICECAST_LOGLEVEL_ERROR, __VA_ARGS__)
#define ICECAST_LOG_WARN(...) ICECAST_LOG(ICECAST_LOGLEVEL_WARN, __VA_ARGS__)
#define ICECAST_LOG_INFO(...) ICECAST_LOG(ICECAST_LOGLEVEL_INFO, __VA_ARGS__)
#define ICECAST_LOG_DEBUG(...) ICECAST_LOG(ICECAST_LOGLEVEL_DEBUG,__VA_ARGS__)
#define ICECAST_LOG(level,flags,...) log_write(errorlog, (level), CATMODULE "/", __func__, __VA_ARGS__)
#define ICECAST_LOG_ERROR(...) ICECAST_LOG(ICECAST_LOGLEVEL_ERROR, ICECAST_LOGFLAG_NONE, __VA_ARGS__)
#define ICECAST_LOG_WARN(...) ICECAST_LOG(ICECAST_LOGLEVEL_WARN, ICECAST_LOGFLAG_NONE, __VA_ARGS__)
#define ICECAST_LOG_INFO(...) ICECAST_LOG(ICECAST_LOGLEVEL_INFO, ICECAST_LOGFLAG_NONE, __VA_ARGS__)
#define ICECAST_LOG_DEBUG(...) ICECAST_LOG(ICECAST_LOGLEVEL_DEBUG, ICECAST_LOGFLAG_NONE, __VA_ARGS__)
/* Currently only an alias for ICECAST_LOG_DEBUG() */
#ifdef DEVEL_LOGGING
#define ICECAST_LOG_DERROR(...) ICECAST_LOG(ICECAST_LOGLEVEL_ERROR, ICECAST_LOGFLAG_DEVEL, __VA_ARGS__)
#define ICECAST_LOG_DWARN(...) ICECAST_LOG(ICECAST_LOGLEVEL_WARN, ICECAST_LOGFLAG_DEVEL, __VA_ARGS__)
#define ICECAST_LOG_DINFO(...) ICECAST_LOG(ICECAST_LOGLEVEL_INFO, ICECAST_LOGFLAG_DEVEL, __VA_ARGS__)
#define ICECAST_LOG_DDEBUG(...) ICECAST_LOG(ICECAST_LOGLEVEL_DEBUG, ICECAST_LOGFLAG_DEVEL, __VA_ARGS__)
#else
#define ICECAST_LOG_DERROR(...)
#define ICECAST_LOG_DWARN(...)
#define ICECAST_LOG_DINFO(...)
#define ICECAST_LOG_DDEBUG(...)
#endif
/* CATMODULE is the category or module that logging messages come from.
** we set one here in cause someone forgets in the .c file.
......
......@@ -970,14 +970,14 @@ const char *util_http_select_best(const char *input, const char *first, ...)
return first;
}
ICECAST_LOG_DEBUG("--- DUMP ---");
ICECAST_LOG_DDEBUG("--- DUMP ---");
for (i = 0; i < kv->kvlen; i++) {
ICECAST_LOG_DEBUG("kv[%zu] = {.key='%H', .value='%H'}", i, kv->kv[i].key, kv->kv[i].value);
ICECAST_LOG_DDEBUG("kv[%zu] = {.key='%H', .value='%H'}", i, kv->kv[i].key, kv->kv[i].value);
}
for (i = 0; i < kv->indexlen; i++) {
ICECAST_LOG_DEBUG("index[%zu] = %zu", i, kv->index[i]);
ICECAST_LOG_DDEBUG("index[%zu] = %zu", i, kv->index[i]);
}
ICECAST_LOG_DEBUG("--- END OF DUMP ---");
ICECAST_LOG_DDEBUG("--- END OF DUMP ---");
for (h = 0; h < arglen; h++) {
for (i = 0; i < kv->indexlen; i++) {
......@@ -1224,7 +1224,7 @@ icecast_kva_t * util_parse_http_cn(const char *cnstr)
case __TOKENIZER_RESULT_EQ:
/* fall through */
case __TOKENIZER_RESULT_SEMICOLON:
ICECAST_LOG_DEBUG("OK from tokenizer.");
ICECAST_LOG_DDEBUG("OK from tokenizer.");
/* no-op */
break;
}
......@@ -1246,21 +1246,21 @@ icecast_kva_t * util_parse_http_cn(const char *cnstr)
switch (res) {
case __TOKENIZER_RESULT_EOS:
ICECAST_LOG_DEBUG("End of string from tokenizer.");
ICECAST_LOG_DDEBUG("End of string from tokenizer.");
eos = 1;
continue;
break;
case __TOKENIZER_RESULT_COMMA:
ICECAST_LOG_DEBUG("Comma from tokenizer.");
ICECAST_LOG_DDEBUG("Comma from tokenizer.");
ret->index[ret->indexlen++] = ret->kvlen;
ret->kvlen++;
break;
case __TOKENIZER_RESULT_EQ:
ICECAST_LOG_DEBUG("Eq from tokenizer.");
ICECAST_LOG_DDEBUG("Eq from tokenizer.");
/* no-op */
break;
case __TOKENIZER_RESULT_SEMICOLON:
ICECAST_LOG_DEBUG("Semicolon from tokenizer.");
ICECAST_LOG_DDEBUG("Semicolon from tokenizer.");
ret->kvlen++;
break;
default:
......@@ -1269,7 +1269,7 @@ icecast_kva_t * util_parse_http_cn(const char *cnstr)
break;
}
ICECAST_LOG_DEBUG("next...");
ICECAST_LOG_DDEBUG("next...");
}
return ret;
......
......@@ -301,11 +301,11 @@ static xmlDocPtr custom_loader(const xmlChar *URI,
/* Get the actual xmlDoc */
if (final_URI) {
ICECAST_LOG_DEBUG("Calling xslt_loader() for \"%s\" (was: \"%s\").", final_URI, URI);
ICECAST_LOG_DDEBUG("Calling xslt_loader() for \"%s\" (was: \"%s\").", final_URI, URI);
ret = xslt_loader(final_URI, dict, options, ctxt, type);
xmlFree(final_URI);
} else {
ICECAST_LOG_DEBUG("Calling xslt_loader() for \"%s\".", URI);
ICECAST_LOG_DDEBUG("Calling xslt_loader() for \"%s\".", URI);
ret = xslt_loader(URI, dict, options, ctxt, type);
}
return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment