Skip to content

Commit

Permalink
Replace all ax::print with AXLOGD,AXLOGI (#2032)
Browse files Browse the repository at this point in the history
  • Loading branch information
halx99 authored Jul 13, 2024
1 parent 11b8d28 commit 28013e9
Show file tree
Hide file tree
Showing 38 changed files with 268 additions and 268 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,8 @@ std::string StopActionsByFlagsTest::subtitle() const
class SpriteIssue14050 : public Sprite
{
public:
SpriteIssue14050() { ax::print("SpriteIssue14050::constructor"); }
virtual ~SpriteIssue14050() { ax::print("SpriteIssue14050::destructor"); }
SpriteIssue14050() { AXLOGD("SpriteIssue14050::constructor"); }
virtual ~SpriteIssue14050() { AXLOGD("SpriteIssue14050::destructor"); }
};

void Issue14050Test::onEnter()
Expand Down
32 changes: 16 additions & 16 deletions tests/cpp-tests/Source/ActionsTest/ActionsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ void ActionAnimate::onEnter()
_frameDisplayedListener = EventListenerCustom::create(AnimationFrameDisplayedNotification, [](EventCustom* event) {
auto userData = static_cast<AnimationFrame::DisplayedEventInfo*>(event->getUserData());

ax::print("target %p with data %s", userData->target, Value(userData->userInfo).getDescription().c_str());
AXLOGD("target {} with data {}", fmt::ptr(userData->target), Value(userData->userInfo).getDescription());
});

_eventDispatcher->addEventListenerWithFixedPriority(_frameDisplayedListener, -1);
Expand Down Expand Up @@ -1664,7 +1664,7 @@ void Issue1305::onEnter()

void Issue1305::print(Node* sender)
{
ax::print("This message SHALL ONLY appear when the sprite is added to the scene, NOT BEFORE");
AXLOGI("This message SHALL ONLY appear when the sprite is added to the scene, NOT BEFORE");
}

void Issue1305::onExit()
Expand Down Expand Up @@ -1728,22 +1728,22 @@ void Issue1305_2::onEnter()

void Issue1305_2::printLog1()
{
ax::print("1st block");
AXLOGD("1st block");
}

void Issue1305_2::printLog2()
{
ax::print("2nd block");
AXLOGD("2nd block");
}

void Issue1305_2::printLog3()
{
ax::print("3rd block");
AXLOGD("3rd block");
}

void Issue1305_2::printLog4()
{
ax::print("4th block");
AXLOGD("4th block");
}

std::string Issue1305_2::title() const
Expand Down Expand Up @@ -1841,14 +1841,14 @@ std::string Issue1327::subtitle() const

void Issue1327::logSprRotation(Sprite* sender)
{
ax::print("%f", sender->getRotation());
AXLOGD("{}", sender->getRotation());
}

// Issue1398
void Issue1398::incrementInteger()
{
_testInteger++;
ax::print("incremented to %d", _testInteger);
AXLOGD("incremented to {}", _testInteger);
}

void Issue1398::onEnter()
Expand All @@ -1857,7 +1857,7 @@ void Issue1398::onEnter()
this->centerSprites(0);

_testInteger = 0;
ax::print("testInt = %d", _testInteger);
AXLOGD("testInt = {}", _testInteger);

this->runAction(
Sequence::create(CallFunc::create(std::bind(&Issue1398::incrementIntegerCallback, this, (void*)"1")),
Expand All @@ -1873,7 +1873,7 @@ void Issue1398::onEnter()
void Issue1398::incrementIntegerCallback(void* data)
{
this->incrementInteger();
ax::print("%s", (char*)data);
AXLOGD("{}", (char*)data);
}

std::string Issue1398::subtitle() const
Expand All @@ -1892,14 +1892,14 @@ void Issue2599::onEnter()
this->centerSprites(0);

_count = 0;
ax::print("before: count = %d", _count);
AXLOGD("before: count = {}", _count);

ax::print("start count up 50 times using Repeat action");
AXLOGD("start count up 50 times using Repeat action");
auto delay = 1.0f / 50;
auto repeatAction = Repeat::create(
Sequence::createWithTwoActions(CallFunc::create([&]() { this->_count++; }), DelayTime::create(delay)), 50);
this->runAction(Sequence::createWithTwoActions(
repeatAction, CallFunc::create([&]() { ax::print("after: count = %d", this->_count); })));
repeatAction, CallFunc::create([&]() { AXLOGD("after: count = {}", this->_count); })));
}

