felangel / felangel/mason

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

Offen
#528 0 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
Dart
Sterne
1.1k
Forks
113
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.