Coder Social home page Coder Social logo

Comments (16)

SharbelOkzan avatar SharbelOkzan commented on June 30, 2024 2

Any updates/workaround?

from talker.

nikhil7299 avatar nikhil7299 commented on June 30, 2024

@Frezyx I was using talker_logger to log Riverpod 2 state changes using the Provider Observer State Logger from official Riverpod 2 docs. Where I realized that iOS builds does not show colors in debug console. So I internally replaced the "print" with "devtools.log". Then It started working.

from talker.

arhamsc avatar arhamsc commented on June 30, 2024

@nikhil7299 in Talker_Flutter.init(), the log method for iOS is debug log, as per my inspection of the package. If you could share which file you changed it would help me produce a similar outcome as yours.

from talker.

nikhil7299 avatar nikhil7299 commented on June 30, 2024

I just replaced print to devtools.log inside logger.dart in talker_logger like this -

Previous Code :-

import 'package:talker_logger/talker_logger.dart';

class TalkerLogger {
  TalkerLogger({
    this.settings = const TalkerLoggerSettings(),
    LoggerFilter? filter,
    this.formatter = const ExtendedLoggerFormatter(),
    void Function(String message)? output,
  }) {
    // ignore: avoid_print
    _output =
        output ?? (String message) => message.split('\n').forEach(print);
    _filter = filter ?? LogLevelFilter(settings.level);
    ansiColorDisabled = false;
  }
...

New Code :-

import 'package:talker_logger/talker_logger.dart';
import 'dart:developer' as devtools;

class TalkerLogger {
  TalkerLogger({
    this.settings = const TalkerLoggerSettings(),
    LoggerFilter? filter,
    this.formatter = const ExtendedLoggerFormatter(),
    void Function(String message)? output,
  }) {
    // ignore: avoid_print
    _output =
        output ?? (String message) => message.split('\n').forEach(devtools.log);
    _filter = filter ?? LogLevelFilter(settings.level);
    ansiColorDisabled = false;
  }
...

=> Also run in debug mode as devtool log works in debug mode.

from talker.

arhamsc avatar arhamsc commented on June 30, 2024

Did you check TalkerFlutter.init(), source code? It is actually similar to this. But when I used that started for a few times it was printing fine but suddenly it stopped printing.

from talker.

Frezyx avatar Frezyx commented on June 30, 2024

Hello @arhamsc !
Can you provide your code example ?

I'm using talker_flutter: 3.2.10 version in my projects and my logs console is colored as it should be

from talker.

arhamsc avatar arhamsc commented on June 30, 2024

@Frezyx
Sorry for the late reply, but the code is as follows:

 _talker = TalkerFlutter.init();

I tried doing what @nikhil7299 did, the devtools.log is not working actually, when i reverted it back to 'print' it worked, but with the special characters as mentioned earlier without colors.

from talker.

nikhil7299 avatar nikhil7299 commented on June 30, 2024

@arhamsc Did you run in debug mode or without debugging? Developer tools .log() works only in debug mode.

from talker.

arhamsc avatar arhamsc commented on June 30, 2024

@arhamsc Did you run in debug mode or without debugging? Developer tools .log() works only in debug mode.

I ran the app in debug mode. And then tried changing back and forth from developer log and print, only with print it worked not with developer logs.

EDIT
you are referring to --debug flag with flutter run, right?

from talker.

arhamsc avatar arhamsc commented on June 30, 2024

Is there any update on this thread? @Frezyx
Is it due to the new devctl command that apple has introduced which requires flutter to be run via xcode?

from talker.

RNOVOSELOV avatar RNOVOSELOV commented on June 30, 2024

@Frezyx @arhamsc
I also reproduced  same problem.

In VSCode logs are displayed correctly, but Android Studio (Giraffe version) does not  show the logs or shows them without color and not completely (tested on iOS 15 & iOS16)

Android and Web are works correctly on both IDE.

from talker.

RNOVOSELOV avatar RNOVOSELOV commented on June 30, 2024
final sl = GetIt.instance;

void _setupTakerLogger() {
  sl.registerLazySingleton<Talker>(() => TalkerFlutter.init());
  Bloc.observer = TalkerBlocObserver(talker: sl.get<Talker>());
  FlutterError.onError =
      (details) => sl.get<Talker>().handle(details.exception, details.stack);
}

Android Studio's console log example, when run on iOS 15/16

[Talker] �[38;5;4m┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────�[0m
�[38;5;4m│ [INFO] | 14:43:25 763ms | _onSplashPageLoaded - Read token from shared preferences: null�[0m
�[38;5;4m└──────────────────────────────────────────────────────────────────────────────────────────────────────────────�[0m

from talker.

Frezyx avatar Frezyx commented on June 30, 2024

Hello guys!
Thank you for reporting this error. Currently I don't know why logs don't shows in console for something apple devices
I will check this in near future!

from talker.

nikhil7299 avatar nikhil7299 commented on June 30, 2024

@arhamsc
Yes I am talking about 'flutter run --debug' but do not use command line, just press F5, the logs will be shown in the Debug Console and not in Terminal.
Also when you modify the internal code of TalkerLogger, make sure to reload "VS Code" window and re-run your flutter app using F5.

from talker.

arhamsc avatar arhamsc commented on June 30, 2024

@nikhil7299 Yes I used the internal vs code run command. And I have tried the steps you have mentioned. It seems to be the general problem of the apple making internal changes which aren't allowing the logs in general within flutter framework.

from talker.

arhamsc avatar arhamsc commented on June 30, 2024

It seems to be printing onto IoS console in a neater way now.

Device: Iphone 14 Pro Max
IOS: 17

But there is not color coding and has some weird alignment and symbols.

from talker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.