Improvement: Reduce the amount of logging
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?
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.
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);
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.
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.
@OiYouYeahYou Okay another try :slightly_smiling_face: Could you comment out locally following lines:
https://github.com/prettier/plugin-pug/blob/998a192e7d1f5ba1af4f98aacf0448dbcc26364a/src/index.ts#L24
https://github.com/prettier/plugin-pug/blob/998a192e7d1f5ba1af4f98aacf0448dbcc26364a/src/printer.ts#L101
Then try again and tell me if it is still to noisy :smile:
Then you can still write something like manual console.log in the code, just the loggings get disabled.
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.
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 :thinking: 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 :thinking: :eyes:
Please feel free to create a PR and clean up or improve some of the logs. Then we can discuss about this further :slightly_smiling_face:
Monkey-patch for disabling debug logging can be found here: https://github.com/prettier/plugin-pug/issues/172#issuecomment-1135155782