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

[gl] Improved logging options in expo-gl #7550

Merged
merged 3 commits into from Apr 9, 2020

Conversation

tsapeta
Copy link
Member

@tsapeta tsapeta commented Mar 31, 2020

Why

#7502 reminded me that we should have better logging/debugging options for expo-gl as we don't log anything by default and, most importantly, we don't log any errors like all web browsers do.

How

  • Removed gl.enableLogging -> it isn't a part of WebGL specification so imho it should somehow indicate itself as Expo-specific. We don't need to deprecate it first as it wasn't documented.
  • Added gl.__expoSetLogging method which receives bitwise enum GLLoggingOption (check out tsdoc comments for more details).
  • Moved the code responsible for logging to separate file (called GLUtils, because I believe we can put more stuff there soon).
  • Slightly improved how WebGL objects are being stringified by us. Some of them were being logged as [object Object].
  • Added a few missing TypeScript property declarations.

Test Plan

Tested by adding gl.__expoSetLogging method call to NCL example and playing with some custom GLLoggingOption values.

@tsapeta tsapeta marked this pull request as ready for review March 31, 2020 17:06
@tsapeta tsapeta requested a review from bbarthec as a code owner March 31, 2020 17:06
@tsapeta tsapeta requested a review from wkozyra95 March 31, 2020 17:06

// Turn off logging.
if (!option || option === GLLoggingOption.DISABLED) {
Object.keys(gl).forEach(key => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not Object.entries 🤔 ?

}

// Turn on logging.
Object.keys(gl).forEach(key => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here: Object.entries?

@tsapeta tsapeta force-pushed the @tsapeta/gl-improved-logging branch from 882ffa5 to 514ccbe Compare April 9, 2020 10:48
@tsapeta tsapeta merged commit 3200409 into master Apr 9, 2020
@tsapeta tsapeta deleted the @tsapeta/gl-improved-logging branch April 9, 2020 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants