Skip to content

Commit

Permalink
improve logs
Browse files Browse the repository at this point in the history
  • Loading branch information
irov committed Aug 28, 2023
1 parent 145c002 commit 27b8886
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -329,7 +329,7 @@ public void onComplete(@NonNull Task<GoogleSignInAccount> task) {

public boolean showAchievements() {
if (m_achievementsClient == null) {
this.logError("showAchievements achievements client not created");
this.logWarning("showAchievements achievements client not created");

return false;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -416,17 +416,19 @@ public boolean incrementAchievement(String achievementId, int numSteps) {
.addOnSuccessListener(new OnSuccessListener<Boolean>() {
@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);
}
}).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()
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,6 @@ private void removeSpash(@NonNull MengineActivity activity) {

m_image = null;

this.setState("splashscreen.state", "remove");
this.setState("splashscreen.state", "removed");
}
}
35 changes: 18 additions & 17 deletions src/Frameworks/PythonFramework/KernelScriptEmbedding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2023,26 +2023,26 @@ namespace Mengine
//////////////////////////////////////////////////////////////////////////
IntrusivePtr<NodeAffectorCreator::NodeAffectorCreatorInterpolateLinear<Color>> 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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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()
);

Expand All @@ -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<KernelScriptMethod> KernelScriptMethodPtr;
Expand Down
2 changes: 1 addition & 1 deletion src/Kernel/Node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);
}
Expand Down

0 comments on commit 27b8886

Please sign in to comment.