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

Is there a way to disable DEBUG logs that get printed at the start? #1412

Closed
lalunamel opened this issue Mar 15, 2022 · 2 comments · Fixed by #1413
Closed

Is there a way to disable DEBUG logs that get printed at the start? #1412

lalunamel opened this issue Mar 15, 2022 · 2 comments · Fixed by #1413
Labels
bug cli ktlint command line interface
Milestone

Comments

@lalunamel
Copy link

lalunamel commented Mar 15, 2022

When I run ktlint 0.44.0 on a file, the first lines of output look to be debug logs.

For example:

❯ ktlint myFile.kt
11:13:05.636 [main] DEBUG com.pinterest.ktlint.Main - Discovered reporter with "baseline" id.
11:13:05.637 [main] DEBUG com.pinterest.ktlint.Main - Discovered reporter with "checkstyle" id.
11:13:05.637 [main] DEBUG com.pinterest.ktlint.Main - Discovered reporter with "json" id.
11:13:05.637 [main] DEBUG com.pinterest.ktlint.Main - Discovered reporter with "html" id.
11:13:05.637 [main] DEBUG com.pinterest.ktlint.Main - Discovered reporter with "plain" id.
11:13:05.637 [main] DEBUG com.pinterest.ktlint.Main - Discovered reporter with "sarif" id.
11:13:05.638 [main] DEBUG com.pinterest.ktlint.Main - Initializing "plain" reporter with {verbose=false, color=false, color_name=DARK_GRAY}
myFile.kt:1:1: File must end with a newline (\n)
11:13:06.422 [main] DEBUG com.pinterest.ktlint.Main - 1007ms / 1 file(s) / 1 error(s)

Is there a way to disable printing these logs?
As you can see from the invocation of ktlint, I'm not passing in the --debug flag nor the --verbose flag.

Since I'm not passing these flags in, I'd expect the invocation of ktlint to just produce something like

❯ ktlint myFile.kt
myFile.kt:1:1: File must end with a newline (\n)

I've implemented ktlint as a precommit hook for our team, and I'd like to make sure the output is as easy to read and act on as possible so that my teammates are less likely to get annoyed and more likely to believe that having a linter is a good idea.

If I do a search for some of those log lines, I can see that others experience this same thing.

@lalunamel
Copy link
Author

lalunamel commented Mar 15, 2022

Looking at the implementation that probably generated these log lines, it appears they're created by a call to logger.debug, which I'd expect would only actually print something if the --debug flag was passed in.

paul-dingemans added a commit to paul-dingemans/ktlint that referenced this issue Mar 16, 2022
… parsed. Also, propagate the log level correctly to the KLogger.

Closes pinterest#1412
@paul-dingemans paul-dingemans added bug cli ktlint command line interface labels Mar 16, 2022
@paul-dingemans paul-dingemans added this to the 0.45.0 milestone Mar 16, 2022
paul-dingemans added a commit that referenced this issue Mar 16, 2022
… parsed. Also, propagate the log level correctly to the KLogger. (#1413)

Closes #1412
@lalunamel
Copy link
Author

Thanks Paul!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cli ktlint command line interface
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants