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

Ktlint 0.48.0 does not respect --log-level #1749

Closed
paul-dingemans opened this issue Dec 26, 2022 · 2 comments · Fixed by #1750
Closed

Ktlint 0.48.0 does not respect --log-level #1749

paul-dingemans opened this issue Dec 26, 2022 · 2 comments · Fixed by #1750
Milestone

Comments

@paul-dingemans
Copy link
Collaborator

In ktlint 0.48.0 it seems --log-level is not respected:

$ echo "class Foo {
fun foo() {}
}" | ktlint --log-level=fatal -F --stdin 2>/dev/null
08:48:35.907 [main] INFO com.pinterest.ktlint.internal.KtlintCommandLine - Enable default patterns [**/*.kt, **/*.kts]
class Foo {
    fun foo() {}
}

As a workaround I'm using a similar grep trick to the above, but if would be nice if we could suppress this and/or log to stderr.

Originally posted by @alex-shinn in #1652 (comment)

@paul-dingemans paul-dingemans added this to the 0.48.1 milestone Dec 26, 2022
paul-dingemans added a commit to paul-dingemans/ktlint that referenced this issue Dec 26, 2022
…ow exception when an invalid value is passed.

Closes pinterest#1749
@paul-dingemans
Copy link
Collaborator Author

Log level fatal is not recognized by the underlying logger. You would have need to use --log-level=none. But that one indeed does not work in 0.48.0 due change of moment when logger was initialized. Once #1750 has been merged, you can use the snapshot version (https://pinterest.github.io/ktlint/install/snapshot-build/) or wait until 0.48.1 is released.

@alex-shinn
Copy link

Thanks for the super quick fix! Yes, I had tried error and none as well with the same effect.

paul-dingemans added a commit that referenced this issue Dec 27, 2022
* Fix initialization of the logger when `--log-level` is specified. Throw exception when an invalid value is passed.

Closes #1749
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 a pull request may close this issue.

2 participants