You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: CHANGELOG.md
+3
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,9 @@ Calling this API with a file path results in the `.editorconfig` files that will
27
27
28
28
### Changed
29
29
* Update Kotlin development version to `1.7.20` and Kotlin version to `1.7.20`.
30
+
* CLI options `--debug`, `--trace`, `--verbose` and `-v` are replaced with `--log-level=<level>` or the short version `-l=<level>, see [CLI log-level](https://pinterest.github.io/ktlint/install/cli/#logging). ([#1632](https://github.com/pinterest/ktlint/issue/1632))
31
+
* In CLI, disable logging entirely by setting `--log-level=none` or `-l=none` ([#1652](https://github.com/pinterest/ktlint/issue/1652))
`ktlint` supports different type of reporters. When not specified the `plain` reporter is used. Optionally the `plain` reporter can group the violations per file.
101
+
`ktlint` supports different type of reporters for lint violations. When not specified the `plain` reporter is used. Optionally the `plain` reporter can group the violations per file.
102
102
103
103
```shell title="Style violation grouped by file"
104
104
$ ktlint --reporter=plain?group_by_file
@@ -118,6 +118,12 @@ If resolving all existing errors in a project is unwanted, it is possible to cre
118
118
ktlint --baseline=ktlint-baseline.xml # Baseline is created when not existing
119
119
```
120
120
121
+
### Logging
122
+
123
+
Logging information is written to `stdout`. The amount of logging can be influenced by setting the minimal log level using option `--log-level` or `-l` to one of values `trace`, `debug`, `info`, `warn`, `error`, or `none` to suppress all logging.
124
+
125
+
By default, the `info` log level is used meaning that all log lines at level `info`, `warn` and `error` are shown while suppressing log lines at level `debug` or `trace`.
126
+
121
127
### Rule configuration (`.editorconfig`)
122
128
123
129
Some rules can be tweaked via the [`editorconfig file`](https://pinterest.github.io/ktlint/rules/configuration/).
With command below, the input is read from `stdin` and the violations are printed to `stderr`.
154
+
With command below, the input is read from `stdin` and the violations are printed to `stderr`. Logging is written to `stdout`.
149
155
150
156
```shell title="Lint from stdin"
151
157
ktlint --stdin
@@ -157,7 +163,8 @@ When combined with the `--format` option, the formatted code is written to `stdo
157
163
ktlint --stdin -F
158
164
```
159
165
160
-
!!! tip Suppress error output
166
+
!!! tip Suppress logging and error output
167
+
Logging output printed to `stdout` can be suppressed by setting `--log-level=none` (see [logging](#logging)).
161
168
Output printed to `stderr` can be suppressed in different ways. To ignore all error output, add `2> /dev/null` to the end of the command line. Otherwise, specify a [reporter](#error-reporting) to write the error output to a file.
162
169
163
170
@@ -192,8 +199,6 @@ ktlint installGitPrePushHook
192
199
`--patterns-from-stdin[=<delimiter>]`: Reads additional patterns from `stdin`, where the patterns are separated by `<delimiter>`. If `=<delimiter>` is omitted, newline is used as fallback delimiter. If an empty string is given, the `NUL` byte is used as delimiter instead.
193
200
Options `--stdin` and `--patterns-from-stdin` are mutually exclusive, only one of them can be given at a time.
194
201
195
-
`-v`, `--verbose` or `--debug`: Turn on debug output. Also option `--trace` is available, but this is meant for ktlint library developers.
196
-
197
202
`-V` or `--version`: Prints version information and exit.
0 commit comments