From 27b8886ab857351b2c5639457ce54940982c7670 Mon Sep 17 00:00:00 2001 From: irov Date: Mon, 28 Aug 2023 18:45:55 +0300 Subject: [PATCH] improve logs --- .../MengineGoogleGameSocialPlugin.java | 28 ++++++++------- .../Mengine/Plugin/MAR/MengineMARPlugin.java | 3 +- .../MengineSplashScreenPlugin.java | 2 +- .../PythonFramework/KernelScriptEmbedding.cpp | 35 ++++++++++--------- src/Kernel/Node.cpp | 2 +- 5 files changed, 37 insertions(+), 33 deletions(-) diff --git a/gradle/plugins/GoogleGameSocial/src/main/java/org/Mengine/Plugin/GoogleGameSocial/MengineGoogleGameSocialPlugin.java b/gradle/plugins/GoogleGameSocial/src/main/java/org/Mengine/Plugin/GoogleGameSocial/MengineGoogleGameSocialPlugin.java index 97487067b6..ef6ea02981 100644 --- a/gradle/plugins/GoogleGameSocial/src/main/java/org/Mengine/Plugin/GoogleGameSocial/MengineGoogleGameSocialPlugin.java +++ b/gradle/plugins/GoogleGameSocial/src/main/java/org/Mengine/Plugin/GoogleGameSocial/MengineGoogleGameSocialPlugin.java @@ -107,7 +107,7 @@ public void onDestroy(MengineActivity activity) { public void startSignInIntent() { if (m_signInClient == null) { - this.logError("startSignInIntent google client not created"); + this.logWarning("startSignInIntent google client not created"); return; } @@ -123,7 +123,7 @@ public void startSignInIntent() { public void signOut() { if (m_signInClient == null) { - this.logError("signOut google client not created"); + this.logWarning("signOut google client not created"); return; } @@ -168,7 +168,7 @@ public void onSuccess(Void unused) { public void revokeAccess() { if (m_signInClient == null) { - this.logError("revokeAccess google client not created"); + this.logWarning("revokeAccess google client not created"); return; } @@ -201,13 +201,13 @@ public void onActivityResult(MengineActivity activity, int requestCode, int resu } if (result.isSuccess() == true) { - this.logMessage("resign"); + this.logMessage("onActivityResult resign"); GoogleSignInAccount account = result.getSignInAccount(); this.signInCallback(account); } else { - this.logMessage("login"); + this.logMessage("onActivityResult login"); Status status = result.getStatus(); @@ -244,14 +244,14 @@ public void onActivityResult(MengineActivity activity, int requestCode, int resu } private void signInCallback(GoogleSignInAccount account) { - this.logMessage("account sign in"); - if (account == null) { - this.logWarning("account == null"); + this.logWarning("signInCallback account == null"); return; } + this.logMessage("signInCallback"); + MengineActivity activity = this.getMengineActivity(); m_achievementsClient = Games.getAchievementsClient(activity, account); @@ -329,7 +329,7 @@ public void onComplete(@NonNull Task task) { public boolean showAchievements() { if (m_achievementsClient == null) { - this.logError("showAchievements achievements client not created"); + this.logWarning("showAchievements achievements client not created"); return false; } @@ -365,7 +365,7 @@ public void onFailure(@NonNull Exception e) { public boolean unlockAchievement(String achievementId) { if (m_achievementsClient == null) { - this.logError("unlockAchievement achievements client not created"); + this.logWarning("unlockAchievement achievements client not created"); return false; } @@ -402,7 +402,7 @@ public void onFailure(@NonNull Exception e) { public boolean incrementAchievement(String achievementId, int numSteps) { if (m_achievementsClient == null) { - this.logError("incrementAchievement achievements client not created"); + this.logWarning("incrementAchievement achievements client not created"); return false; } @@ -416,8 +416,9 @@ public boolean incrementAchievement(String achievementId, int numSteps) { .addOnSuccessListener(new OnSuccessListener() { @Override public void onSuccess(Boolean aBoolean) { - MengineGoogleGameSocialPlugin.this.logMessage("incrementImmediate complete achievementId: %s" + MengineGoogleGameSocialPlugin.this.logMessage("incrementAchievement complete achievementId: %s numSteps: %d" , achievementId + , numSteps ); MengineGoogleGameSocialPlugin.this.pythonCall("onGoogleGameSocialAchievementIncrementSuccess", achievementId); @@ -425,8 +426,9 @@ public void onSuccess(Boolean aBoolean) { }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { - MengineGoogleGameSocialPlugin.this.logError("incrementImmediate achievementId: %s error: %s" + MengineGoogleGameSocialPlugin.this.logError("incrementAchievement achievementId: %s numSteps: %d error: %s" , achievementId + , numSteps , e.getLocalizedMessage() ); diff --git a/gradle/plugins/MAR/src/main/java/org/Mengine/Plugin/MAR/MengineMARPlugin.java b/gradle/plugins/MAR/src/main/java/org/Mengine/Plugin/MAR/MengineMARPlugin.java index ee3f591d26..12d0e00ab0 100644 --- a/gradle/plugins/MAR/src/main/java/org/Mengine/Plugin/MAR/MengineMARPlugin.java +++ b/gradle/plugins/MAR/src/main/java/org/Mengine/Plugin/MAR/MengineMARPlugin.java @@ -611,8 +611,9 @@ public void onPayResult(int code, String msg) { this.pythonCall("onMarSDKPaySuccess", productId, orderId); } else { - this.logError("pay fail productId: %s" + this.logError("pay fail productId: %s [result %d]" , productId + , payResult ); this.pythonCall("onMarSDKPayFail", productId); diff --git a/gradle/plugins/SplashScreen/src/main/java/org/Mengine/Plugin/SplashScreen/MengineSplashScreenPlugin.java b/gradle/plugins/SplashScreen/src/main/java/org/Mengine/Plugin/SplashScreen/MengineSplashScreenPlugin.java index 33e39e878f..bbe2e4fcde 100644 --- a/gradle/plugins/SplashScreen/src/main/java/org/Mengine/Plugin/SplashScreen/MengineSplashScreenPlugin.java +++ b/gradle/plugins/SplashScreen/src/main/java/org/Mengine/Plugin/SplashScreen/MengineSplashScreenPlugin.java @@ -140,6 +140,6 @@ private void removeSpash(@NonNull MengineActivity activity) { m_image = null; - this.setState("splashscreen.state", "remove"); + this.setState("splashscreen.state", "removed"); } } \ No newline at end of file diff --git a/src/Frameworks/PythonFramework/KernelScriptEmbedding.cpp b/src/Frameworks/PythonFramework/KernelScriptEmbedding.cpp index 10e18f7f6f..8b4bac1b45 100644 --- a/src/Frameworks/PythonFramework/KernelScriptEmbedding.cpp +++ b/src/Frameworks/PythonFramework/KernelScriptEmbedding.cpp @@ -2023,26 +2023,26 @@ namespace Mengine ////////////////////////////////////////////////////////////////////////// IntrusivePtr> m_nodeAffectorCreatorInterpolateLinearColor; ////////////////////////////////////////////////////////////////////////// - uint32_t s_Node_colorTo( Node * _node, float _time, const Color & _color, const ConstString & _easingType, const pybind::object & _cb, const pybind::args & _args ) + UniqueId s_Node_colorTo( Node * _node, float _time, const Color & _color, const ConstString & _easingType, const pybind::object & _cb, const pybind::args & _args ) { MENGINE_ASSERTION_MEMORY_PANIC( _node, "_node is None" ); if( _node->isActivate() == false ) { - LOGGER_ERROR( "node '%s' is not activate" + LOGGER_WARNING( "node '%s' is not activate" , _node->getName().c_str() ); - return 0; + return INVALID_UNIQUE_ID; } if( _node->isAfterActive() == false ) { - LOGGER_ERROR( "node '%s' is not after activate" + LOGGER_WARNING( "node '%s' is not after activate" , _node->getName().c_str() ); - return 0; + return INVALID_UNIQUE_ID; } RenderInterface * render = _node->getRender(); @@ -2080,49 +2080,49 @@ namespace Mengine if( _node->isActivate() == false ) { - LOGGER_ERROR( "node '%s' after color stop is inactivate" + LOGGER_WARNING( "node '%s' after color stop is inactivate" , _node->getName().c_str() ); - return 0; + return INVALID_UNIQUE_ID; } const AffectorHubInterfacePtr & affectorHub = _node->getAffectorHub(); UniqueId id = affectorHub->addAffector( affector ); - if( id == 0 ) + if( id == INVALID_UNIQUE_ID ) { LOGGER_ERROR( "node '%s' invalid add affector" , _node->getName().c_str() ); - return 0; + return INVALID_UNIQUE_ID; } return id; } ////////////////////////////////////////////////////////////////////////// - uint32_t s_Node_alphaTo( Node * _node, float _time, float _alpha, const ConstString & _easingType, const pybind::object & _cb, const pybind::args & _args ) + UniqueId s_Node_alphaTo( Node * _node, float _time, float _alpha, const ConstString & _easingType, const pybind::object & _cb, const pybind::args & _args ) { MENGINE_ASSERTION_MEMORY_PANIC( _node, "_node is None" ); if( _node->isActivate() == false ) { - LOGGER_ERROR( "node '%s' is not activate" + LOGGER_WARNING( "node '%s' is not activate" , _node->getName().c_str() ); - return 0; + return INVALID_UNIQUE_ID; } if( _node->isAfterActive() == false ) { - LOGGER_ERROR( "node '%s' is not after activate" + LOGGER_WARNING( "node '%s' is not after activate" , _node->getName().c_str() ); - return 0; + return INVALID_UNIQUE_ID; } RenderInterface * render = _node->getRender(); @@ -2162,7 +2162,7 @@ namespace Mengine if( _node->isActivate() == false ) { - LOGGER_ERROR( "node '%s' after color stop is inactivate" + LOGGER_WARNING( "node '%s' after color stop is inactivate" , _node->getName().c_str() ); @@ -2173,17 +2173,18 @@ namespace Mengine UniqueId id = affectorHub->addAffector( affector ); - if( id == 0 ) + if( id == INVALID_UNIQUE_ID ) { LOGGER_ERROR( "node '%s' invalid add affector" , _node->getName().c_str() ); - return 0; + return INVALID_UNIQUE_ID; } return id; } + ////////////////////////////////////////////////////////////////////////// }; ////////////////////////////////////////////////////////////////////////// typedef IntrusivePtr KernelScriptMethodPtr; diff --git a/src/Kernel/Node.cpp b/src/Kernel/Node.cpp index 8ed6e36a55..cd8fa2188e 100644 --- a/src/Kernel/Node.cpp +++ b/src/Kernel/Node.cpp @@ -164,7 +164,7 @@ namespace Mengine if( this->isAfterActive() == false ) { - LOGGER_ERROR( "node '%s' invalid deactivate in 'activate state'" + LOGGER_WARNING( "node '%s' invalid deactivate in 'activate state'" , this->getName().c_str() ); }