printLog method

  1. @override
void printLog(
  1. String logLine, {
  2. String? level,
})
override

Method to overload printing to output stream the formatted logLine Adds handing of time

Implementation

@override
void printLog(String logLine, {String? level}) {
  assert(printTimeType == DebugTree.timeClockType);
  final colorizeTransform = (level != null && useColors) ? _colorizeMap[level] : null;
  var date = DateTime.now().toIso8601String();
  var isFirst = true;
  logLine.split('\n').forEach((line) {
    var printableLine = line;
    if (isFirst) {
      isFirst = false;
      printableLine = '$date\t$line';
    }
    if (colorizeTransform != null) {
      debugPrint(colorizeTransform(printableLine));
    } else {
      debugPrint(printableLine);
    }
  });
}