std::string Issue2599::subtitle() const
Expand Down Expand Up @@ -2080,7 +2080,7 @@ void PauseResumeActions::onEnter()

this->schedule(
[&](float dt) {
ax::print("Pausing");
AXLOGD("Pausing");
auto director = Director::getInstance();

_pausedTargets = director->getActionManager()->pauseAllRunningActions();
Expand All @@ -2089,7 +2089,7 @@ void PauseResumeActions::onEnter()

this->schedule(
[&](float dt) {
ax::print("Resuming");
AXLOGD("Resuming");
auto director = Director::getInstance();
director->getActionManager()->resumeTargets(_pausedTargets);
_pausedTargets.clear();
Expand Down Expand Up @@ -2313,7 +2313,7 @@ void SequenceWithFinalInstant::onEnter()

bool called(false);
const auto f([&called]() -> void {
ax::print("Callback called.");
AXLOGD("Callback called.");
called = true;
});

Expand Down
14 changes: 7 additions & 7 deletions tests/cpp-tests/Source/BugsTest/Bug-1174.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ int check_for_error(Vec2 p1, Vec2 p2, Vec2 p3, Vec2 p4, float s, float t)
// Since float has rounding errors, only check if diff is < 0.05
if ((fabs(hitPoint1.x - hitPoint2.x) > 0.1f) || (fabs(hitPoint1.y - hitPoint2.y) > 0.1f))
{
ax::print("ERROR: (%f,%f) != (%f,%f)", hitPoint1.x, hitPoint1.y, hitPoint2.x, hitPoint2.y);
AXLOGE("ERROR: ({},{}) != ({},{})", hitPoint1.x, hitPoint1.y, hitPoint2.x, hitPoint2.y);
return 1;
}

Expand All @@ -72,7 +72,7 @@ bool Bug1174Layer::init()
//
// Test 1.
//
ax::print("Test1 - Start");
AXLOGD("Test1 - Start");
for (int i = 0; i < 10000; i++)
{
// A | b
Expand Down Expand Up @@ -111,12 +111,12 @@ bool Bug1174Layer::init()
ok++;
}
}
ax::print("Test1 - End. OK=%i, Err=%i", ok, err);
AXLOGI("Test1 - End. OK={}, Err={}", ok, err);

//
// Test 2.
//
ax::print("Test2 - Start");
AXLOGI("Test2 - Start");

p1 = Vec2(220, 480);
p2 = Vec2(304, 325);
Expand All @@ -127,12 +127,12 @@ bool Bug1174Layer::init()
if (Vec2::isLineIntersect(p1, p2, p3, p4, &s, &t))
check_for_error(p1, p2, p3, p4, s, t);

ax::print("Test2 - End");
AXLOGI("Test2 - End");

//
// Test 3
//
ax::print("Test3 - Start");
AXLOGI("Test3 - Start");

ok = 0;
err = 0;
Expand Down Expand Up @@ -179,7 +179,7 @@ bool Bug1174Layer::init()
}
}

ax::print("Test3 - End. OK=%i, err=%i", ok, err);
AXLOGI("Test3 - End. OK={}, err={}", ok, err);
return true;
}

Expand Down
8 changes: 4 additions & 4 deletions tests/cpp-tests/Source/BugsTest/Bug-14327.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,23 @@ void Bug14327Layer::update(float dt)

void Bug14327Layer::editBoxEditingDidBegin(ax::ui::EditBox* editBox)
{
ax::print("editBox %p DidBegin !", editBox);
AXLOGD("editBox {} DidBegin !", fmt::ptr(editBox));
}

