context: use the log.level from the config file

Use log.level from the config file if not otherwise set with
PIPEWIRE_DEBUG env.
Make client log.level = 0 by default to avoid spamming the console
with errors.

Fixes #725
Fixes #769
This commit is contained in:
Wim Taymans 2021-02-19 12:44:03 +01:00
parent 08ea7d5cd6
commit 686524ce40
6 changed files with 9 additions and 4 deletions

View file

@ -663,7 +663,7 @@ static void on_error(void *data, uint32_t id, int seq, int res, const char *mess
{
struct client *client = data;
pw_log_debug(NAME" %p: error id:%u seq:%d res:%d (%s): %s", client,
pw_log_warn(NAME" %p: error id:%u seq:%d res:%d (%s): %s", client,
id, seq, res, spa_strerror(res), message);
if (id == PW_ID_CORE) {

View file

@ -5,7 +5,7 @@ context.properties = {
#mem.warn-mlock = false
#mem.allow-mlock = true
#mem.mlock-all = false
#log.level = 2
log.level = 0
}
context.spa-libs = {

View file

@ -4,7 +4,7 @@ context.properties = {
#mem.warn-mlock = false
#mem.allow-mlock = true
#mem.mlock-all = false
#log.level = 2
log.level = 0
}
context.spa-libs = {

View file

@ -5,7 +5,7 @@ context.properties = {
#mem.warn-mlock = false
#mem.allow-mlock = true
#mem.mlock-all = false
#log.level = 2
log.level = 0
}
context.spa-libs = {

View file

@ -4,6 +4,7 @@ context.properties = {
# modules.
#mem.mlock-all = false
#support.dbus = true
#log.level = 2
}
context.spa-libs = {

View file

@ -239,6 +239,10 @@ struct pw_context *pw_context_new(struct pw_loop *main_loop,
if ((str = pw_properties_get(conf, "context.properties")) != NULL)
pw_properties_update_string(properties, str, strlen(str));
if (getenv("PIPEWIRE_DEBUG") == NULL &&
(str = pw_properties_get(properties, "log.level")) != NULL)
pw_log_set_level(atoi(str));
if ((str = pw_properties_get(properties, "mem.mlock-all")) != NULL &&
pw_properties_parse_bool(str)) {
if (mlockall(MCL_CURRENT | MCL_FUTURE) < 0)