felangel / felangel/mason

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

Ouverte
#528 0 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
bug
Langage dominant
Dart
Étoiles
1.1k
Forks
113
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.