Skip to content
This repository was archived by the owner on Sep 16, 2025. It is now read-only.

feat: add default logger#41

Merged
qudix merged 4 commits intomainfrom
dev/qdx/logging
Sep 14, 2023
Merged

feat: add default logger#41
qudix merged 4 commits intomainfrom
dev/qdx/logging

Conversation

@qudix
Copy link
Copy Markdown
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.

@qudix qudix requested a review from gottyduke September 13, 2023 19:40
Comment thread CommonLibSF/src/SFSE/Logger.cpp
Comment thread CommonLibSF/src/SFSE/Logger.cpp Outdated
@gottyduke
Copy link
Copy Markdown
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
@ThirdEyeSqueegee ThirdEyeSqueegee deleted the dev/qdx/logging branch September 14, 2023 02:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants