Repository navigation
Modernize the dbgprint module and make it portable. - #523
Open
daliborfox wants to merge 11 commits into
Open
daliborfox wants to merge 11 commits into
daliborfox wants to merge 11 commits into
Conversation
|
Development builds of 0e6ec23:
The links work without a GitHub account. Artifacts expire after 90 days, and this comment follows the latest successful build. |
Member
|
Hey! Overall looks solid, but found a few things:
And we're now onto 0.3.0 so that needs updating :P |
…() calls to testcases.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request updates the dbgprint module so that it makes use of C++20 standard library facilities instead of Windows ones where possible, and allows the module to work on non-Windows systems, having been tested on Linux and Mac:
On Mac, the operating system version for the log banner is retrieved from the
SystemVersion.plistfile, on other systems the/etc/os-releaseor/usr/lib/os-releasefile is queried. The output ofuname -ais provided as a fallback in case those files don't exist.Reading the .plist file does require an additional dependency of
libxml2on Mac, though it's a part of the macOS SDK, so the user doesn't need to install any additional dependencies themselves when building OpenTS with this module (build system support not yet available).The default location for the logging directory is as follows:
<dir-with-game-exe>\Debug\~/Library/Logs/OpenTS/$XDG_STATE_HOME/OpenTS/, with a fallback of$HOME/.local/state/OpenTS/./OpenTS-Logs/A new feature is the ability to specify the desired location of the log file. If the
-USERDIR=<path>command-line option is specified, the logs will be located in the following directory:<USERDIR>/Debug/In order to gracefully use objects that dynamically allocate memory, the module holds its state in a lazy initialization singleton. This singleton contains an
m_DebugDestroyedflag that causes all of the module's functions to gracefully fail if they try to make use of the shared state after it's already had its destructor called by the C++ runtime.The same applies to the thread-local buffers used for holding the
vsnprintf()formatting data.As a consequence, there is a high likelihood that messages logged from the global destructors of other modules in the project will not end up being processed.
Another important thing to keep in mind is that the
Debug_Init()function call is now mandatory, as it's used to process the command-line options for whether or not to enable the console, and where to store the logs. It is permissible to callDebugString()beforeDebug_Init()is invoked, e.g. from global constructors, but the messages will only be displayed and/or written to the log file / sent to the debugger afterDebug_Init()had been invoked.Please let me know if you disagree if some of the things I've done, or see room for improvement! I've tried my best to polish things up, but it's always possible that I've missed something.