-
-
Notifications
You must be signed in to change notification settings - Fork 21k
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
[WIP] Add logging support #31333
[WIP] Add logging support #31333
Conversation
Opening this early so I can get early feedback. What do you think about the goals of this patch? I'm also curious to what extent (if any) this should use the existing |
You may be able to use and improve on this function for timestamps. get_iso_date_time |
As a stretch goal, maybe we could have a setting to output all logging messages as JSON. This would be useful to feed a dedicated server's console output to a log aggregation tool such as Loki. |
Sounds fairly straightforward, assuming there's already a way to write JSON to a text file? |
@mitchcurtis You would just need to print the JSON to standard output (one JSON object per line, that is). Writing to a file should be handled by writing that standard output to a file, as is already done by the Logging > File Logging > Enable File Logging project setting. |
Is there a way I can suppress the notifications for reviewers until I'm ready? I still have a lot of work to do... perhaps I should have just kept this as a branch on my fork. :x Edit: there are drafts, but you can't convert a regular pull request to a draft, only the other way around: https://github.saobby.my.eu.orgmunity/t5/How-to-use-Git-and-GitHub/Feature-Request-Switch-from-ready-to-draft-in-pull-requests/td-p/19107/page/2 |
The goal for logging in GDScript is to have as minimal overhead as possible in debug builds. These new functions only execute their arguments (expressions) passed to them if Godot was built in debug.
@bojidar-bg do you know why I'd be getting this warning:
for this:
I can see logging output in Creator's output panel, but not in Godot's. |
} | ||
|
||
if (args.size() != 2) { | ||
_set_error("debug_log expects two arguments: category and message"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember to update the messages to remove references to debug_log
and instead refer to the correct logging function 🙂
@mitchcurtis Is this still desired? If so, it needs to be rebased on the latest master branch. Also, the above feedback should be addressed. Also, since this PR is a feature proposal, you should consider opening a proposal which explains example use cases and how this approach will solve the problem. Otherwise, abandoned pull requests will be closed in the future as announced here. |
This patch adds a debug_log() function (log() was taken; the name is up for discussion) to GDScript. The goals are to:
Closes #27958.