highlightLine static method
Implementation
static String highlightLine(String line) {
return line.replaceAllMapped(
RegExp(r'\[(.*?)\]|\((.*?)\)|<(.*?)>'),
(match) {
if (match.group(1) != null) {
// Содержимое квадратных скобок - синий (severity)
return '${ConsoleColors.blue}${match.group(1)}${ConsoleColors.reset}';
} else if (match.group(2) != null) {
// Содержимое круглых скобок - зеленый (timestamp)
return '${ConsoleColors.green}${match.group(2)}${ConsoleColors.reset}';
} else {
// Содержимое угловых скобок - красный (userAgent)
return '${ConsoleColors.red}${match.group(3)}${ConsoleColors.reset}';
}
},
);
}