felangel / felangel/mason

fix(mason_logger) Gracefully handle printing new lines when `Progress` is spinning

Đang mở
#528 0 bình luận 1 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
Dart
Star
1.1k
Fork
113
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

**Description**

`print`ing when a progress is active doesn't look good

**Steps To Reproduce**

`dart run` the following file:

```dart
import 'package:mason_logger/mason_logger.dart';

Future main() async {
final log = Logger();

final progress = log.progress('Downloading file');

await Future.delayed(Duration(seconds: 1));

log.info('Text that appears when Progress is spinning');
print('Text that appears when Progress is spinning');
print('Text that appears when Progress is spinning');

await Future.delayed(Duration(seconds: 1));

progress.complete('Downloaded file');
}

```

```
$ dart run bin/demoapp.dart
⠹ Downloading file... (1.0s)Text that appears when Progress is spinning
Text that appears when Progress is spinning
Text that appears when Progress is spinning
✓ Downloaded file (2.0s)
```

**Expected Behavior**

```
$ dart run bin/demoapp.dart
Text that appears when Progress is spinning
Text that appears when Progress is spinning
Text that appears when Progress is spinning
✓ Downloaded file (2.0s)
```

I'd expect the spinner to either always "pop to the bottom" or stay on the line where it was originally printed. This would allow for printing more logs (for example, if the user of my CLI passed a `--verbose` option) while being nice and interactive.

A good example of a tool that handles this issue nicely is Gradle.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.