Skip to content
  • Peter Hutterer's avatar
    log: add topic loggers and a default topic · 52bd80aa
    Peter Hutterer authored and Wim Taymans's avatar Wim Taymans committed
    pw_log_log/logv now go through the topic-based logger using the
    "default" topic. Log topics themselves can be allocated by the call
    sites. The simplest way to use a topic from e.g. a module:
    
        PW_LOG_TOPIC_STATIC(mod_topic, "mod.foo");
        #define PW_LOG_TOPIC_DEFAULT mod_topic
        ...
        void pipewire__module_init() {
      	  PW_LOG_TOPIC_INIT(mod_topic);
      	  ...
        }
    
    With the #define all pw_log_foo() are now routed through the custom
    topic. For the cases where the log topic must be specified, a
    pw_logt_foo() set of macros is available.
    
    Log topics are enabled through the PIPEWIRE_DEBUG environment variable
    which now supports globs, e.g. PIPEWIRE_DEBUG="*:I;mod.access:D"
    to enable global INFO but DEBUG for the access module.
    
    Namespaces documented are "pw", "mod" and "conn", for pipewire-internal
    stuff, modules and connection dumping. The latter is special-cased to
    avoid spamming the log files, it requires an expcit "conn.<glob>"
    pattern to enable.
    
    The "default" topic always exists and is the fallback for any
    pw_log_foo() invocation that does not use a topic.
    52bd80aa