Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bartekpacia opened this issue Sep 29, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@bartekpacia
Copy link

bartekpacia commented Sep 29, 2022

Description

printing when a progress is active doesn't look good

Steps To Reproduce

dart run the following file:

import 'package:mason_logger/mason_logger.dart';

Future<void> 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant