Log icon indicating copy to clipboard operation
Log copied to clipboard

show script name, function name and line number in logs

Open adam-saudagar opened this issue 1 year ago • 1 comments

Description

Showing source of logs really helps to judge where exactly the logs are coming from

If relevant, describe linked issues: Closes #(issue)

Please also disclose whether there are any API changes that may effect users of the plugin.

#Checklist (replace space with X in the brackets to complete)

  • [x] I have made corresponding changes to the documentation if applicable.
  • [x] My code has passed the following test:
    • Reload the editor(Project->Reload current project), since godot plugins are fiddly and some errors only shows up after the plugin context has been reloaded.
    • run the res://tests/logtest.tscn scene.
    • This should produce several error messages, among one that halts the test execution and brings up the editor debugger.
    • press bild once.
    • Now this message bild should show in the engine log.
  • [x] I have correctly bumped the version in the config.cfg according to the following:
    • Has form x.y.z
    • x is bumped if API breaking changes is made, these are merged restrictively.
    • y is bumped if API is added upon or modified in a way that is backwards compatible.
    • z is bumped if bugs are fixed or only internal things are changed or rearranged that doesn't change the API at all.
    • Documentation changes or comments needs no version change.
    • Read more here if unclear.

adam-saudagar avatar Jan 19 '25 14:01 adam-saudagar

Your suggested features should be implemented in the new 2.0 - Alpha which is currently the main branch. You just have to make changes to the formatting settings in correspondence with the specs in settings.gd. (You can then call the constructor of LogStream with an empty string, since this wouldn't be displayed anyway in your case, it reads the class from the stack instead of from the script name as in your code) Note that the format setting has been split into one for each log level and that there is currently a bug where the formatting used one level below what is correct. So logging on level 'Warning' shows formatting for 'info' level. This will of course be fixed as soon as I've tracked the damn bug down (this is also the source of the weird print messages among the logs currently). If you want to, it would be great if you want to test this and see whether this version corresponds to your needs and give feedback on what you think.

albinaask avatar Feb 24 '25 22:02 albinaask