-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Misleading "USER ERROR:" prefix in logs when using Push Error #96086
Comments
I think we could rename "USER ERROR" to "SCRIPT ERROR". And optionally "ERROR" to "ENGINE ERROR". However, the later may be incorrect, since there are custom modules, GDExtension, etc. |
Hmm I would still prefer something more flexible, "SCRIPT ERROR" is definitely better but it still lacks the customization, I see that it would be a lot easier to change that for now. For me the best way would be to have a way of pushing the error without any prefix, but I get that for others that push errors without formatting it would be a downside. How about just "ERROR", but I guess that would be confusing with engine errors? or there could be a setting that allows the change of the prefix. |
I'm not sure customization is really needed here. The prefix serves to identify the message type, allowing engine and game developers to differentiate engine messages from custom errors/warnings. If you have a need to categorize your own messages, you can use a sub-prefix. |
IMO further customization is the realm of user-made logger scripts |
After reading the source, I realized that "SCRIPT ERROR" is already used. But we could replace "USER" with "CUSTOM" or something like that. Lines 56 to 93 in 28a72fa
|
I never really understood the point and the validity of the "USER" prefix. It seems to be added based on somewhat weird conditions which I'm not sure are what was intended. As you can see in the code, it adds CC @groud who implemented this back then IIRC. |
Yeah, Anyway, I think it can be removed, it's probably useless and confusing.
I was about to say it was not me, then checked with git blame. Turns out it was me. Typical: |
Yeah I agree that we can remove it. IIRC I had a quick look a while ago, and basically removing it means the whole Though depending on what's exposed, some care might be needed to not break compat. |
Hmm, I meant to just remove the |
Right indeed, out of the 35(!) files where this bool is passed along, it's used meaningfully in
and so it shouldn't be removed. |
Hello, I'm looking to start contributing to Godot to give back since I've been using it for a few smaller projects and am beginning my first major project with the engine. I saw this issue was marked as 'good first issue' and would like to give it a go to get used to the flow of contributing to Godot. (I have experience making PRs at work and to another open source project, and some experience with C++, but I am unfamiliar with SCons or the Godot internals.) My understanding from the discussion so far is that either:
Is one approach or the other preferable? An alternative option could potentially be to have the internal errors use an 'ENGINE' or 'INTERNAL' prefix, and leave developer emitted errors as just 'ERROR'/'WARNING'. I think that this approach could be clearer for a new or inexperienced user, rather than wondering where some |
This approach is the consensus so far. There's a few other places that need to be adjusted similarly, which add a "(User)" suffix to some in-editor messages:
|
I have drafted a PR #96168 and validated it works as expected for the case outlined in the original issue on macos.arm64. I do not have access to Windows so cannot test it on that platform. In the case of the In the three functions modified, the |
AFAIK it cannot be removed, these are virtual functions so they all need to have the same prototype, and the arguments is used in one of the more specific implementations (in |
Tested versions
System information
Godot v4.3.rc3.mono - Windows 10.0.19045 - Vulkan (Mobile) - dedicated NVIDIA GeForce GTX 1050 Ti (NVIDIA; 31.0.15.5123) - Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz (6 Threads)
Issue description
The issue
When using the GD.PushError() in C# or push_error in GDscript the logs created in debug/file_logging/log_path will include a misleading "USER ERROR:" prefix.
Better way
To allow developers to push different types of errors the prefix should be replaced with something more universal. For example just "ERROR:" (This is actually how it appears in the godot console) or no prefix at all. The best way in my opinion would be to allow the usage of PushError without any prefix, possibility to override the prefix or allowing customization of the prefix through settings.
Why it matters?
To players the error might suggest that it's their fault, while that's not always the case. I think that the prefix is supposed to seperate game developer errors from the godot engine errors, but for a player "USER ERROR:" prefix suggests that it's their fault. Same with developers not familiar with godot.
Changing the prefix and allowing the developers to customize the prefix or use the method without it would be great for better error logging experience for developers. It would allow better control over the presentation of developer errors. Maybe godot engine errors could have their own prefix to make them distinct from developer errors.
Why PrintError() is not a replacement of PushError
While it's true that PrintError doesn't print the "USER ERROR" prefix, it's not a replacement for PushError which prints debug information such as returning type, class, method, path, and line number, additionally the PushError appears in the debugger which futher helps when developing. PrintError doesn't do any of those. The debug info is what makes the PushError very useful.
I look forward to hearing feedback from others.
Thanks.
Steps to reproduce
Create a new project.
Create a node with a script using the GD.PushError() or push_error somewhere.
Run the project
Check the debug/file_logging/log_path log file
Minimal reproduction project (MRP)
N/A
The text was updated successfully, but these errors were encountered: