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
Colors not working on iOS #1
Comments
Oh no, I didn't try it on iOS yet. Do you use Xcode or VSCode? |
I use both, but more often VSCode |
And do you see this problem in Xcode or VSCode? Xcode does not support colors but in VSCode it should work fine. |
I see this problem in both :( |
Okay thank you! I'll test it. |
I may take a little longer to fix this problem. In the meantime I added a parameter to the |
@leisim Any progress on that? Package is really useful, but the output becomes unreadable when debugging on iOS. |
I don't think XCode supports colors: https://stackoverflow.com/questions/40583721/print-to-console-log-with-color. |
Colors will never work in IDE terminals. None support ANSI escape codes. Passing |
That is not completely correct, |
I'm not sure why, but on one project the colors work perfectly, but on another, they don't work. I haven't figured out the difference yet. |
Has anyone figured this out? I went through this article and managed to get colors working in the Debug Console (Vscode MacOS). Seems the issue is related to bad escaping as suggested by @kuhnroyal. |
This seems to be an issue in the flutter library, not logger: flutter/flutter#20663 |
This issue is a bit complex, but we could solve it by changing logger/outputs/console_output.dart to below: import 'dart:io'; const bool _kReleaseMode = kReleaseMode; } |
Is there any news on this point? I'd love to have colored outputs using VSCode. Maybe there's a plugin to fix that? |
A plugin in VSCode that would enable ASNI colors would work indeed. |
Nice, This method successfully solves the problem of no color in iOS. You should save this file, and run again, then it will take effect. |
Thanks it works!! |
Thank you. It works 🚀 |
IMHO, not 100% clear, but you have to create an object of the class import 'dart:developer' as developer;
import 'package:flutter/foundation.dart';
import 'package:logger/logger.dart';
import 'package:universal_io/io.dart';
Logger logger = Logger(output: ConsoleOutput());
/// Extends 'LogOutput' to correctly display console colors on macOS systems.
///
/// The behavior is determined by the application's run mode (Release or Debug)
/// and the operating platform (iOS or non-iOS).
///
/// For more information, see: https://github.com/simc/logger/issues/1#issuecomment-1582076726
class ConsoleOutput extends LogOutput {
@override
void output(OutputEvent event) {
if (kReleaseMode || !Platform.isIOS) {
event.lines.forEach(debugPrint);
} else {
event.lines.forEach(developer.log);
}
}
} |
not sure why but this works, thanks! colors worked on android but not iOS. this fixes the logs on IOS. thanks
|
Hi!!
I try in iOS and the log show this:
The text was updated successfully, but these errors were encountered: