Skip to content

[GEN][ZH] Fix and simplify trailing LF in most logging related functions and macros #1229

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

Closed

Conversation

xezon
Copy link

@xezon xezon commented Jul 5, 2025

This change fixes and simplifies the trailing new line "\n" in most logging related functions and macros. The trailing \n is now appended in the logging wrapper itself, and so user code no longer needs to add it. This makes it less error prone.

The only disadvantage is that it gives no finer control over calling DEBUG_LOG multiple times to write to the same log line. However, that is a rare use case. If such a log is needed in the future, we can add a new DEBUG_LOG_RAW macro or so.

Affected macros are:

  • DEBUG_LOG
  • DEBUG_LOG_LEVEL
  • DEBUG_CRASH
  • DEBUG_ASSERTLOG
  • DEBUG_ASSERTCRASH
  • RELEASE_CRASH
  • RELEASE_CRASHLOCALIZED
  • WWDEBUG_SAY
  • WWDEBUG_WARNING
  • WWRELEASE_SAY
  • WWRELEASE_WARNING
  • WWRELEASE_ERROR
  • WWASSERT_PRINT
  • WWDEBUG_ERROR
  • SNAPSHOT_SAY
  • SHATTER_DEBUG_SAY
  • DBGMSG
  • REALLY_VERBOSE_LOG
  • DOUBLE_DEBUG
  • PERF_LOG
  • CRCGEN_LOG
  • STATECHANGED_LOG
  • PING_LOG
  • BONEPOS_LOG

Some logging in WWVegas ended with \r\n (CR LF) which has been fixed as well.

Most log lines have been fixed with a script. Some lines have been fixed and polished by hand. I have labeled the commits accordingly.

@xezon xezon added Major Severity: Minor < Major < Critical < Blocker Refactor Edits the code with insignificant behavior changes, is never user facing Debug Is mostly debug functionality labels Jul 5, 2025
@xezon
Copy link
Author

xezon commented Jul 5, 2025

This review is quite a bit heavy. I can try to chunk the commits better.

@xezon
Copy link
Author

xezon commented Jul 5, 2025

I have reorganized the commits with new #1232. Closing this one.

@xezon xezon closed this Jul 5, 2025
@xezon xezon deleted the xezon/refactor-debuglog-newline branch July 5, 2025 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Debug Is mostly debug functionality Major Severity: Minor < Major < Critical < Blocker Refactor Edits the code with insignificant behavior changes, is never user facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DEBUG_LOG, DEBUG_CRASH & Co need their caller strings to end on "\n"
1 participant