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

intelliJ console log problem in ios #179

Open
adamsocrat opened this issue Feb 2, 2024 · 12 comments
Open

intelliJ console log problem in ios #179

adamsocrat opened this issue Feb 2, 2024 · 12 comments
Labels
bug Something isn't working environment Issue related to environment

Comments

@adamsocrat
Copy link

adamsocrat commented Feb 2, 2024

Describe the bug
When debugging ios application the output to console always like this. Android is colored and looks usual.

To Reproduce
Intellij 2022 and later debug the application in ios

Expected behavior
Colored and formatted logs should be seeble.

Screenshots
image

Desktop (please complete the following information):

  • OS: MacOS Sonoma
  • Browser Chrome

Smartphone (please complete the following information):

  • Device: iPhone 15
  • OS: ios 17
  • Browser Stock

The image is from flutter_dio_logger but it is excatly the same case with .info, .warning and error states.

Regarding #104, yes I initialize like this

import 'package:talker_flutter/talker_flutter.dart';

final talker = TalkerFlutter.init();

before using initialization method it was the same characters like <..> in #104 after init, its like this.

  talker: ^4.0.0
  talker_flutter: ^4.0.0
  talker_dio_logger: ^4.0.0

Flutter: 3.16.9
Dart: 3.2.6

Flutter intellij Plugin: 77.2.2
Dart intellij plugin: 232.10286
@adamsocrat adamsocrat changed the title intelliJ console log problem intelliJ console log problem in ios Feb 2, 2024
@XanderD99
Copy link

XanderD99 commented Feb 2, 2024

Not necessarily an answer to your issue but under the hood talker uses log for iOS and mac and debugPrint for anything other then web, perhaps this is why it is not shown the way you expect in inteliJ.

So maybe pass a custom logger to your init function.

// 🎯 Dart imports:
import 'dart:developer';

// 🐦 Flutter imports:
import 'package:flutter/foundation.dart';

// 📦 Package imports:
import 'package:talker_flutter/talker_flutter.dart';

final talker = TalkerFlutter.init(
  logger: TalkerLogger(
    output: debugPrint, // or log
    settings: TalkerLoggerSettings(),
  ),
);

@adamsocrat
Copy link
Author

@XanderD99 thx. But both solution gives the same result, suprisingly.

@Abricoc
Copy link

Abricoc commented Feb 20, 2024

I have same problem. if you find solution please write his.

@WieFel
Copy link

WieFel commented Mar 11, 2024

I am having the same problem. Also after initialising using TalkerFlutter.init()

@bcihanc
Copy link

bcihanc commented Mar 21, 2024

same here

@Frezyx Frezyx added the bug Something isn't working label Mar 29, 2024
@sfcecy7i
Copy link

same here

@westito
Copy link
Contributor

westito commented May 6, 2024

Not necessarily an answer to your issue but under the hood talker uses log for iOS and mac and debugPrint for anything other then web, perhaps this is why it is not shown the way you expect in inteliJ.

So maybe pass a custom logger to your init function.

// 🎯 Dart imports:
import 'dart:developer';

// 🐦 Flutter imports:
import 'package:flutter/foundation.dart';

// 📦 Package imports:
import 'package:talker_flutter/talker_flutter.dart';

final talker = TalkerFlutter.init(
  logger: TalkerLogger(
    output: debugPrint, // or log
    settings: TalkerLoggerSettings(),
  ),
);

It is not helps because TalkerFlutter overwrites the output setting.

The solution:
Simply do not use TalkerFlutter! It doesn't do anything except that pipes output to log() instead of debugPrint() that actually causes the problem!
I think it was a solution for a problem in the past, but this factory went obsolete I think.

@eladrof
Copy link

eladrof commented May 22, 2024

Not necessarily an answer to your issue but under the hood talker uses log for iOS and mac and debugPrint for anything other then web, perhaps this is why it is not shown the way you expect in inteliJ.
So maybe pass a custom logger to your init function.

// 🎯 Dart imports:
import 'dart:developer';

// 🐦 Flutter imports:
import 'package:flutter/foundation.dart';

// 📦 Package imports:
import 'package:talker_flutter/talker_flutter.dart';

final talker = TalkerFlutter.init(
  logger: TalkerLogger(
    output: debugPrint, // or log
    settings: TalkerLoggerSettings(),
  ),
);

It is not helps because TalkerFlutter overwrites the output setting.

The solution: Simply do not use TalkerFlutter! It doesn't do anything except that pipes output to log() instead of debugPrint() that actually causes the problem! I think it was a solution for a problem in the past, but this factory went obsolete I think.

Unfortunately this doesn't work either
Tested on Android Studio Jellyfish | 2023.3.1 Patch 1

@westito
Copy link
Contributor

westito commented May 22, 2024

Yes, that's I wrote.

Solution is simply omit TalkerFlutter.init():

// Default settings:
final talker = Talker();

// OR: add custom settings
final talker = Talker(
  logger: TalkerLogger(
    settings: TalkerLoggerSettings(),
  ),
);

Details: #229

@eladrof
Copy link

eladrof commented May 22, 2024

@westito thanks for the fast response!
The solution you suggest improves the line format a little but still leaves these artifacts \^[[38;5;4m which I assume are related to console color codes
image

@westito
Copy link
Contributor

westito commented May 22, 2024

You sure! Sorry, my bad. I tried with macOS only. As you see, on macOS it is working (TalkerFlutter.init() uses log() instead of debugPrint()). But yes, on iOS it is not working.

Képernyőfotó 2024-05-22 - 14 32 07

Also, the log() call is not visible with run command.

Képernyőfotó 2024-05-22 - 14 35 54

However, on web console the colors are visible (both on iOS and macOS)

Képernyőfotó 2024-05-22 - 14 37 06

So, right now there is no solution I think. iOS escapes special control characters in log likely because security reasons. The intresting part is that log() uses Dart VM Service to print logs so I would think it is not go through iOS filters. But it is possible both logging uses stdout. I don't know how it works under the hood. A possible solution can be completely skip stdout and use Dart VM Service communication channel to send logs.

@eladrof
Copy link

eladrof commented May 22, 2024

@westito thanks again for looking into this!
And you are right, it appears to be an old, internal Flutter issue flutter/#64491

@Frezyx Frezyx added the environment Issue related to environment label Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working environment Issue related to environment
Projects
None yet
Development

No branches or pull requests

9 participants