Use buffer traits over specific IDs
[platform/core/system/dlog.git] / src / log-redirect-stdout / internal.c
index 04fbe73..3d1cf6f 100644 (file)
@@ -23,6 +23,7 @@
 #include "internal.h"
 
 #include <backend_androidlogger.h>
+#include <buffer_config.h>
 #include <buffer_traits.h>
 #include <sys/ioctl.h>
 #include <linux/logger.h>
@@ -139,15 +140,7 @@ int setup_single_unstructed(log_id_t buffer, const char *tag, log_priority prio,
        if (r < 0)
                return r;
 
-       // This matches what log.c does. (FIXME: extract to a unified function)
-       bool limiter_apply_to_all_buffers = log_config_get_boolean(&config, "limiter_apply_to_all_buffers", false);
-       bool plog = (buffer != LOG_ID_APPS || limiter_apply_to_all_buffers) ? log_config_get_boolean(&config, "plog", true) : true;
-       char key[MAX_CONF_KEY_LEN];
-       r = snprintf(key, sizeof key, "enable_%s", log_name_by_id(buffer));
-       if (r < 0)
-               return r;
-       plog = log_config_get_boolean(&config, key, plog);
-       if (!plog)
+       if (!is_buffer_enabled(buffer, &config))
                return -EPERM;
 
        const char *const backend = log_config_claim_backend(&config);