ansicolor-dart icon indicating copy to clipboard operation
ansicolor-dart copied to clipboard

not work on iOS (Android is fine)

Open orliu opened this issue 4 years ago • 2 comments

I got some logs like these on iOS:

flutter: ^[[38;5;246mI/17:21:00 flutter: ^[[38;5;246mI/17:21:00 flutter: ^[[38;5;246mI/17:21:00 flutter: ^[[38;5;246mI/17:21:00 flutter: ^[[38;5;246mI/17:21:00 flutter: ^[[38;5;246mI/17:21:00

flutter doctor: [✓] Flutter (Channel stable, 2.0.4, on Mac OS X 10.15.5 19F101 darwin-x64, locale en-AS) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2) [✓] Xcode - develop for iOS and macOS [✓] Android Studio (version 4.1) [✓] IntelliJ IDEA Ultimate Edition (version 2020.3.1) [✓] VS Code (version 1.55.2) [✓] Proxy Configuration [✓] Connected device (1 available)

flutter devices: (iphone 6p) Phone (mobile) • b6a915834fadb0f*********accbe869c39966e9f • ios • iOS 12.5.1

How can I solve this problem?

orliu avatar May 06 '21 09:05 orliu

Same issue

dourgulf avatar Dec 09 '21 02:12 dourgulf

@orliu One year later, did you manage to solve this?

petrnymsa avatar Oct 31 '22 09:10 petrnymsa

I have solved this issue

    const String RED = '\u001b[31m';
    const String GREEN = '\u001b[32m';
    const String YELLOW = '\u001b[33m';
    const String BLUE = '\u001b[34m';
    const String RESET = '\u001b[0m';
    
    if (Platform.isIOS) {
            String color;
            switch (log.logLevel) {
              case LogLevel.ERROR:
                color = RED;
                break;
              case LogLevel.FATAL:
                color = RED;
                break;
              case LogLevel.WARNING:
                color = YELLOW;
                break;
              case LogLevel.INFO:
                color = BLUE;
                break;
              case LogLevel.DEBUG:
              case LogLevel.TRACE:
                color = BLUE;
                break;
              default:
                color = '';
            }
            developer.log("$color${Formatter.format(log, _config)}$RESET");
   } else{
   // log using this package
   }
    

I am using custom logger and this works

@petrnymsa @dourgulf @orliu

Harishwarrior avatar May 29 '24 07:05 Harishwarrior

'\u001b[31m' is the 3bit color for ansi and the package uses 8bit color. This library was written a very long time ago; but I'm happy to take PRs.

jtmcdole avatar May 30 '24 04:05 jtmcdole

'\u001b[31m' is the 3bit color for ansi and the package uses 8bit color. This library was written a very long time ago; but I'm happy to take PRs.

I'll research more about this and create a PR. I wonder what is happening in iOS side which causes the issue.

Harishwarrior avatar May 30 '24 05:05 Harishwarrior

This issue does not affect the actual development work, it takes too long, so I will close it first

orliu avatar Jun 06 '24 02:06 orliu