void Bug14327Layer::editBoxEditingDidEndWithAction(ax::ui::EditBox* editBox,
ax::ui::EditBoxDelegate::EditBoxEndAction EditBoxEndAction)
{
ax::print("editBox %p DidEnd !", editBox);
AXLOGD("editBox {} DidEnd !", fmt::ptr(editBox));
}

void Bug14327Layer::editBoxTextChanged(ax::ui::EditBox* editBox, std::string_view text)
{
ax::print("editBox %p TextChanged, text: %s ", editBox, text.data());
AXLOGD("editBox {} TextChanged, text: {} ", fmt::ptr(editBox), text);
}

void Bug14327Layer::editBoxReturn(ui::EditBox* editBox)
{
ax::print("editBox %p was returned !", editBox);
AXLOGD("editBox {} was returned !", fmt::ptr(editBox));
}

#endif
6 changes: 3 additions & 3 deletions tests/cpp-tests/Source/BugsTest/Bug-422.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ void Bug422Layer::reset()
// and then a new node will be allocated occupying the memory.
// => CRASH BOOM BANG
auto node = getChildByTag(localtag - 1);
ax::print("Menu: %p", node);
AXLOGD("Menu: {}", fmt::ptr(node));
removeChild(node, true);
// [self removeChildByTag:localtag-1 cleanup:NO];

auto item1 = MenuItemFont::create("One", AX_CALLBACK_1(Bug422Layer::menuCallback, this));
ax::print("MenuItemFont: %p", item1);
AXLOGD("MenuItemFont: {}", fmt::ptr(item1));
MenuItem* item2 = MenuItemFont::create("Two", AX_CALLBACK_1(Bug422Layer::menuCallback, this));
auto menu = Menu::create(item1, item2, nullptr);
menu->alignItemsVertically();
Expand All @@ -76,7 +76,7 @@ void Bug422Layer::check(Node* t)
auto& children = t->getChildren();
for (const auto& child : children)
{
ax::print("%p, rc: %d", child, child->getReferenceCount());
AXLOGD("{}, rc: {}", fmt::ptr(child), child->getReferenceCount());
check(child);
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp-tests/Source/BugsTest/Bug-458/Bug-458.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,5 @@ bool Bug458Layer::init()

void Bug458Layer::selectAnswer(Object* sender)
{
ax::print("Selected");
AXLOGD("Selected");
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ bool QuestionContainerSprite::init()
label->setColor(Color3B::BLUE);
else
{
ax::print("Color changed");
AXLOGD("Color changed");
label->setColor(Color3B::RED);
}
a++;
Expand Down
4 changes: 2 additions & 2 deletions tests/cpp-tests/Source/BugsTest/Bug-624.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void Bug624Layer::switchLayer(float dt)

void Bug624Layer::onAcceleration(Acceleration* acc, Event* event)
{
ax::print("Layer1 accel");
AXLOGD("Layer1 accel");
}

////////////////////////////////////////////////////////
Expand Down Expand Up @@ -120,5 +120,5 @@ void Bug624Layer2::switchLayer(float dt)

void Bug624Layer2::onAcceleration(Acceleration* acc, Event* event)
{
ax::print("Layer2 accel");
AXLOGD("Layer2 accel");
}
2 changes: 1 addition & 1 deletion tests/cpp-tests/Source/BugsTest/Bug-914.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ bool Bug914Layer::init()

void Bug914Layer::onTouchesMoved(const std::vector<Touch*>& touches, Event* event)
{
ax::print("Number of touches: %d", (int)touches.size());
AXLOGD("Number of touches: {}", (int)touches.size());
}

void Bug914Layer::onTouchesBegan(const std::vector<Touch*>& touches, Event* event)
Expand Down
20 changes: 10 additions & 10 deletions tests/cpp-tests/Source/ConfigurationTest/ConfigurationTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void ConfigurationLoadConfig::onEnter()

Configuration::getInstance()->loadConfigFile("configs/config-test-ok.plist");
std::string config = Configuration::getInstance()->getInfo();
ax::print("%s\n", config.c_str());
AXLOGD("{}\n", config);
}

std::string ConfigurationLoadConfig::subtitle() const
Expand All @@ -70,8 +70,8 @@ void ConfigurationQuery::onEnter()
{
ConfigurationBase::onEnter();

ax::print("cocos2d version: %s", Configuration::getInstance()->getValue("axmol.version").asString().c_str());
ax::print("OpenGL version: %s", Configuration::getInstance()->getValue("gl.version").asString().c_str());
AXLOGD("axmol version: %s", Configuration::getInstance()->getValue("axmol.version").asString());
AXLOGD("OpenGL version: %s", Configuration::getInstance()->getValue("gl.version").asString());
}

std::string ConfigurationQuery::subtitle() const
Expand Down Expand Up @@ -107,21 +107,21 @@ void ConfigurationDefault::onEnter()

std::string c_value = Configuration::getInstance()->getValue("invalid.key", Value("no key")).asString();
if (c_value != "no key")
ax::print("1. Test failed!");
AXLOGD("1. Test failed!");
else
ax::print("1. Test OK!");
AXLOGD("1. Test OK!");

bool b_value = Configuration::getInstance()->getValue("invalid.key", Value(true)).asBool();
if (!b_value)
ax::print("2. Test failed!");
AXLOGD("2. Test failed!");
else
ax::print("2. Test OK!");
AXLOGD("2. Test OK!");

double d_value = Configuration::getInstance()->getValue("invalid.key", Value(42.42)).asDouble();
if (d_value != 42.42)
ax::print("3. Test failed!");
AXLOGD("3. Test failed!");
else
ax::print("3. Test OK!");
AXLOGD("3. Test OK!");
}

