Skip to content
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

[Core] Add Engine.print_to_stdout setting to control printing #90955

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

AThousandShips
Copy link
Member

@AThousandShips AThousandShips commented Apr 20, 2024

Also added notes to the related project settings pointing to the Engine properties.

This essentially grants runtime control over the CoreGlobals.print_line_enabled flag, matching the application/run/disable_stdout project setting, and matching the existing print_error_messages.

Unsure about the exact naming for this, the global flag is called print_line_enabled but I don't think that's as clear, named it based on the project setting instead, but open to suggestions for different naming

The one possible concern I see (though already shared with disable_stdout) is that this would not be connected with the editor, an alternative name would be print_output

@@ -337,6 +337,10 @@
[b]Note:[/b] This property does not impact the editor's Errors tab when running a project from the editor.
[b]Warning:[/b] If set to [code]false[/code] anywhere in the project, important error messages may be hidden even if they are emitted from other scripts. In a [code]@tool[/code] script, this will also impact the editor itself. Do [i]not[/i] report bugs before ensuring error messages are enabled (as they are by default).
</member>
<member name="print_to_stdout" type="bool" setter="set_print_to_stdout" getter="is_printing_to_stdout" default="true">
If [code]false[/code], stops printing messages to the console and editor Output log. This property is equivalent to the [member ProjectSettings.application/run/disable_stdout] project setting.
[b]Note:[/b] This stops printing any errors or warnings produced by scripts to the Output log, but not to the console, for more details see [member print_error_messages].
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any suggestions for more details and wording here is welcome

Copy link
Member

@Calinou Calinou Jul 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The note seems to directly contradict the line just above it:

stops printing messages to the console and editor Output log.

This stops printing any errors or warnings produced by scripts to the Output log, but not to the console,

From my testing, stdout is disabled in all these 3 areas when this property is set to false:

  • Console
  • Editor output panel
  • File logging (as it's a byproduct of console output)

I would also mention file logging in this description since it's not currently mentioned.

Copy link
Member Author

@AThousandShips AThousandShips Jul 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will take a look, I think the meaning here is that messages, with print are blocked, but errors are still printed to the console, will confirm

The behavior is already that errors and warnings aren't printed in the editor log, but are printed to the error output, will improve wording

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be clearer now, also added a cross-ref to print

Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally, it works as expected (even if Disable Stdout is initially enabled in the project settings).

However, if you start the engine with the --quiet command line argument, the project can make itself "unquiet" at runtime. This is not necessarily a dealbreaker (use godot &> /dev/null or godot > NUL if you want a strict quiet mode), but it's worth documenting.

Testing project: test_pr_90955.zip

Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs look good to me.

@akien-mga akien-mga changed the title [Core] Add Engine.print_to_stout setting to control printing [Core] Add Engine.print_to_stdout setting to control printing Jul 17, 2024
Also added notes to the related project settings pointing to the
`Engine` properties.
@akien-mga akien-mga modified the milestones: 4.x, 4.4 Sep 23, 2024
@akien-mga akien-mga merged commit 8c273eb into godotengine:master Sep 23, 2024
19 checks passed
@AThousandShips AThousandShips deleted the print_to_stdout branch September 23, 2024 14:32
@akien-mga
Copy link
Member

Thanks!

@AThousandShips
Copy link
Member Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow setting "application/run/disable_stdout" at runtime
3 participants