-
Notifications
You must be signed in to change notification settings - Fork 144
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 initialization option for replacing the internal logger with the Rust log
crate
#98
base: master
Are you sure you want to change the base?
Conversation
Going to have to look at this one more closely |
Hi, if you're still interested in working on this, some users of the library are moving over to a fork of it which aims to be actively maintained. It would be nice if you reopened the PR there! |
I actually looked into this myself, this seems like an extremely promising feature. But I think we should instead make a safe binding to |
Hi @IoIxD I've been maintaining my own similar (with very different goals) rust library for a while now. https://github.com/ewpratten/raylib-ffi Optional logging hooks is next on my personal feature list for it actually. Feel free to make use of my code in this PR for the new fork of this repo if you'd like. I don't mind at all. If you have further questions or comments or anything, feel free to reach out to me. I don't really keep an eye on the comment notifications for this repo, its actually a coincidence that I happened to glance at my screen when this GitHub notification came through 😆 |
Thanks! |
@IoIxD if you do make use of my work, I'd appreciate you @ mentioning me in the commit / PR, just so I can see what you end up doing with it. I'm curious 🙂 |
I'm probably gonna redo the commit, actually, to make a safe/public binding to the original function so that other users can use their own custom logger. I'll mention this in the PR though. |
ya, of course! Thanks |
* partial android support * remove `RAYMATH_STATIC_INLINE`
This fixes #94, and supersedes #95
There is no need to link extra C code for replacing the internal logger when Rust is FFI-compatible in both directions.
This PR adds a new function (
RaylibBuilder::replace_logger()
) that, when called, will redirect all raylib log messages through calls to thelog
crate. In my particular use case, I am using this to further pass through Tokio'stracing
crate, but it can be really used for anything.Limitations
For now, I have artificially limited this (with a
cfg
macro) to only happen on Linux (it will just silently not replace the logger on other platforms) due to MSVC throwing a fit about__va_list_tag
not existing (presumably sincestdarg.h
doesn't seem to be standard across compilers). I don't currently have the time to debug this on windows, and don't have the resources to compile it on macos.This is the first of a small handful of PRs you will see from me, since it is the weekend of Ludum Dare 49, and my team is once again building our entry with this crate.
It also happens to be the month of hacktoberfest. I would appreciate if you could tag this PR as
hacktoberfest-accepted
weather or not it gets merged so it can count towards my total. More info on hacktoberfest can be found here.