-
-
Notifications
You must be signed in to change notification settings - Fork 49
Description
Is your feature request related to a problem? Please describe.
We can easily add logging helpers for scripts via something like:
NamespaceBuilder::<GlobalNamespace>::new_unregistered(app.world_mut())
.register("info", |s: String| info!("{}", s))However, this will log the lambda as the call site. If you have a lot of scripts, knowing where a log came from would be very useful (even just the filename would help a lot). You can override the call site by providing a target to info!, but currently there doesn't appear to be any metadata available for where the call came from in the script.
Describe the solution you'd like
Pass the filename and line number of the lua call site via FunctionCallContext (or similar).
Describe alternatives you've considered
Potentially, you could maybe implement this in lua. A quick search indicates debug.getinfo provides this, but debug doesn't seem to be present via BMS. Assuming you could get something to work in pure lua, it would also be nice to have it be present without needing to include it in every script.