format method

  1. @override
String format(
  1. BDLogRecord record
)
override

Format the record to a String representation.

Implementation

@override
String format(final BDLogRecord record) {
  final DateFormat formatter = DateFormat('dd-MM-yyyy H:m:s');
  final String time = formatter.format(record.time);

  final StringBuffer buffer = StringBuffer()
    ..writeln()
    ..write(time)
    ..write(' ${record.level.label}: ${record.isFatal ? 'FATAL ' : ''}')
    ..write('${record.message} ');

  if (record.error != null) {
    buffer.writeln(record.error.toString());
  }
  if (record.stackTrace != null) {
    buffer
      ..writeln()
      ..writeln(record.stackTrace.toString());
  }

  return buffer.toString();
}