From 201609517635b04d6a5c71f6338e36a4f1dcbd8d Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Mon, 26 Jul 2021 15:41:52 +0900 Subject: [PATCH] replace the logging system with dlog in tizen please turn on logging in meson_option when it's necessary. Change-Id: Ib2483184697c344f196fc1ff2253309c9215239f --- packaging/thorvg.spec | 1 + src/lib/tvgCommon.h | 12 +++++++++--- src/meson.build | 3 ++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packaging/thorvg.spec b/packaging/thorvg.spec index f30540e..5b3e517 100644 --- a/packaging/thorvg.spec +++ b/packaging/thorvg.spec @@ -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 diff --git a/src/lib/tvgCommon.h b/src/lib/tvgCommon.h index e8dd0b8..95a1071 100644 --- a/src/lib/tvgCommon.h +++ b/src/lib/tvgCommon.h @@ -22,6 +22,7 @@ #ifndef _TVG_COMMON_H_ #define _TVG_COMMON_H_ +#include #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_ diff --git a/src/meson.build b/src/meson.build index 3302e33..4e2f4dc 100644 --- a/src/meson.build +++ b/src/meson.build @@ -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', -- 2.7.4