replace the logging system with dlog in tizen 72/261772/2
authorHermet Park <chuneon.park@samsung.com>
Mon, 26 Jul 2021 06:41:52 +0000 (15:41 +0900)
committerHermet Park <chuneon.park@samsung.com>
Mon, 26 Jul 2021 06:42:35 +0000 (15:42 +0900)
please turn on logging in meson_option when it's necessary.

Change-Id: Ib2483184697c344f196fc1ff2253309c9215239f

packaging/thorvg.spec
src/lib/tvgCommon.h
src/meson.build

index f30540e..5b3e517 100644 (file)
@@ -10,6 +10,7 @@ Source0:    %{name}-%{version}.tar.gz
 BuildRequires:  pkgconfig
 BuildRequires:  meson
 BuildRequires:  ninja
+BuildRequires:  pkgconfig(dlog)
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
 
index e8dd0b8..95a1071 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef _TVG_COMMON_H_
 #define _TVG_COMMON_H_
 
+#include <dlog.h>
 #include "config.h"
 #include "thorvg.h"
 
@@ -37,6 +38,7 @@ using namespace tvg;
     #define TVG_UNUSED __attribute__ ((__unused__))
 #endif
 
+#define LOG_TAG "thorvg"
 
 //TVG class identifier values
 #define TVG_CLASS_ID_UNDEFINED 0
@@ -49,11 +51,15 @@ using namespace tvg;
 enum class FileType { Tvg = 0, Svg, Raw, Png, Jpg, Unknown };
 
 #ifdef THORVG_LOG_ENABLED
-    #define TVGLOG(tag, fmt, ...) fprintf(stdout, tag ": " fmt "\n", ##__VA_ARGS__)  //Log Message for notifying user some useful info
-    #define TVGERR(tag, fmt, ...) fprintf(stderr, tag ": " fmt "\n", ##__VA_ARGS__)  //Error Message for us to fix it
+    //#define TVGLOG(tag, fmt, ...) fprintf(stdout, tag ": " fmt "\n", ##__VA_ARGS__)  //Log Message for notifying user some useful info
+    //#define TVGERR(tag, fmt, ...) fprintf(stderr, tag ": " fmt "\n", ##__VA_ARGS__)  //Error Message for us to fix it
+
+    //Use dlog system in Tizen
+    #define TVGLOG(tag, fmt, ...)
+    #define TVGERR(tag, fmt, ...) dlog_print(DLOG_ERROR, LOG_TAG, tag ": " fmt "\n", ##__VA_ARGS__)
 #else
     #define TVGERR(...)
     #define TVGLOG(...)
 #endif
 
-#endif //_TVG_COMMON_H_
\ No newline at end of file
+#endif //_TVG_COMMON_H_
index 3302e33..4e2f4dc 100644 (file)
@@ -19,7 +19,8 @@ subdir('savers')
 subdir('bindings')
 
 thread_dep = meson.get_compiler('cpp').find_library('pthread')
-thorvg_lib_dep = [common_dep, loader_dep, saver_dep, binding_dep, thread_dep]
+dlog_dep = dependency('dlog', required: false)
+thorvg_lib_dep = [common_dep, loader_dep, saver_dep, binding_dep, thread_dep, dlog_dep]
 
 thorvg_lib = library(
        'thorvg',