e_comp_wl: Enable log messages of libds 22/297222/1
authorSeunghun Lee <shiin.lee@samsung.com>
Tue, 8 Aug 2023 05:17:46 +0000 (14:17 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Mon, 14 Aug 2023 05:33:57 +0000 (14:33 +0900)
It redirects log messages of libds to enlightenment log system.
Let the intial log level of libds be DS_DBG so that it can be printed
depending on enlightenment's log level.

Change-Id: I8ee125c7285f38b74feae04f951b2587b876960e

src/bin/e_comp_wl.c

index a2f4092..da7dc98 100644 (file)
@@ -10,6 +10,8 @@
 #include <wayland-tbm-server.h>
 #include <glib.h>
 
+#include <libds/log.h>
+
 /* handle include for printing uint64_t */
 #define __STDC_FORMAT_MACROS
 #include <inttypes.h>
@@ -3620,6 +3622,28 @@ _e_comp_wl_cb_client_created(struct wl_listener *listener, void *data)
    _e_comp_wl_connected_client_create(client, name, pid, uid, gid);
 }
 
+static void
+_e_comp_wl_ds_log_handler(enum ds_log_level level, const char *fmt, va_list args)
+{
+   char buf[1024] = {0, };
+
+   vsnprintf(buf, 1024, fmt, args);
+   switch (level)
+     {
+      case DS_DBG:
+         DBG("[libds] %s", buf);
+         break;
+      case DS_INF:
+         INF("[libds] %s", buf);
+         break;
+      case DS_ERR:
+         ERR("[libds] %s", buf);
+         break;
+      default:
+         break;
+     }
+}
+
 static Eina_Bool
 _e_comp_wl_display_create(void)
 {
@@ -3667,6 +3691,8 @@ _e_comp_wl_display_create(void)
    /* wl_cdata->output.transform = WL_OUTPUT_TRANSFORM_NORMAL; */
    /* wl_cdata->output.scale = e_scale; */
 
+   ds_log_init(DS_DBG, _e_comp_wl_ds_log_handler);
+
    if (!e_compositor_init(wl_cdata->wl.disp))
      {
         ERR("Failed to initialize compositor");