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

Improvement: Reduce the amount of logging #269

Open
OiYouYeahYou opened this issue Aug 3, 2021 · 8 comments
Open

Improvement: Reduce the amount of logging #269

OiYouYeahYou opened this issue Aug 3, 2021 · 8 comments
Assignees
Labels
help wanted We are looking for community help type: enhancement Functionality that enhances existing features

Comments

@OiYouYeahYou
Copy link
Collaborator

OiYouYeahYou commented Aug 3, 2021

Having worked on this project a bit one thing I have to do when testing is to disable the custom logger. The logger works fine, but, it's just a fire hose of noise when I'm trying to debug. I get the feeling that the all the logging from past debugging sessions but have been inadvertently committed.

@Shinigami92 Would it be ok to remove some logging messages?

@Shinigami92 Shinigami92 added help wanted We are looking for community help type: enhancement Functionality that enhances existing features labels Aug 3, 2021
@Shinigami92
Copy link
Member

Do you have some suggestions how and what to do?

The debug logs are currently mostly helpful for me when fixing a new upcoming bug or implementing a new feature.

@OiYouYeahYou
Copy link
Collaborator Author

With the logging disabled the testing output is 150 lines long, with logging left in it is over 100k more lines. Which is incredibly noisy.

Solution wise, first is to strip out all but the most necessary logging calls in the repository. Then it's either not to commit more logging calls in the future or to use VSCode debugging that I've added in #271.

This is a request to you as a maintainer, not really a request for the repository itself. As you're a good 730 commits ahead of the next person you're the most important person to please. I won't be unhappy if you say no, but it is a pain point for new contributors who will get overloaded by the firehose output in tests.

Though there are some glaring logger calls that could be removed like:

logger.debug(this.currentLineLength);

@Shinigami92
Copy link
Member

If you are talking about tests, you should try yarn test --silent. This will mute the logging while running the tests.

Otherwise if you have a special test you want to perform, you can use either a path or a patter like so:

yarn test tests/options [--silent]
yarn test -t detect [--silent]

You can even combine path and pattern.


Please let me know if this was your case (testing). If so, you should benefit from my suggestions.
Otherwise please explain you situation.

@OiYouYeahYou
Copy link
Collaborator Author

No this is not a solution when I'm trying to also output with console.log and it gets flooded out by all the other outputs. npm test -- tests/indents alone leads to a base 7838 lines of output that I have to sift through before I even want to find the console.log outputs I'm looking for or adding in.

@Shinigami92 Shinigami92 self-assigned this Aug 4, 2021
@Shinigami92
Copy link
Member

@OiYouYeahYou Okay another try 🙂
Could you comment out locally following lines:

logger.setLogLevel(LogLevel.DEBUG);

logger.setLogLevel(LogLevel.DEBUG);

Then try again and tell me if it is still to noisy 😄
Then you can still write something like manual console.log in the code, just the loggings get disabled.

@OiYouYeahYou
Copy link
Collaborator Author

I have been doing something to that effect yes. But it's a short term solution to a long term problem. Which is why I've brought it up as an issue.

@Shinigami92
Copy link
Member

I have been doing something to that effect yes. But it's a short term solution to a long term problem. Which is why I've brought it up as an issue.

So yeah, I understand my points and your points.
I need to look up which debugs can be cleaned, and in addition I could introduce another level like trace. But I also need to find out if there is a way to add an env variable / terminal parameter to dynamically adjust the log-level.

On the other side 🤔 Until now I had no big issues ignoring the logs like with e.g. --silent and only using the logs when I need to test a special case. That let me think that my ideas to solve your problem is overengineering debugging for a formatter plugin 🤔 👀

Please feel free to create a PR and clean up or improve some of the logs.
Then we can discuss about this further 🙂

@broofa
Copy link

broofa commented May 23, 2022

Monkey-patch for disabling debug logging can be found here: #172 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted We are looking for community help type: enhancement Functionality that enhances existing features
Projects
None yet
Development

No branches or pull requests

3 participants