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

Only show debug log in development mode #380

Merged
merged 19 commits into from
Dec 16, 2021
Merged

Only show debug log in development mode #380

merged 19 commits into from
Dec 16, 2021

Conversation

AndreasArvidsson
Copy link
Member

No description provided.

@AndreasArvidsson AndreasArvidsson added this to the 0.24.0 milestone Dec 11, 2021
Copy link
Member

@pokey pokey left a comment

Choose a reason for hiding this comment

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

As mentioned in review comment, I'd be hesitant to remove the debug logs without some way to re-enable them. They can be useful, eg for users to send us information, and I do use them when not in development mode sometimes as well to see parse tree, exact command, etc

src/extension.ts Outdated Show resolved Hide resolved
src/test/suite/recorded.test.ts Show resolved Hide resolved
@AndreasArvidsson AndreasArvidsson marked this pull request as draft December 15, 2021 09:08
@AndreasArvidsson AndreasArvidsson marked this pull request as ready for review December 15, 2021 10:08
Copy link
Member

@pokey pokey left a comment

Choose a reason for hiding this comment

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

Ok that looks a lot better, thanks. Left a few minor comments

src/core/Debug.ts Outdated Show resolved Hide resolved
src/core/Debug.ts Outdated Show resolved Hide resolved
src/core/Debug.ts Outdated Show resolved Hide resolved
src/core/Debug.ts Outdated Show resolved Hide resolved
src/core/Debug.ts Outdated Show resolved Hide resolved
src/core/Debug.ts Outdated Show resolved Hide resolved
src/core/Debug.ts Outdated Show resolved Hide resolved
src/extension.ts Show resolved Hide resolved
AndreasArvidsson and others added 3 commits December 16, 2021 18:55
Co-authored-by: Pokey Rule <pokey.rule@gmail.com>
Co-authored-by: Pokey Rule <pokey.rule@gmail.com>
Copy link
Member

@pokey pokey left a comment

Choose a reason for hiding this comment

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

Ok the last sticking points for me are:

  • What happens if you want to see the initial debug output? I guess maybe the answer is that if you really want that debug output you run extension in debugger? Mixed feelings
  • Worth confirming that this doesn't remove debug output from other extensions

@AndreasArvidsson
Copy link
Member Author

AndreasArvidsson commented Dec 16, 2021

  • Initial debug output is now enabled again. My view on it was that if you actually wanted debug logs you to use debug mode. I would not care to not even have a setting.
  • I don't know another extension with debug logs so I can't really test that. Guess I have to make one ;)

@AndreasArvidsson
Copy link
Member Author

I have just tested with another extension and we will disable debug logs for all extensions as it seems. The way around this is for cursorless to use its own logging function which we can disable.

@pokey
Copy link
Member

pokey commented Dec 16, 2021

I have just tested with another extension and we will disable debug logs for all extensions as it seems. The way around this is for cursorless to use its own logging function which we can disable.

Hmm. Yeah I'm definitely not in love with that. That's crazy that there's so little sand boxing between extensions. But does it disable it only when you call the other extension's function from cursorless, or always for that extension?

@AndreasArvidsson
Copy link
Member Author

I didn't call it from cursorless and still the debug log was disabled.

@AndreasArvidsson
Copy link
Member Author

Now we have our own debug logger which we can disable without affecting other extensions

src/core/Debug.ts Outdated Show resolved Hide resolved
private disableDebugLog() {
this.active = false;
if (this.disposableSelection) {
this.disposableSelection.dispose();
Copy link
Member

Choose a reason for hiding this comment

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

do we need to set this to null? or is it idempotent?

Copy link
Member Author

Choose a reason for hiding this comment

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

You shouldn't be able to end up in disable twice without having enabled in between. I tried toggling it back and forward without any problem.

Copy link
Member

Choose a reason for hiding this comment

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

no but the issue is that if the extension gets deactivated it will get called twice. probably not a big deal, but just being fastidious

Copy link
Member

Choose a reason for hiding this comment

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

eg if you enable log, then disable it, then deactivate extension

Comment on lines 113 to 114
this.graph.debug.log(err.message);
this.graph.debug.log(err.stack);
Copy link
Member

Choose a reason for hiding this comment

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

I'm tempted to make these just console.error, because that way we can catch the stack trace the first time an error occurs. WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was also thinking that.

Copy link
Member

@pokey pokey left a comment

Choose a reason for hiding this comment

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

Ok I left two more minor comments (as standalone comments above) but otherwise this looks great!

@AndreasArvidsson AndreasArvidsson merged commit 8884092 into main Dec 16, 2021
@AndreasArvidsson AndreasArvidsson deleted the debugLog branch December 16, 2021 22:07
@pokey pokey mentioned this pull request Jan 10, 2022
4 tasks
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.

2 participants