Skip to content
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

feat: add default logger #41

Merged
merged 4 commits into from
Sep 14, 2023
Merged

feat: add default logger #41

merged 4 commits into from
Sep 14, 2023

Conversation

qudix
Copy link
Contributor

@qudix qudix commented Sep 13, 2023

When SFSE::Init is used, it will now initialize a default spdlog logger.

SFSE::Init(a_sfse); // default log file will be automatically created

This behavior can be turned off by passing false as the optional second argument:

SFSE::Init(a_sfse, false); // default log file is disabled

...if you have no need for a log file at all. Keep in mind that this sets the default logger for the module (plugin), you can still modify it's behavior through the spdlog api, such as setting the level, or the pattern.

Some keen eyed may notice that I am also registering an msvc sink, this will not impact performance as spdlog as of a somewhat recent version now checks if a debugger is attached, and if not, the sink is essentially a no-op, with no real cost to performance.

You can test this pr with the xmake template by specifying the dev/qdx/logging branch.

@gottyduke
Copy link
Contributor

Thank you for the addition, std::format is definitely worth switching to, considering that po3 also PR'd std::format counterpart when they added the FORM_TYPE formatter, so there's nothing stopping us from doing so.
fmt on the other hand, sometimes deliver aggresive updates and since we never pinned our dependency, this introduces incompatibilities with our setup, which had happened multiple times in the past, from CommonLibSSE and the recent 10.1 with /utf-8 change.

@qudix qudix merged commit 5bd5ee1 into main Sep 14, 2023
3 checks passed
@ThirdEyeSqueegee ThirdEyeSqueegee deleted the dev/qdx/logging branch September 14, 2023 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants