sendPrefixedOutput method

void sendPrefixedOutput(
  1. String category,
  2. String prefix,
  3. String message
)

Sends an OutputEvent for message, prefixed with prefix and with message indented to after the prefix.

Assumes the output is in full lines and will always include a terminating newline.

Implementation

void sendPrefixedOutput(String category, String prefix, String message) {
  final indentString = ' ' * prefix.length;
  final indentedMessage =
      message.trimRight().split('\n').join('\n$indentString');
  sendOutput(category, '$prefix$indentedMessage\n');
}