Add dlog for tizen 24/301924/1
authorjoogab.yun <joogab.yun@samsung.com>
Mon, 27 Nov 2023 08:39:29 +0000 (17:39 +0900)
committerjoogab.yun <joogab.yun@samsung.com>
Mon, 27 Nov 2023 10:23:15 +0000 (19:23 +0900)
Change-Id: I941937976b3593841c63d1c7ab598fc4dfe417d3

meson.build
meson_options.txt
packaging/rlottie.spec
src/lottie/lottieanimation.cpp
src/lottie/lottieloader.cpp
src/lottie/lottieparser.cpp
src/meson.build
src/vector/vdebug.h
src/vector/vimageloader.cpp

index 46b1ec4c864692504d49fd1c5b8362ff78c8fa02..2944f32a192a2d823a7cb4323938687a2b96efa2 100644 (file)
@@ -58,6 +58,9 @@ if get_option('dumptree') == true
     config_h.set10('LOTTIE_DUMP_TREE_SUPPORT', true)
 endif
 
+if get_option('tizen') == true
+    config_h.set10('TIZEN', true)
+endif
 
 configure_file(
   output: 'config.h',
index acc79d218dabf40f4a29a2bf17bfae6142ece5f4..cfd56460a5aa26c7cdb5200b593d8fa5e7abf1db 100644 (file)
@@ -46,3 +46,8 @@ option('cmake',
   type: 'boolean',
   value: false,
   description: 'Enable Generating  CMake config files')
+
+option('tizen',
+   type: 'boolean',
+   value: true,
+   description: 'Enable prints tizen dlogs')
index 9cc674e7257b7cbd9b8d731ab37cc88c6a1b0cdd..11b09896abcd0373510de7d708982efda8f377d6 100644 (file)
@@ -6,8 +6,10 @@ Group:      UI Framework/Services
 License:    MIT and BSD and MPL-2.0
 URL:        http://www.tizen.org/
 Source0:    %{name}-%{version}.tar.gz
+BuildRequires:  pkgconfig
 BuildRequires:  meson
 BuildRequires:  ninja
+BuildRequires:  pkgconfig(dlog)
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
 
index afcc400bc822f30771dbd9a4cf4924a521f79cf0..62e9fbbbc4f7baf4d6b7addc89fd089dce54211f 100644 (file)
@@ -111,6 +111,7 @@ Surface AnimationImpl::render(size_t frameNo, const Surface &surface,
     bool renderInProgress = mRenderInProgress.load();
     if (renderInProgress) {
         vCritical << "Already Rendering Scheduled for this Animation";
+        LOGE("Already Rendering Scheduled for this Animation\n");
         return surface;
     }
 
@@ -275,6 +276,7 @@ std::unique_ptr<Animation> Animation::loadFromData(
 {
     if (jsonData.empty()) {
         vWarning << "jason data is empty";
+        LOGE("jason data is empty\n");
         return nullptr;
     }
 
@@ -295,6 +297,7 @@ std::unique_ptr<Animation> Animation::loadFromData(std::string jsonData,
 {
     if (jsonData.empty()) {
         vWarning << "jason data is empty";
+        LOGE("jason data is empty\n");
         return nullptr;
     }
 
@@ -313,6 +316,7 @@ std::unique_ptr<Animation> Animation::loadFromFile(const std::string &path,
 {
     if (path.empty()) {
         vWarning << "File path is empty";
+        LOGE("File path is empty\n");
         return nullptr;
     }
 
index 8a52949e7133dcae882ea54d23eaecdbd719427f..58911b5338aa9cb59f7bf63b4f42f9778291ced5 100644 (file)
@@ -126,6 +126,7 @@ std::shared_ptr<model::Composition> model::loadFromFile(const std::string &path,
 
     if (!f.is_open()) {
         vCritical << "failed to open file = " << path.c_str();
+        LOGE("failed to open file = %s\n", path.c_str());
         return {};
     } else {
         std::string content;
@@ -133,10 +134,18 @@ std::shared_ptr<model::Composition> model::loadFromFile(const std::string &path,
         std::getline(f, content, '\0');
         f.close();
 
-        if (content.empty()) return {};
+        if (content.empty())
+        {
+            LOGE("failed : content is empty\n");
+            return {};
+        }
 
         auto obj = internal::model::parse(const_cast<char *>(content.c_str()),
                                           dirname(path));
+        if (!obj)
+        {
+            LOGE("failed : model of parse is null\n");
+        }
 
         if (obj && cachePolicy) ModelCache::instance().add(path, obj);
 
index e14fd5c1c7eb98072d03236de791de28f90cd203..8c7b550e84ce545405849fe3f6aea2d2b3d5103a 100644 (file)
@@ -394,6 +394,7 @@ bool LottieParserImpl::ParseNext()
 
     if (!r_.IterativeParseNext<parseFlags>(ss_, *this)) {
         vCritical << "Lottie file parsing error";
+        LOGE("Lottie file parsing error\n");
         st_ = kError;
         return false;
     }
@@ -1142,6 +1143,7 @@ model::Object *LottieParserImpl::parseObjectTypeAttr()
     const char *type = GetString();
     if (!type) {
         vWarning << "No object type specified";
+        LOGE("No object type specified\n");
         return nullptr;
     }
     if (0 == strcmp(type, "gr")) {
@@ -1177,6 +1179,7 @@ model::Object *LottieParserImpl::parseObjectTypeAttr()
         return parseReapeaterObject();
     } else if (0 == strcmp(type, "mm")) {
         vWarning << "Merge Path is not supported yet";
+        LOGE("Merge Path is not supported yet\n");
         return nullptr;
     } else {
 #ifdef DEBUG_PARSER
@@ -2388,6 +2391,7 @@ std::shared_ptr<model::Composition> model::parse(char *             str,
     }
 
     vWarning << "Input data is not Lottie format!";
+    LOGE( "Input data is not Lottie format!\n");
     return {};
 }
 
index d93a7e37ae62edf9c7d87cef06933d9f434459c2..529067f0fb1d7530562767fe7f84eae954844742 100644 (file)
@@ -22,6 +22,10 @@ if get_option('thread') == true
     rlottie_lib_dep  += dependency('threads')
 endif
 
+if get_option('tizen') == true
+    rlottie_lib_dep += dependency('dlog', required: true)
+endif
+
 rlottie_lib = library('rlottie',
                       include_directories   : inc,
                       version               : meson.project_version(),
@@ -37,6 +41,7 @@ rlottie_dep = declare_dependency(
                                  include_directories: inc,
                                  link_with : rlottie_lib)
 
+
 if (cc.get_id() == 'emscripten')
 
   subdir('wasm')
index 5b6bef5b1a236374a62445d97bf5184c2e938836..d24fdbe3dfaa664ac59d7a3ff2b4d9ed33be482b 100644 (file)
 
 #include "config.h"
 
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "LOTTIE"
+
+#ifdef TIZEN
+#include <dlog.h>
+#define LOGW(fmt, ...) dlog_print(DLOG_WARN, LOG_TAG, "[%s]" fmt, __func__, ##__VA_ARGS__)
+#define LOGE(fmt, ...) dlog_print(DLOG_ERROR, LOG_TAG, "[%s]" fmt, __func__, ##__VA_ARGS__)
+#else
+#define C_RED "\e[31m"
+#define C_YELLOW "\e[33m"
+#define C_END "\e[0m"
+#define LOGW(fmt, ...) printf(C_YELLOW "[" LOG_TAG "]" C_END "[%s]" fmt "\n", __func__, ##__VA_ARGS__)
+#define LOGE(fmt, ...) printf(C_RED "[" LOG_TAG "]" C_END "[%s]" fmt "\n", __func__, ##__VA_ARGS__)
+#endif
+
 #ifdef LOTTIE_LOGGING_SUPPORT
 
 #include <cstdint>
index c2446be95a0d3b18efa32f429f281a5b8b14ed46..508bd7706ab14f41f8928f2b13a309424b6acd96 100644 (file)
@@ -94,22 +94,33 @@ struct VImageLoader::Impl {
     {
         if (moduleLoad()) {
             vWarning << "Failed to dlopen librlottie-image-loader library";
+            LOGE("Failed to dlopen librlottie-image-loader library\n");
             return;
         }
 
         init();
 
         if (!imageLoad)
+        {
             vWarning << "Failed to find symbol lottie_image_load in "
                         "librlottie-image-loader library";
+            LOGW("Failed to find symbol lottie_image_load in librlottie-image-loader library\n");
+        }
+
 
         if (!imageFree)
+        {
             vWarning << "Failed to find symbol lottie_image_free in "
                         "librlottie-image-loader library";
+            LOGW("Failed to find symbol lottie_image_free in librlottie-image-loader library\n");
+        }
 
         if (!imageFromData)
+        {
             vWarning << "Failed to find symbol lottie_image_load_data in "
                         "librlottie-image-loader library";
+            LOGW("Failed to find symbol lottie_image_load_data in librlottie-image-loader library\n");
+        }
     }
 
     ~Impl() { moduleFree(); }