pipewire: use local real time timestamps in logging

Wireplumber and other system services use local real time timestamps in
logging, so it's more convenient if also PW uses them.

Add env var for selecting the timestamp type, default to "local".
This commit is contained in:
Pauli Virtanen 2024-12-14 13:34:27 +02:00 committed by Wim Taymans
parent 1ec814977c
commit 08700a9eb5
2 changed files with 8 additions and 1 deletions

View file

@ -154,6 +154,10 @@ systemd.
@PAR@ pipewire-env PIPEWIRE_LOG_LINE
Enables the logging of line numbers. Default true.
@PAR@ pipewire-env PIPEWIRE_LOG_TIMESTAMP
Logging timestamp type: "local", "monotonic", "realtime", "none".
Default "local".
@PAR@ pipewire-env PIPEWIRE_LOG
Specifies a log file to use instead of the default logger.

View file

@ -533,7 +533,10 @@ void pw_init(int *argc, char **argv[])
str = "true";
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_LOG_COLORS, str);
}
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_LOG_TIMESTAMP, "true");
if ((str = getenv("PIPEWIRE_LOG_TIMESTAMP")) != NULL)
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_LOG_TIMESTAMP, str);
else
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_LOG_TIMESTAMP, "local");
if ((str = getenv("PIPEWIRE_LOG_LINE")) == NULL || spa_atob(str))
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_LOG_LINE, "true");
snprintf(level, sizeof(level), "%d", pw_log_level);