std::string ConfigurationDefault::subtitle() const
Expand All @@ -145,7 +145,7 @@ void ConfigurationSet::onEnter()
conf->setValue("this.is.a.string.value", Value("hello world"));

auto str = conf->getInfo();
ax::print("%s\n", str.c_str());
AXLOGD("{}\n", str);
}

std::string ConfigurationSet::subtitle() const
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp-tests/Source/ConsoleTest/ConsoleTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ void ConsoleUploadFile::uploadFile()
if (ret < 3)
{
// eof
ax::print("Reach the end, total send: %d bytes", (int)offset);
AXLOGD("Reach the end, total send: {} bytes", (int)offset);
break;
}
}
Expand Down
10 changes: 5 additions & 5 deletions tests/cpp-tests/Source/DataVisitorTest/DataVisitorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,21 @@ void PrettyPrinterDemo::onEnter()
// // print dictionary
// auto dict = __Dictionary::createWithContentsOfFile("animations/animations.plist");
// dict->acceptVisitor(visitor);
// ax::print("%s", visitor.getResult().c_str());
// ax::print("-------------------------------");
// AXLOGD("{}", visitor.getResult());
// AXLOGD("-------------------------------");
//
// __Set myset;
// for (int i = 0; i < 30; ++i) {
// myset.addObject(__String::createWithFormat("str: %d", i));
// }
// visitor.clear();
// myset.acceptVisitor(visitor);
// ax::print("%s", visitor.getResult().c_str());
// ax::print("-------------------------------");
// AXLOGD("{}", visitor.getResult());
// AXLOGD("-------------------------------");
//
// visitor.clear();
addSprite();
// dict = Director::getInstance()->getTextureCache()->snapshotTextures();
// dict->acceptVisitor(visitor);
// ax::print("%s", visitor.getResult().c_str());
// AXLOGD("{}", visitor.getResult());
}
2 changes: 1 addition & 1 deletion tests/cpp-tests/Source/LabelTest/LabelTestNew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1266,7 +1266,7 @@ LabelTTFFontsTestNew::LabelTTFFontsTestNew()
}
else
{
ax::print("ERROR: Cannot load: %s", ttfpaths[i]);
AXLOGE("ERROR: Cannot load: {}", ttfpaths[i]);
}
}
}
Expand Down
Loading

0 comments on commit 28013e9

Please sign in to comment.