Skip to content

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

Merged
xezon merged 14 commits intoTheSuperHackers:mainfrom
xezon:xezon/refactor-debuglog-newline-2
Jul 13, 2025
Merged

[GEN][ZH] Fix and simplify trailing CR LF in most logging related functions and macros#1232
xezon merged 14 commits intoTheSuperHackers:mainfrom
xezon:xezon/refactor-debuglog-newline-2

Conversation

@xezon
Copy link

@xezon xezon commented Jul 5, 2025

Merge with Rebase

This change fixes and simplifies the trailing Carriage Return \r and Line Feed \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 xezon force-pushed the xezon/refactor-debuglog-newline-2 branch from ec50c38 to 9a94f0f Compare July 5, 2025 14:28
@Skyaero42 Skyaero42 self-requested a review July 6, 2025 10:09
@Skyaero42
Copy link

I'll review this, although I'm not yet sure about the best approach consider its size

@xezon
Copy link
Author

xezon commented Jul 6, 2025

I mainly reviewed it by checking left-over \n and \r

@xezon xezon force-pushed the xezon/refactor-debuglog-newline-2 branch from 9a94f0f to 4ab3505 Compare July 7, 2025 17:29
@xezon
Copy link
Author

xezon commented Jul 7, 2025

Rebased with Main. Fixed some mixups in 2 commits.

@barefootlogician
Copy link

you can try generating the preprocessed files and diffing them. Assuming everything here is done correctly, they should be identical

Copy link

@Skyaero42 Skyaero42 left a comment

Choose a reason for hiding this comment

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

Some log entries contained double newline characters, which led to either a single lingering newline or completely blank log messages. Both cases are formatting artifacts and should be cleaned up to maintain log file consistency.

Hopefully I’ve tracked down all instances—fatigue was definitely setting in toward the end.

Choose a reason for hiding this comment

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

Remove lineend

Copy link
Author

Choose a reason for hiding this comment

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

I think EA placed this intentionally to make the log block stand out more.

Copy link
Author

Choose a reason for hiding this comment

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

Reverted.

@xezon xezon added this to the Code foundation build up milestone Jul 11, 2025
@xezon xezon force-pushed the xezon/refactor-debuglog-newline-2 branch from 4ab3505 to 485c085 Compare July 12, 2025 12:08
@xezon
Copy link
Author

xezon commented Jul 12, 2025

Rebased on Main.

I addressed all comments and some more.

I appended changes with fixup commits, which will be squashed later.

@xezon xezon requested a review from Skyaero42 July 12, 2025 12:22
@xezon
Copy link
Author

xezon commented Jul 13, 2025

I have tested that individual commits build.

@xezon xezon merged commit 1b1f576 into TheSuperHackers:main Jul 13, 2025
14 checks passed
xezon added a commit that referenced this pull request Jul 13, 2025
xezon added a commit that referenced this pull request Jul 13, 2025
xezon added a commit that referenced this pull request Jul 13, 2025
xezon added a commit that referenced this pull request Jul 13, 2025
…EBUG, PERF_LOG, CRCGEN_LOG, STATECHANGED_LOG, PING_LOG, BONEPOS_LOG strings with script (#1232)
@xezon xezon deleted the xezon/refactor-debuglog-newline-2 branch July 13, 2025 09:41
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Nov 10, 2025
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Nov 10, 2025
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Nov 10, 2025
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Nov 10, 2025
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Nov 10, 2025
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Nov 10, 2025
…EBUG, PERF_LOG, CRCGEN_LOG, STATECHANGED_LOG, PING_LOG, BONEPOS_LOG strings with script (TheSuperHackers#1232)
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Nov 10, 2025
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Nov 10, 2025
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Nov 10, 2025
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"

3 participants