Skip to content

Make debug and verbose level logging in release builds optional #2006

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 27, 2024

Conversation

rh101
Copy link
Contributor

@rh101 rh101 commented Jun 27, 2024

Describe your changes

By default, AXLOGD and AXLOGV will be disabled in release builds.

Issue ticket number and link

#2005

Checklist before requesting a review

For each PR

  • Add Copyright if it missed:
    - "Copyright (c) 2019-present Axmol Engine contributors (see AUTHORS.md)."

  • I have performed a self-review of my code.

    Optional:

    • I have checked readme and add important infos to this PR.
    • I have added/adapted some tests too.

For core/new feature PR

  • I have checked readme and add important infos to this PR.
  • I have added thorough tests.

@halx99 halx99 linked an issue Jun 27, 2024 that may be closed by this pull request
@halx99 halx99 added the enhancement New feature or request label Jun 27, 2024
@halx99 halx99 merged commit 042c9b7 into axmolengine:dev Jun 27, 2024
15 checks passed
@rh101 rh101 deleted the optional-debug-logging branch June 27, 2024 16:10
@@ -139,8 +139,20 @@ inline void printLogT(_FmtType&& fmt, LogItem& item, _Types&&... args)
#define AXLOG_WITH_LEVEL(level, fmtOrMsg, ...) \
ax::printLogT(FMT_COMPILE("{}" fmtOrMsg "\n"), ax::preprocessLog(ax::LogItem{level}), ##__VA_ARGS__)

#define AXLOGV(fmtOrMsg, ...) AXLOG_WITH_LEVEL(ax::LogLevel::Verbose, fmtOrMsg, ##__VA_ARGS__)
#define AXLOGD(fmtOrMsg, ...) AXLOG_WITH_LEVEL(ax::LogLevel::Debug, fmtOrMsg, ##__VA_ARGS__)
#if defined(_AX_DEBUG) && _AX_DEBUG > 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The defined(_AX_DEBUG) part is not necessary, it could be written as just #if _AX_DEBUG > 0. In this case if _AX_DEBUG is not defined it's converted to 0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course! Since it's still correct as-is, we can leave it in there until some other changes need to be done, and address it then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support removal of debug logging calls from builds
3 participants