export method

String export([
  1. LogQuery query = const LogQuery(),
  2. LogPattern? pattern
])

The records matching query as text, for sharing or copying to the clipboard: each record formatted with pattern, joined by line breaks.

The default pattern is %d{HH:mm:ss.SSS} %5p [%logger] %m%X%n%ex: the time without the date, the level, the logger, the message with its fields, and the error with its stack trace, without colours.

Implementation

String export([LogQuery query = const LogQuery(), LogPattern? pattern]) {
  final format =
      pattern ?? LogPattern('%d{HH:mm:ss.SSS} %5p [%logger] %m%X%n%ex');
  return [for (final record in this.query(query)) format.formatLine(record)]
      .join('\n');
}