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

How to use it with gdext? #78

Open
adaliszk opened this issue Apr 13, 2024 · 3 comments
Open

How to use it with gdext? #78

adaliszk opened this issue Apr 13, 2024 · 3 comments

Comments

@adaliszk
Copy link

Thank you for the excellent package!

Would it be possible to add documentation on using it with gdext, the 4.x version of the Godot rust bindings?
Sadly, the godot_init! macro is no longer available or has been moved elsewhere.

@jdno
Copy link
Owner

jdno commented Apr 29, 2024

Hi @adaliszk,

First of all, sorry for the late reply. I'm not working on a Godot project right now, so haven't checked out gdext yet.

Reading through the documentation, I think the right approach might be to create an editor plugin and autoloading the logger.

This sounds like a fun task to look into. I'll try to find some time to look into this, but I can't make any promises when it'll be done.

@sanpii
Copy link

sanpii commented May 15, 2024

I wrote a crate makes the same thing before discover your work.

Here how I initialize my logger:

struct Extension;

#[godot::init::gdextension]
unsafe impl godot::init::ExtensionLibrary for Extension {
    fn on_level_init(level: godot::init::InitLevel) {
        if level == godot::init::InitLevel::Core {
            godot_logger::init();
        }
    }
}

@sanpii
Copy link

sanpii commented May 16, 2024

#79

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

No branches or pull requests

3 participants