fluttercommunity / fluttercommunity/flutter_launcher_icons

[BUG] printStatus not using configured logger

Open
#552 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
2.1k
Forks
426
PR merge metrics
No merged PRs in 30d

Description

### :information_source: Info

Version: `0.13.1`

### :speech_balloon: Description

```dart
void printStatus(String message) {
print('• $message');
}
```

`printStatus` will just print to the console even if another Logger is configured. This makes it hard to disable logs. For a dart script where we want to have control over the output. So we can show data to the user that is usefull.

This is the output I see:

```text
• Creating default icons Android
• Overwriting the default Android launcher icon with a new icon
• Creating mipmap xml file Android
• Overwriting default iOS launcher icon with new icon
```

with this code:

```
final flutterConfig = Config(
imagePath: 'app_icon.png',
android: true,
ios: true,
removeAlphaIOS: true,
);
await createIconsFromConfig(flutterConfig, FLILogger(false), '.');
```

**Expected behaviour:**

`printStatus` should use the FLILogger instead of using `print`.

It would also be nice to have the option to set a NoopLogger. (which I created myself to disable all logs)

```dart
class NoopLogger implements FLILogger {
NoopLogger();

@override
void error(Object? message) {}

@override
void info(Object? message) {}

@override
bool get isVerbose => false;

@override
Progress progress(String message) => NoopProgress(message);

@override
Logger get rawLogger => Logger.verbose();

@override
void verbose(Object? message) {}
}

class NoopProgress implements Progress {
final String _message;

late final DateTime _dateTime;

NoopProgress(this._message) {
_dateTime = DateTime.now();
}
@override
void cancel() {}

@override
Duration get elapsed => _dateTime.difference(DateTime.now());

@override
void finish({String? message, bool showTiming = false}) {}

@override
String get message => _message;
}

```

### :scroll: Pubspec.yaml

No dependencies.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.