alexanderweiss / nova-prettier

Prettier extension for Nova
MIT License
35 stars 6 forks source link

Add an option to disable console.log #32

Closed biati-digital closed 3 years ago

biati-digital commented 3 years ago

Logs should only be used in development or for debug or to display error messages, as the community starts to grow we will see more extensions (hopefully), and using console.log will simply saturate the debug pane.

Screen Shot 2020-10-08 at 12 19 00

I know you can filter the debug pane results but when i'm developing an extension, every time i save, Nova reloads the extension and the filter is lost and again i see the logs of several extensions which is a little annoying.

So i think adding an option to enable or disable logs could be useful (for other developers)

Screen Shot 2020-10-08 at 12 12 12

alexanderweiss commented 3 years ago

That might indeed be useful. But also a little annoying. Did you report this with Panic. It might be nicer if they actually fix this.

biati-digital commented 3 years ago

Already reported several errors but never heard back, probably will take them months to fix other issues that are more important.

Anyway at least consider it for a future update, like i said, i think logs should only be used when necessary and not for every performed action as it will saturate the debug pane but i do understand that it's not a bug, just something annoying and probably not required to invest your time on this for now.

alexanderweiss commented 3 years ago

I started out logging only errors, but not every issue actually causes an error. So it can be very hard debugging some things people report. I'll look at this when I have time though.

biati-digital commented 3 years ago

I understand, you could use a function like this (just an idea) in your helpers file, this way you could add all the logs you need when developing the extension or if a user needs to see a complete log of every step in the process to help you locate possible errors.

function log(message = '') {
    if (nova.inDevMode() || nova.config.get('prettier.log')) {
        console.log(message);
    }
}

Anyway, awesome extension and using a separate process was a great idea, following your example for an extension i'm working on just using a slightly different method.

alexanderweiss commented 3 years ago

Yes! I was thinking about something like that. I’ll probably set the config to default to enable logging though if that’s okay 😃.

Cool! I could publish the JSON-RPC code as a package if that’s any help btw.

biati-digital commented 3 years ago

Not a problem at all, thank you for your time.

Yes, i think it will be really helpful to publish it as a package. i tried different methods but the separate process is the fastest, i've been trying it for a few days and it's working great.

alexanderweiss commented 3 years ago

The latest release (v1.8.0) now has an option to disable debug logging. Hope that helps!