-
Notifications
You must be signed in to change notification settings - Fork 8
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
Disable logging on startup #25
Comments
Hi, and apologies for the late response! I assume you're referring to MonoMod's logging, because HotAvalonia itself doesn't log that much (in fact, it logs too little, which is something worth improving on my side). While I agree that MonoMod's logging in this context is quite excessive, does it cause any actual issues for you, or is it more of a matter of taste? I could look into disabling it for the next release. For now, you can completely disable the MonoMod path by setting the |
Iam not sure, but startup time feels longer. is this correct? Environment.SetEnvironmentVariable("HOTAVALONIA_DISABLE_INJECTIONS", "1"); |
You are 100% correct. However, it's hardly because of logging; it's just MonoMod being MonoMod - it's a fully featured .NET injection engine, which is usually used for modding games, and it takes its sweet time to initialize everything it needs. I don't actually need injections for much. As you can see, HotAvalonia kinda functions even without those. Thus, I implemented the
Yup, that should do the trick. Just make sure to call it before HotAvalonia begins its initialization; otherwise, it will be too late. If you're launching your app from VSC, you can set the environment variable directly in |
Thank you for your work, it saves a lot of time working with avalonia. |
Thank you so much! It's always nice to hear that my work has helped somebody! :3 Also, I underestimated how slow logging (and string concatenation in general) can be. You were absolutely right - the startup time does take a significant hit due to the debug log spam. If I disable it: object? logger = Type.GetType("MonoMod.Logs.DebugLog, MonoMod.Utils").GetStaticField("Instance")?.GetValue(null);
logger?.GetType().GetInstanceField("globalFilter")?.SetValue(logger, 0); The demo app starts booting much, much faster, even when using MonoMod injections. So, yeah, I'll definitely include this in the next version, as MonoMod logs provide little to no value for HotAvalonia users and only slow down the startup process. Thanks for bringing this to my attention! |
Hello,
is it possible to remove the logging on app startup?
The text was updated successfully, but these errors were encountered: