colorLine method
This method colors a line depending on its log level.
It checks if the line contains the label of a log level and colors it accordingly.
Implementation
@visibleForTesting
String colorLine(BDLevel level, String line) {
switch (level) {
case BDLevel.debug:
return ansi.blue.wrap(line) ?? line;
case BDLevel.info:
return ansi.white.wrap(line) ?? line;
case BDLevel.warning:
return ansi.yellow.wrap(line) ?? line;
case BDLevel.success:
return ansi.green.wrap(line) ?? line;
case BDLevel.error:
return ansi.red.wrap(line) ?? line;
}
}