Config Error Formatter
Renders a list of ConfigError instances into a human-readable, optionally ANSI-colored report.
Errors are grouped by their concrete type (e.g. InvalidValue, UnknownKey) and printed with their dot-separated paths highlighted. A trailing summary line counts how many fields fell back to default values due to ConfigError.OutOfRange or ConfigError.PatternMismatch.
Example output (with colors disabled for illustration):
3 config error(s) found in my-service:
[InvalidValue]
server.port: Invalid value 'abc', expected Int
[UnknownKey]
databse: Unknown key 'databse' - did you mean 'database'?
[OutOfRange]
server.maxThreads: Value 9999 is out of range [1.0, 512.0], fell back to 16
1 field(s) fell back to default values.Content copied to clipboard
Usage:
val formatter = ConfigErrorFormatter(useColors = true)
val report = formatter.format(collector.all(), configName = "my-service")
System.err.print(report)Content copied to clipboard
Since
1.0
Parameters
use Colors
When true (default), wraps error categories, paths, and summaries in ANSI escape codes. Set to false for log files or non-terminal output.