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

Add additional Logging level functions to the logging module #1441

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

DJawna
Copy link

@DJawna DJawna commented Oct 22, 2024

This PR will add Log prioriyt dependent logging functions:

  • log_*

where * is: create, warning, error etc.

In addition to the message those new functions will take the Category as paraemter,
the Category needs to be converted to c_int, if that fails, Application value is taken and assumed it will be convertible to c_int.

src/sdl2/log.rs Outdated Show resolved Hide resolved
@Cobrand
Copy link
Member

Cobrand commented Oct 24, 2024

Thanks, I will have a look once you fix my comment. Also don't forget to run cargo fmt, I'm pretty sure it fails your PR as-is.

@Cobrand
Copy link
Member

Cobrand commented Oct 28, 2024

The closure thing is very messy, just use Priority and pattern matching to figure out which function to call, don't use closures like that, it's quite hard to read for very little gain.

function which accepts priority enum as parameter
@DJawna
Copy link
Author

DJawna commented Oct 28, 2024

The closure thing is very messy, just use Priority and pattern matching to figure out which function to call, don't use closures like that, it's quite hard to read for very little gain.

Now i have replaced all those function wrappers with the closures in them with just one single pub function which accepts the priority enum and matches it to invoke the unsafe sdl log functions

@Cobrand
Copy link
Member

Cobrand commented Oct 28, 2024

Much better. I think you can still add log_debug log_critical etc that are just calls to log_with_category inside for simplicity.

which call the generic logging function
@DJawna
Copy link
Author

DJawna commented Oct 28, 2024

Much better. I think you can still add log_debug log_critical etc that are just calls to log_with_category inside for simplicity.

Ok did that now!

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.

2 participants