felangel / felangel/mason

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

未关闭
#528 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
Dart
星标
1.1k
派生
113
PR 合并指标
30 天内没有已合并 PR

描述

**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.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。