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

Integrate std::format into the logger #38

Closed
Rinzii opened this issue Aug 6, 2023 · 2 comments · Fixed by #48
Closed

Integrate std::format into the logger #38

Rinzii opened this issue Aug 6, 2023 · 2 comments · Fixed by #48
Labels
Issue: Feature Request This issue is a feature request. Issue: Improvement This issue relates to areas to improve.
Milestone

Comments

@Rinzii
Copy link
Owner

Rinzii commented Aug 6, 2023

I've noticed a significant pattern that appears quite often in the logger.

gen::logger::error("windowing", std::format("GLFW Error: {} - {}", error, description));

Where std::format is used near constantly so much so that it'd be nice to just remove the requirement of performing the above operation and instead being able to implement the code as follows.

gen::logger::error("windowing", "GLFW Error: {} - {}", error, description);

It would help out a lot to not have to use std::format directly and instead integrate the functionality into the logger to avoid bugs cropping up such as people forgetting to include format and also saving a lot of typing. ^^

@Rinzii Rinzii added Issue: Feature Request This issue is a feature request. Issue: Improvement This issue relates to areas to improve. labels Aug 6, 2023
@Rinzii Rinzii added this to the MVP milestone Aug 6, 2023
@karnkaul
Copy link
Collaborator

karnkaul commented Aug 7, 2023

This can certainly be done, but will be a lot more straightforward if we forego printing source location info, as that's obtained by virtue of being the last, defaulted argument, which isn't possible with Args... also being forwarded to std::format.

@Rinzii
Copy link
Owner Author

Rinzii commented Aug 7, 2023

This can certainly be done, but will be a lot more straightforward if we forego printing source location info, as that's obtained by virtue of being the last, defaulted argument, which isn't possible with Args... also being forwarded to std::format.

Honestly I’d say if we can implement this feature then using different means to handle source location is perfectly fine. Overall my mentality is using C++20 features is preferred but not required if they limit our abilities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Feature Request This issue is a feature request. Issue: Improvement This issue relates to areas to improve.
Projects
None yet
2 participants