Godot: Print errors to the debugger with GDScript's printerr function

Created on 4 May 2017  Â·  9Comments  Â·  Source: godotengine/godot

Issue description:

So, printerr currently doesn't do much. It simply logs the message to the console, not even to the built-in log, and I don't know about you, but I never check that console. And even if you do, you just won't spot your tiny little message between loads of other prints.
So my proposal is to make it log stuff to the debugger's error log, or at least to the editor log, maybe in red. (although that would be very hard to do)

enhancement core editor gdscript

Most helpful comment

Does the recently added push_error and push_warning @Gdscript methods solve this Issue?

All 9 comments

Speaking of output console in editor, I noticed that prints from tool scripts only show once I'm in-game (i.e. editor mode doesn't print).

Interesting... but that's pretty unrelated to the issue. You should open a
new one about that

  1. máj. 4 20:08 ezt írta ("Zireael07" notifications@github.com):

Speaking of output console in editor, I noticed that prints from tool
scripts only show once I'm in-game (i.e. editor mode doesn't print).

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/godotengine/godot/issues/8645#issuecomment-299264886,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHEndM05K94VKhWOqLBHwhFjwLi7Zcqwks5r2hQugaJpZM4NRAYF
.

Related to #6253, as it was mentioned there as well.

But that's about adding a whole new function which only works in debug mode.
BTW, In my opinion that has no point, since things can go wrong in a release too, and having a log is always a good thing.

Still valid in 3.0.2

I agree, I would like to be able to show errors to the user from my tool scripts, and this enhancement would enable me to do that

It looks like as of 3.0.6 printerr() _will_ print to the Output console in editor as well as to stderr. However, calling GD.PrintErr() from C# does not. For those interested, this has been recognized by the Mono team in issue #18969 as still outstanding.

Does the recently added push_error and push_warning @Gdscript methods solve this Issue?

As @willnationsdev said, one can now use push_error() and push_warning() to print messages to the Errors tab — these can be double-clicked to reach the line where they were printed. It should be possible to use it from C# as GD.PushError()/GD.PushWarning() too, but I haven't tested it (please open a new issue if it doesn't work).

printerr() only prints to standard error, which is useful in a few cases such as writing command-line applications but it won't look like an error by default.

Was this page helpful?
0 / 5 - 0 ratings