From 155b19c761bf20d6ce4632973a20408518ab8498 Mon Sep 17 00:00:00 2001 From: chen-xiaoxue299 Date: Mon, 8 Sep 2025 20:55:58 +0800 Subject: [PATCH] modify log Signed-off-by: chen-xiaoxue299 --- adapter/ohos/osal/log_wrapper.cpp | 1 + .../jsview/js_view_context.cpp | 11 +++-- frameworks/core/animation/cubic_curve.cpp | 10 +++++ frameworks/core/animation/spring_curve.cpp | 9 +++++ frameworks/core/animation/spring_curve.h | 1 + .../interfaces/native/node/node_animate.cpp | 13 +++--- .../include/ui/animation/animation_option.h | 20 ++++++++++ .../include/ui/animation/cubic_curve.h | 1 + .../ace_kit/include/ui/animation/curve.h | 40 +++++++++++++++++++ 9 files changed, 93 insertions(+), 13 deletions(-) diff --git a/adapter/ohos/osal/log_wrapper.cpp b/adapter/ohos/osal/log_wrapper.cpp index 851044ebac0..07e173c8376 100644 --- a/adapter/ohos/osal/log_wrapper.cpp +++ b/adapter/ohos/osal/log_wrapper.cpp @@ -125,6 +125,7 @@ const std::unordered_map g_DOMAIN_CONTENTS_MAP = { { AceLogTag::ACE_APPBAR, "AceAppBar" }, { AceLogTag::ACE_SELECT_OVERLAY, "AceSelectOverlay" }, { AceLogTag::ACE_CLIPBOARD, "AceClipBoard" }, + { AceLogTag::ACE_VISUAL_EFFECT, "AceVisualEffect" }, { AceLogTag::ACE_SECURITY_COMPONENT, "AceSecurityComponent" }, { AceLogTag::ACE_MEDIA_QUERY, "AceMediaQuery" }, { AceLogTag::ACE_LAYOUT_INSPECTOR, "AceLayoutInspector" }, diff --git a/frameworks/bridge/declarative_frontend/jsview/js_view_context.cpp b/frameworks/bridge/declarative_frontend/jsview/js_view_context.cpp index 495c3883415..a9522a322a6 100644 --- a/frameworks/bridge/declarative_frontend/jsview/js_view_context.cpp +++ b/frameworks/bridge/declarative_frontend/jsview/js_view_context.cpp @@ -112,18 +112,17 @@ void PrintAnimationInfo(const AnimationOption& option, AnimationInterface interf if (option.GetIteration() == ANIMATION_REPEAT_INFINITE) { if (interface == AnimationInterface::KEYFRAME_ANIMATE_TO) { TAG_LOGI(AceLogTag::ACE_ANIMATION, - "keyframeAnimateTo iteration is infinite, remember to stop it. total duration:%{public}d", - option.GetDuration()); + "keyframe inf iteration. dur:%{public}d", option.GetDuration()); } else { TAG_LOGI(AceLogTag::ACE_ANIMATION, - "%{public}s iteration is infinite. duration:%{public}d, curve:%{public}s", + "%{public}s inf iteration. dur:%{public}d, curve:%{public}s", animationInterfaceName, option.GetDuration(), option.GetCurve()->ToString().c_str()); } return; } if (cnt) { - TAG_LOGI(AceLogTag::ACE_ANIMATION, "%{public}s starts, [%{public}s], finish cnt:%{public}d", - animationInterfaceName, option.ToString().c_str(), cnt.value()); + TAG_LOGI(AceLogTag::ACE_ANIMATION, "%{public}s starts, %{public}s, cnt:%{public}d", + animationInterfaceName, option.ToSimpleString().c_str(), cnt.value()); } } @@ -208,7 +207,7 @@ void FlushDirtyNodesWhenExist(const RefPtr& pipelineContext, if (flushCount >= MAX_FLUSH_COUNT || option.GetIteration() != ANIMATION_REPEAT_INFINITE) { TAG_LOGD(AceLogTag::ACE_ANIMATION, "%{public}s, option:%{public}s, finish cnt:%{public}d," "dirtyNodes is empty:%{public}d, dirtyLayoutNodes is empty:%{public}d", - animationInterfaceName, option.ToString().c_str(), count.value_or(-1), + animationInterfaceName, option.ToSimpleString().c_str(), count.value_or(-1), isDirtyNodesEmpty, isDirtyLayoutNodesEmpty); break; } diff --git a/frameworks/core/animation/cubic_curve.cpp b/frameworks/core/animation/cubic_curve.cpp index b8f7d7ae510..9c12a486402 100644 --- a/frameworks/core/animation/cubic_curve.cpp +++ b/frameworks/core/animation/cubic_curve.cpp @@ -63,6 +63,16 @@ const std::string CubicCurve::ToString() return curveString; } +const std::string CubicCurve::ToSimpleString() +{ + const int32_t precision = 2; + std::stringstream ss; + std::string comma(","); + ss << "cubic(" << std::fixed << std::setprecision(precision) << x0_ + << comma << y0_ << comma << x1_ << comma << y1_ << ")"; + return ss.str(); +} + bool CubicCurve::IsEqual(const RefPtr& curve) const { auto other = DynamicCast(curve); diff --git a/frameworks/core/animation/spring_curve.cpp b/frameworks/core/animation/spring_curve.cpp index 59c5d68326b..57ad0b5c86e 100644 --- a/frameworks/core/animation/spring_curve.cpp +++ b/frameworks/core/animation/spring_curve.cpp @@ -121,4 +121,13 @@ const std::string SpringCurve::ToString() return curveString; } +const std::string SpringCurve::ToSimpleString() +{ + const int32_t precision = 2; + std::stringstream ss; + std::string comma(","); + ss << "spring(" << std::fixed << std::setprecision(precision) << velocity_ + << comma << mass_ << comma << stiffness_ << comma << damping_ << ")"; + return ss.str(); +} } // namespace OHOS::Ace \ No newline at end of file diff --git a/frameworks/core/animation/spring_curve.h b/frameworks/core/animation/spring_curve.h index cc4902ca73f..d94f2a70ad0 100644 --- a/frameworks/core/animation/spring_curve.h +++ b/frameworks/core/animation/spring_curve.h @@ -30,6 +30,7 @@ public: float MoveInternal(float time) override; const std::string ToString() override; + const std::string ToSimpleString() override; void UpdateVelocity(float velocity) { diff --git a/frameworks/core/interfaces/native/node/node_animate.cpp b/frameworks/core/interfaces/native/node/node_animate.cpp index d91b3034e13..856f4e8220c 100644 --- a/frameworks/core/interfaces/native/node/node_animate.cpp +++ b/frameworks/core/interfaces/native/node/node_animate.cpp @@ -70,20 +70,19 @@ void PrintNodeAnimationInfo(const AnimationOption& option, if (option.GetIteration() == ANIMATION_REPEAT_INFINITE) { if (interface == AnimationInterface::KEYFRAME_ANIMATE_TO) { TAG_LOGI(AceLogTag::ACE_ANIMATION, - "nodeAnimate:keyframeAnimateTo iteration is infinite, remember to stop it. total duration:%{public}d", + "nodeAnimate:keyframe inf iteration. dur:%{public}d", option.GetDuration()); } else { TAG_LOGI(AceLogTag::ACE_ANIMATION, - "nodeAnimate:%{public}s iteration is infinite." - "duration:%{public}d, curve:%{public}s", + "nodeAnimate:%{public}s inf iteration. dur:%{public}d, curve:%{public}s", animationInterfaceName, - option.GetDuration(), option.GetCurve()->ToString().c_str()); + option.GetDuration(), option.GetCurve()->ToSimpleString().c_str()); } return; } if (cnt) { - TAG_LOGI(AceLogTag::ACE_ANIMATION, "nodeAnimate:%{public}s starts, [%{public}s], finish cnt:%{public}d", - animationInterfaceName, option.ToString().c_str(), cnt.value()); + TAG_LOGI(AceLogTag::ACE_ANIMATION, "nodeAnimate:%{public}s starts, %{public}s, cnt:%{public}d", + animationInterfaceName, option.ToSimpleString().c_str(), cnt.value()); } } @@ -136,7 +135,7 @@ void AnimateToInner(ArkUIContext* context, AnimationOption& option, const std::f if (!ViewStackModel::GetInstance()->IsEmptyStack()) { TAG_LOGW(AceLogTag::ACE_ANIMATION, "node_animate:when call animateTo, node stack is not empty, not suitable for animateTo." - "param is [option:%{public}s]", option.ToString().c_str()); + "param is [option:%{public}s]", option.ToSimpleString().c_str()); } NG::ScopedViewStackProcessor scopedProcessor; auto triggerId = context->id; diff --git a/interfaces/inner_api/ace_kit/include/ui/animation/animation_option.h b/interfaces/inner_api/ace_kit/include/ui/animation/animation_option.h index 5b85cf29569..9cf7bd68b4b 100644 --- a/interfaces/inner_api/ace_kit/include/ui/animation/animation_option.h +++ b/interfaces/inner_api/ace_kit/include/ui/animation/animation_option.h @@ -202,6 +202,26 @@ public: return result; } + std::string ToSimpleString() const + { + std::stringstream ss; + ss << "dur:" << duration_ << ", curve:" + << (curve_ ? curve_->ToSimpleString() : ""); + if (iteration_ != 1) { + ss << ", iter:" << iteration_; + } + if (delay_) { + ss << ", delay:" << delay_; + } + if (!NearEqual(tempo_, 1.0f)) { + ss << ", tempo:" << tempo_; + } + if (direction_ != AnimationDirection::NORMAL) { + ss << ", mode:" << static_cast(direction_); + } + return ss.str(); + } + private: int32_t duration_ = 0; int32_t delay_ = 0; diff --git a/interfaces/inner_api/ace_kit/include/ui/animation/cubic_curve.h b/interfaces/inner_api/ace_kit/include/ui/animation/cubic_curve.h index 8df26d83284..2e729e8fdac 100644 --- a/interfaces/inner_api/ace_kit/include/ui/animation/cubic_curve.h +++ b/interfaces/inner_api/ace_kit/include/ui/animation/cubic_curve.h @@ -36,6 +36,7 @@ public: float MoveInternal(float time) override; const std::string ToString() override; + const std::string ToSimpleString() override; float GetX0() const { diff --git a/interfaces/inner_api/ace_kit/include/ui/animation/curve.h b/interfaces/inner_api/ace_kit/include/ui/animation/curve.h index 91ee1dbe476..4fbd74e520c 100644 --- a/interfaces/inner_api/ace_kit/include/ui/animation/curve.h +++ b/interfaces/inner_api/ace_kit/include/ui/animation/curve.h @@ -17,7 +17,9 @@ #define FOUNDATION_ACE_INTERFACES_INNER_API_ACE_KIT_INCLUDE_ANIMATION_CURVE_H #include +#include #include +#include #include "ui/base/ace_type.h" #include "ui/base/macros.h" @@ -27,6 +29,7 @@ namespace OHOS::Ace { class NativeCurveHelper; constexpr double SQUARE = 2.0; +constexpr int32_t PRECISION = 2; // The running time of the curve needs to be normalized to the interval of 0.0 to 1.0; // Relatively, the corresponding value of the curve also needs to be normalized to the interval of 0.0 to 1.0; @@ -52,6 +55,11 @@ public: return ""; } + virtual const std::string ToSimpleString() + { + return ""; + } + virtual bool IsEqual(const RefPtr& curve) const { return false; @@ -137,6 +145,11 @@ public: return curveString; } + const std::string ToSimpleString() override + { + return ToString(); + } + bool IsEqual(const RefPtr& curve) const override { return AceType::InstanceOf(curve); @@ -231,6 +244,11 @@ public: return curveString; } + const std::string ToSimpleString() override + { + return ToString(); + } + bool IsEqual(const RefPtr& curve) const override { auto other = AceType::DynamicCast(curve); @@ -273,6 +291,10 @@ public: { return "customCallback"; } + const std::string ToSimpleString() override + { + return ToString(); + } private: std::function interpolateFunc_; @@ -301,6 +323,15 @@ public: comma + std::to_string(blendDuration_) + std::string(")")); return curveString; } + const std::string ToSimpleString() override + { + const int32_t precision = 3; + std::stringstream ss; + std::string comma(","); + ss << "responsiveSpring(" << std::fixed << std::setprecision(precision) << response_ + << comma << dampingRatio_ << comma << blendDuration_ << ")"; + return ss.str(); + } bool IsEqual(const RefPtr& curve) const override { auto other = AceType::DynamicCast(curve); @@ -368,6 +399,15 @@ public: return curveString; } + const std::string ToSimpleString() override + { + std::stringstream ss; + std::string comma(","); + ss << "interSpring(" << std::fixed << std::setprecision(PRECISION) << velocity_ + << comma << mass_ << comma << stiffness_ << comma << damping_ << ")"; + return ss.str(); + } + bool IsEqual(const RefPtr& curve) const override { auto other = AceType::DynamicCast(curve); -- Gitee