Giter Site home page Giter Site logo

frezyx / talker Goto Github PK

View Code? Open in Web Editor NEW
390.0 4.0 48.0 87.52 MB

☎️ Advanced error handler and logger for dart and flutter apps

Home Page: https://pub.dev/packages/talker

License: MIT License

Dart 94.88% Kotlin 0.06% Swift 0.60% Objective-C 0.02% HTML 2.50% Shell 0.77% Ruby 1.16%
error-handling logger dart flutter exception-handling package flutter-package dart-library dart-package dartlang

talker's Introduction

Advanced error handler and logger for dart and flutter apps

Log your app actions, catch and handle exceptions and errors, show alerts and share log reports
Show some ❤️ and star the repo to support the project!

codecov License: MIT Repository views GitHub
talker talker_flutter talker_logger

For better understanding how it works check Web Demo page

Motivation

🚀  The main goal of the project is provide ability to understand where the error occurs in a shortest possible time
✅  Compatible with any state managements
✅  Works with any crash reporting tool (Firebase Crashlytics, Sentry, custom tools, etc.)
✅  Logs UI output of Flutter app on the screen
✅  Allows sharing and saving logs history and error crash reports
✅  Displays alerts for UI exceptions.
✅  Built-in support for dio HTTP logs
✅  Built-in support for BLoC logs
✅  Check all features

Packages

Talker is designed for any level of customization.

Package Version Description
talker Pub Main dart package for logging and error handling
talker_flutter Pub Flutter extensions for talker
Colored Flutter app logs (iOS and Android), logs list screen, showing error messages at UI out of the box, route observer, etc
talker_logger Pub Customizable pretty logger for dart/flutter apps
talker_dio_logger Pub Best logger for dio http calls
talker_bloc_logger Pub Best logger for BLoC state management library
talker_http_logger Pub Best logger for http package

Table of contents

Talker

Get Started

Follow these steps to the coolest experience in error handling

Add dependency

dependencies:
  talker: ^4.1.3

Easy to use

You can use Talker instance everywhere in your app
Simple and concise syntax will help you with this

  import 'package:talker/talker.dart';

  final talker = Talker();

  /// Just logs
  talker.warning('The pizza is over 😥');
  talker.debug('Thinking about order new one 🤔');

  // Handling Exception's and Error's
  try {
    throw Exception('The restaurant is closed ❌');
  } catch (e, st) {
    talker.handle(e, st);
  }

  /// Just logs
  talker.info('Ordering from other restaurant...');
  talker.info('Payment started...');
  talker.good('Payment completed. Waiting for pizza 🍕');

More examples you can get there

⚙️ Customization

Configure the error handler and logger for yourself

final talker = Talker(
    settings: const TalkerSettings(
      /// You can enable/disable all talker processes with this field
      enabled: true,
      /// You can enable/disable saving logs data in history
      useHistory: true,
      /// Length of history that saving logs data
      maxHistoryItems: 100,
      /// You can enable/disable console logs
      useConsoleLogs: true,
    ),
    /// Setup your implementation of logger
    logger: TalkerLogger(),
    ///etc...
  );

More examples you can get here

Custom logs

With Talker you can create your custom log message types.
And you have full customization control over them!

class YourCustomLog extends TalkerLog {
  YourCustomLog(String message) : super(message);

  /// Your custom log title
  @override
  String get title => 'CUSTOM';

  /// Your custom log color
  @override
  AnsiPen get pen => AnsiPen()..xterm(121);
}

final talker = Talker();
talker.logTyped(YourCustomLog('Something like your own service message'));

Change log colors

Starting from version 4.0.0, you have the ability to fully customize all logs colors. You can set your own color for any type of logs. For example, you can choose red for HTTP responses and green for errors—whatever suits your preference 😁

The Map is structured as {TalkerLogType: AnsiPen}.

TalkerLogType is an identifier for a specific log type (e.g., HTTP, error, info, etc.), and each log type in Talker has its own field in the enum. And AnsiPen is model to console colors customization

final talker = Talker(
  settings: TalkerSettings(
    colors: {
      TalkerLogType.httpResponse: AnsiPen()..red(),
      TalkerLogType.error: AnsiPen()..green(),
      TalkerLogType.info: AnsiPen()..yellow(),
      // Other colors...
    },
  ),
);

Talker have default color scheme. You can check it in TalkerSettings class

Change log titles

Starting from version 4.0.0, you have the ability to fully customize all logs titles. You can set your own title for any type of logs.

The Map is structured as {TalkerLogType: String}.

TalkerLogType is an identifier for a specific log type (e.g., HTTP, error, info, etc.), and each log type in Talker has its own field in the enum.

final talker = Talker(
  settings: TalkerSettings(
    titles: {
      TalkerLogType.exception: 'Whatever you want',
      TalkerLogType.error: 'E',
      TalkerLogType.info: 'i',
      // Other titles...
    },
  ),
);

Talker have default titles scheme. You can check it in TalkerSettings class

TalkerObserver

TalkerObserver is a mechanism that allows observing what is happening inside Talker from the outside.

import 'package:talker/talker.dart';

class ExampleTalkerObserver extends TalkerObserver {
  ExampleTalkerObserver();

  @override
  void onError(TalkerError err) {
    /// Send data to your error tracking system like Sentry or backend
    super.onError(err);
  }

  @override
  void onException(TalkerException exception) {
    /// Send Exception to your error tracking system like Sentry or backend
    super.onException(exception);
  }

  @override
  void onLog(TalkerDataInterface log) {
    /// Send log message to Grafana or backend
    super.onLog(log);
  }
}

final observer = ExampleTalkerObserver();
final talker = Talker(observer: observer);

You can use it to transmit data about logs to external sources such as Crashlytics, Sentry, Grafana, or your own analytics service, etc.

Talker Flutter

Get Started Flutter

Talker Flutter is an extension for the Dart Talker package that adds extra functionality to make it easier for you to handle logs, errors, and exceptions in your Flutter applications.

Add dependency

dependencies:
  talker_flutter: ^4.1.3

Setup

import 'package:talker_flutter/talker_flutter.dart';

final talker = TalkerFlutter.init();

// Handle exceptions and errors
try {
  // your code...
} catch (e, st) {
    talker.handle(e, st, 'Exception with');
}

// Log your app info
talker.info('App is started');
talker.critical('❌ Houston, we have a problem!');
talker.error('🚨 The service is not available');

❗️ Log messages integrity

Most of flutter logging packages either cut messages in the console, or cant dope colored messages in the iOS console. But Talker is not one of them...

Talker uses the optimal method for logging depending on the Operating system on which it runs

But to do this, you need to use the initialization given in the example. Only with TalkerFlutter.init()

As result of this method you will get the same instance of Talker as when creating it through the Talker() constructor but with logging default initialization

TalkerScreen

Often you need to check what happening in the application when there is no console at hand.
There is a TalkerScreen widget from talker_flutter package for this situations.

For better understanding how it works check Web Demo page

TalkerScreen TalkerFilter TalkerActions TalkerSettings

Easy to use

You can use TalkerScreen everywhere in your app
At Screen, BottomSheet, ModalDialog, etc...

import 'package:talker_flutter/talker_flutter.dart';

final talker = TalkerFlutter.init();

Navigator.of(context).push(
  MaterialPageRoute(
    builder: (context) => TalkerScreen(talker: talker),
  )
);

See more in TalkerScreen usage example

Customization

Starting from version 4.0.0, you have the ability to fully customize your TalkerScreen display. You can set your own color for any type of logs. For example, you can choose red for HTTP responses and green for errors—whatever suits your preference 😁

How to set custom colors ?

To set your custom colors, you need to pass a TalkerScreenTheme object to the TalkerScreen constructor, with a Map containing the desired colors.

The Map is structured as {log type: color}. TalkerLogType is an identifier for a specific log type (e.g., HTTP, error, info, etc.), and each log type in Talker has its own field in the enum.

import 'package:talker_flutter/talker_flutter.dart';

final talker = TalkerFlutter.init();

TalkerScreen(
  talker: talker,
  theme: TalkerScreenTheme(
    /// Your custom log colors
    logColors: {
      TalkerLogType.httpResponse: Color(0xFF26FF3C),
      TalkerLogType.error: Colors.redAccent,
      TalkerLogType.info: Color.fromARGB(255, 0, 255, 247),
    },
  )
)

TalkerScreenTheme

You can set custom backagroud, card and text colors for TalkerScreen with TalkerScreenTheme

TalkerScreenTheme(
  cardColor: Colors.grey[700]!,
  backgroundColor: Colors.grey[800]!,
  textColor: Colors.white,
  logColors: {
    /// Your logs colors...
  },
)

TalkerRouteObserver

Observer for a navigator.
If you want to keep a record of page transitions in your application, you've found what you're looking for.

You can use TalkerRouteObserver with any routing package
From auto_route to basic Flutter Navigator

Navigator

final talker = Talker();

MaterialApp(
  navigatorObservers: [
    TalkerRouteObserver(talker),
  ],
)

auto_route

final talker = Talker();

MaterialApp.router(
  routerDelegate: AutoRouterDelegate(
    appRouter,
    navigatorObservers: () => [
      TalkerRouteObserver(talker),
    ],
  ),
),

auto_route v7

final talker = Talker();

MaterialApp.router(
  routerConfig: _appRouter.config(
    navigatorObservers: () => [
      TalkerRouteObserver(talker),
    ],
  ),
),

go_router

final talker = Talker();

GoRouter(
  observers: [TalkerRouteObserver(talker)],
)

TalkerMonitor

If you want to check the status of your application in a short time
TalkerMonitor will be the best solution for you

Monitor is a filtered quick information about http requests, exceptions, errors, warnings, etc... count

You will find Monitor at the TalkerScreen page

For better understanding how it works check Web Demo page

TalkerWrapper

In addition talker_flutter is able to show default and custom error messages and another status messages via TalkerWrapper

import 'package:talker_flutter/talker_flutter.dart';

final talker = TalkerFlutter.init();

TalkerWrapper(
  talker: talker,
  options: const TalkerWrapperOptions(
    enableErrorAlerts: true,
  ),
  child: /// Application or the screen where you need to show messages
),

More Features And Examples

Custom UI error messages

In order to understand in more details - you can check this article "Showing Flutter custom error messages"

TalkerWrapper usage example

ShopApp example

See full application example with BLoC and navigation here

The talker_flutter package have a lot of another widgets like TalkerBuilder, TalkerListener, etc. You can find all of them in code documentation.

Integrations

In addition to the basic functionality, talker was conceived as a tool for creating lightweight loggers for the main activities of your application

You can use ready out of the box packages like talker_dio_logger and talker_bloc_logger or create your own packages.

Talker Dio Logger

Lightweight, simple and pretty solution for logging if your app use dio as http-client

This is how the logs of your http requests will look in the console

Getting started

Follow these steps to use this package

Add dependency

dependencies:
  talker_dio_logger: ^4.1.3

Usage

Just add TalkerDioLogger to your dio instance and it will work

final dio = Dio();
dio.interceptors.add(
    TalkerDioLogger(
        settings: const TalkerDioLoggerSettings(
          printRequestHeaders: true,
          printResponseHeaders: true,
          printResponseMessage: true,
        ),
    ),
);

Customization

To provide hight usage exp here are a lot of settings and customization fields in TalkerDioLoggerSettings. You can setup all wat you want. For example:

Off/on http request or reposnse logs

You can toggle reponse / request printing and headers including

final dio = Dio();
dio.interceptors.add(
    TalkerDioLogger(
        settings: const TalkerDioLoggerSettings(
          // All http responses enabled for console logging
          printResponseData: true,
          // All http requests disabled for console logging
          printRequestData: false,
          // Reposnse logs including http - headers
          printResponseHeaders: true,
          // Request logs without http - headersa
          printRequestHeaders: false,
        ),
    ),
);

Change http logs colors

Setup your custom http-log colors. You can set color for requests, responses and errors in TalkerDioLoggerSettings

TalkerDioLoggerSettings(
  // Blue http requests logs in console
  requestPen: AnsiPen()..blue(),
  // Green http responses logs in console
  responsePen: AnsiPen()..green(),
  // Error http logs in console
  errorPen: AnsiPen()..red(),
);

Filter http logs

For example if your app has a private functionality and you don't need to store this functionality logs in talker - you can use filters

TalkerDioLoggerSettings(
  // All http request without "/secure" in path will be printed in console 
  requestFilter: (RequestOptions options) => !options.path.contains('/secure'),
  // All http responses with status codes different than 301 will be printed in console 
  responseFilter: (response) => response.statusCode != 301,
)

Using with Talker

You can add your talker instance for TalkerDioLogger if your app already uses Talker. In this case, all logs and errors will fall into your unified tracking system

final talker = Talker();
final dio = Dio();
dio.interceptors.add(TalkerDioLogger(talker: talker));

Talker BLoC Logger

Lightweight, simple and pretty solution for logging if your app use BLoC as state management

This is how the logs of your BLoC's event calling and state emits will look in the console

Getting started

Follow these steps to use this package

Add dependency

dependencies:
  talker_bloc_logger: ^4.1.3

Usage

Just set TalkerBlocObserver as Bloc.observer field and it will work

import 'package:talker_bloc_observer/talker_bloc_observer.dart';

Bloc.observer = TalkerBlocObserver();

Customization

To provide hight usage exp here are a lot of settings and customization fields in TalkerBlocLoggerSettings. You can setup all wat you want. For example:

Off/on events, transitions, changes, creation, close

You can toggle all bloc event types printing

Bloc.observer = TalkerBlocObserver(
    settings: TalkerBlocLoggerSettings(
      enabled: true,
      printChanges: true,
      printClosings: true,
      printCreations: true,
      printEvents: true,
      printTransitions: true,
    ),
  );

Full/truncated state and event data

You can choose to have the logs of events and states in the BLoC displayed in the console in either full or truncated form

Bloc.observer = TalkerBlocObserver(
    settings: TalkerBlocLoggerSettings(
      printEventFullData: false,
      printStateFullData: false,
    ),
  );

Filter bloc logs

You can output logs to the console for specific events and states only, using a filter

Bloc.observer = TalkerBlocObserver(
    settings: TalkerBlocLoggerSettings(
      // If you want log only AuthBloc transitions
      transitionFilter: (bloc, transition) =>
          bloc.runtimeType.toString() == 'AuthBloc',
      // If you want log only AuthBloc events
      eventFilter: (bloc, event) => bloc.runtimeType.toString() == 'AuthBloc',
    ),
  );

Using with Talker!

You can add your talker instance for TalkerBlocLogger if your Appication already uses Talker.

In this case, all logs and errors will fall into your unified tracking system

import 'package:talker_bloc_observer/talker_bloc_observer.dart';
import 'package:talker/talker.dart';

final talker = Talker();
Bloc.observer = TalkerBlocObserver(talker: talker);

Crashlytics integration

If you add CrashlyticsTalkerObserver to your application, you will receive notifications about all application errors in the Crashlytics dashboard.

Additionally, you can configure it to send only specific errors to Crashlytics from within TalkerObserver.

import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:talker/talker.dart';

class CrashlyticsTalkerObserver extends TalkerObserver {
  CrashlyticsTalkerObserver();

  @override
  void onError(err) {
      FirebaseCrashlytics.instance.recordError(
        err.error,
        err.stackTrace,
        reason: err.message,
      );
  }

  @override
  void onException(err) {
      FirebaseCrashlytics.instance.recordError(
        err.exception,
        err.stackTrace,
        reason: err.message,
      );
  }
}

final crashlyticsTalkerObserver = CrashlyticsTalkerObserver();
final talker = Talker(observer: crashlyticsTalkerObserver);

Features list

✅ Logging

  • ✅ Filtering

  • ✅ Formatting

  • ✅ Color logs

  • ✅ LogLevels (info, verbose, warning, debug, error, critical, fine, good)

  • ✅ Customization for filtering, formatting and colors

  • 🚧 Separation from system's and another flutter logs

  • 🚧 Collapsible feature for huge logs

  • 🚧 Logs grouping

✅ Errors handling

  • ✅ Errors and Exceptions identification
  • ✅ StackTrace
  • 🚧 Error level identification

✅ Flutter

  • ✅ Application logs sharing

  • ✅ HTTP cals logging

  • ✅ TalkerScreen - Showing logs list in Flutter app UI

  • ✅ TalkerMonitor - A short summary of your application status. How much errors, how much warnings in Flutter app UI

  • ✅ TalkerRouteObserver - router logging (which screen is opened, which is closed)

  • ✅ TalkerWrapper - Showing errors and exceptions messages at UI

  • ✅ TalkerListener - Listen logs data at application UI

  • ✅ TalkerBuilder - UI builder to Logs List showing custom UI

  • ✅ Android/Windows/Web application logs colors

  • ✅ iOS/MacOS application logs colors

  • ✅ Talker configuration chnages from TalkerFlutter

✅ Logs and errors history saving

✅ TalkerObserver - handle all logs, errors, exceptions for integrations (Sentry, Crashlytics)

Coverage

Error handling is a very important task
You need to choose carefully if you want to use a package for exceptions handling solution
Therefore, the project is 100% covered by tests

Additional information

The project is under development and ready for your pull-requests and issues 👍
Thank you for support ❤️

Contributors


Thanks to all contributors of this package


For help getting started with 😍 Flutter, view online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

talker's People

Contributors

abdelaziz-mahdy avatar cem256 avatar cselti avatar danyalo avatar dependabot[bot] avatar frezyx avatar heiha100 avatar ilyazadyabin avatar jirehcwe avatar jnelle avatar k1yoshisho avatar kabak-siarhei avatar khaoz-topsy avatar kurtlourens-rabobank avatar melodysdreamj avatar miladatef avatar ppito avatar probka00 avatar projectaj14 avatar qwadrox avatar reprevise avatar s0nerik avatar samuelmtdavies avatar sebastianbuechler avatar vicenterusso avatar wcoder avatar westito avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

talker's Issues

Request Headers

Describe the bug
I'm afraid that request headers are not being displayed

Snackbar shows null as message in TalkerWrapper

First: congratulations for this excellent work!

This error occurs in the talker_flutter version: 2.0.0+1.

Describe the bug
When an exception occurs, the message in the Snackbar is null.

Example:

 void _handleException() {
    try {
      throw Exception('Test Exception');
    } catch (e, st) {
      talker.handle(e, st);
    }
  }

Screenshots
Captura de tela de 2022-10-03 13-55-22

I believe this error is being caused by the 'SnackbarContent on file: talker_flutter/lib/src/ui/talker_wrapper/talker_wrapper.dart method.

Captura de tela de 2022-10-03 14-13-15

I think the correct one would be: message: data.exception.toString(),

                SnackbarContent(
                  message: data.exception.toString(),
                  title: options.errorTitle,
                ),

After changing to message: data.exception.toString(), it works.

Captura de tela de 2022-10-03 14-08-13

Talker dependencies conflict with GraphQL

Describe the bug
Flutter GraphQL and Talker conflict in dependencies. Talker is using an outdated version of path_provider. You get this error:

Because talker_flutter >=2.0.0 depends on path_provider ^2.0.11 and every version of flutter_graphql depends on path_provider ^0.4.1, talker_flutter >=2.0.0 is incompatible with flutter_graphql.

To Reproduce
Steps to reproduce the behavior:

  1. Have Flutter_graphql Latest installed
  2. Have Talker installed.

Expected behavior
There should be no conflicts. Let's upgrade talker to use Flutter's latest path_provider libraries.

Member not found: 'GroupButton.checkbox'

I got this issue while running the app.

Launching lib\main.dart on SM M115F in debug mode...
Running Gradle task 'assembleDebug'...
../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/talker_flutter-0.5.3/lib/src/widgets/filter/talker_screen_filter.dart:100:38: Error: Member not found: 'GroupButton.checkbox'.
                  child: GroupButton.checkbox(
                                     ^^^^^
../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/talker_flutter-0.5.3/lib/src/widgets/filter/talker_screen_filter.dart:122:38: Error: Member not found: 'GroupButton.checkbox'.
                  child: GroupButton.radio(
                                     ^^^^^

Logging in FirebaseCrashlytics does not work

If I create a class as specified here https://pub.dev/packages/talker_flutter#talkerobserver
But I only import import 'package:talker_flutter/talker_flutter.dart';.

Then the construction:

final crashlyticsTalkerObserver = CrashlyticsTalkerObserver();
final talker = TalkerFlutter.init(observer: crashlyticsTalkerObserver);

doesn't work for Crashlytics doesn't work for sending error reports

image

image

It's also not a good idea to wrap everything in runZonedGuarded() as it gets lost
Stack trace

image

Can the package talker_flutter support the web?

Is your feature request related to a problem? Please describe.
I need to build my application through the web and display it in the internal browser of the third party platform, this application needs to be debugged in release mode, because the third party platform mobile web does not support opening the console review element, I cannot see the log. So I want to support the web

Describe the solution you'd like
When I build web Mobile publishing to run on a third-party platform, I want to be able to view the logs on my phone screen in the publishing environment

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Converting object to an encodable object failed: Instance of 'FormData'.

Describe the bug
When I used the Retrofit and Dio upload a file, I got a fatal exception.
If I hidden the logger, the upload will succeed.

To Reproduce

@MultiPart()
  @POST(Api.uploadFile)
  Future<Result<ImageFile>> uploadFile(
    @Part(name: "file") File file,
    @Part(name: "type") String type,
  );
@override
  Future<Result<ImageFile>> uploadFile(
    file,
    type,
  ) async {
    const _extra = <String, dynamic>{};
    final queryParameters = <String, dynamic>{};
    final _headers = <String, dynamic>{};
    final _data = FormData();
    _data.files.add(MapEntry(
      'file',
      MultipartFile.fromFileSync(
        file.path,
        filename: file.path.split(Platform.pathSeparator).last,
      ),
    ));
    _data.fields.add(MapEntry(
      'type',
      type,
    ));
    final _result = await _dio
        .fetch<Map<String, dynamic>>(_setStreamType<Result<ImageFile>>(Options(
      method: 'POST',
      headers: _headers,
      extra: _extra,
      contentType: 'multipart/form-data',
    )
            .compose(
              _dio.options,
              'common/upload',
              queryParameters: queryParameters,
              data: _data,
            )
            .copyWith(baseUrl: baseUrl ?? _dio.options.baseUrl)));
    final value = Result<ImageFile>.fromJson(
      _result.data!,
      (json) => ImageFile.fromJson(json as Map<String, dynamic>),
    );
    return value;
  }
dio.interceptors.add(TalkerDioLogger(
      settings: const TalkerDioLoggerSettings(
        printRequestHeaders: true,
      ),
    ));

Expected behavior

I/flutter (21545): ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter (21545): │ [EXCEPTION] | 8:50:26 288ms | URL: http://192.168.1.61:8094/task-app/common/upload
I/flutter (21545): │ METHOD: POST
I/flutter (21545): │ 
I/flutter (21545): │ DioError [DioErrorType.other]: Converting object to an encodable object failed: Instance of 'FormData'
I/flutter (21545): │ #0      _JsonStringifier.writeObject (dart:convert/json.dart:794:7)
I/flutter (21545): │ #1      _JsonStringStringifier.printOn (dart:convert/json.dart:983:17)
I/flutter (21545): │ #2      _JsonStringStringifier.stringify (dart:convert/json.dart:968:5)
I/flutter (21545): │ #3      JsonEncoder.convert (dart:convert/json.dart:345:30)
I/flutter (21545): │ #4      HttpRequestLog.generateTextMessage (package:talker_dio_logger/http_logs.dart:40:34)
I/flutter (21545): │ #5      Talker._handleLogData (package:talker/src/talker.dart:325:16)
I/flutter (21545): │ #6      Talker.logTyped (package:talker/src/talker.dart:180:5)
I/flutter (21545): │ #7      TalkerDioLogger.onRequest (package:talker_dio_logger/talker_dio_logger_interceptor.dart:53:13)
I/flutter (21545): │ #8      DioMixin.fetch._requestInterceptorWrapper.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:dio/src/dio_mixin.dart:517:28)
I/flutter (21545): │ #9      DioMixin.checkIfNeedEnqueue (package:dio/src/dio_mixin.dart:789:22)
I/flutter (21545): │ #10     DioMixin.fetch._requestInterceptorWrapper.<anonymous closure>.<anonymous closure> (package:dio/src/dio_mixin.dart:515:22)
I/flutter (21545): │ #11     new Future.<anonymous closure> (dart:async/future.dart:252:37)
I/flutter (21545): │ #12     _rootRun (dart:async/zone.dart:1418:47)
I/flutter (21545): │ #13     _CustomZone.run (dart:async/zone.dart:1328:19)
I/flutter (21545): │ #14     _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
I/flutter (21545): │ #15     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1276:23)
I/flutter (21545): │ #16     _rootRun (dart:async/zone.dart:1426:13)
I/flutter (21545): │ #17     _CustomZone.run (dart:async/zone.dart:1328:19)
I/flutter (21545): │ #18     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:1260:23)
I/flutter (21545): │ #19     Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18:15)
I/flutter (21545): │ #20     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
I/flutter (21545): │ #21     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
I/flutter (21545): │ #22     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
I/flutter (21545): │ 
I/flutter (21545): │ #0      TalkerDioLogger.onError (package:talker_dio_logger/talker_dio_logger_interceptor.dart:76:18)
I/flutter (21545): │ #1      DioMixin.fetch._errorInterceptorWrapper.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:dio/src/dio_mixin.dart:574:28)
I/flutter (21545): │ #2      DioMixin.checkIfNeedEnqueue (package:dio/src/dio_mixin.dart:789:22)
I/flutter (21545): │ #3      DioMixin.fetch._errorInterceptorWrapper.<anonymous closure>.<anonymous closure> (package:dio/src/dio_mixin.dart:572:22)
I/flutter (21545): │ #4      new Future.<anonymous closure> (dart:async/future.dart:252:37)
I/flutter (21545): │ #5      _rootRun (dart:async/zone.dart:1418:47)
I/flutter (21545): │ #6      _CustomZone.run (dart:async/zone.dart:1328:19)
I/flutter (21545): │ #7      _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
I/flutter (21545): │ #8      _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1276:23)
I/flutter (21545): │ #9      _rootRun (dart:async/zone.dart:1426:13)
I/flutter (21545): │ #10     _CustomZone.run (dart:async/zone.dart:1328:19)
I/flutter (21545): │ #11     _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:1260:23)
I/flutter (21545): │ #12     Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18:15)
I/flutter (21545): │ #13     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
I/flutter (21545): │ #14     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
I/flutter (21545): │ #15     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
I/flutter (21545): │ 
I/flutter (21545): └──────────────────────────────────────────────────────────────────────────────────────────────────────────────

"print" cut off my logs.

Describe the bug

"print" cut off my logs.
It's related to a bug of flutter flutter/flutter#110236

To Reproduce
Steps to reproduce the behavior:

Execute flutter run on the code sample

Code sample
import 'package:talker/talker.dart';

void main() {
  Talker().info("""
┌────1──────────────────────────────────────────────────────────────────────────────────────────────────────────
┌─────2─────────────────────────────────────────────────────────────────────────────────────────────────────────
┌───────3───────────────────────────────────────────────────────────────────────────────────────────────────────
[LOG] | 0:14:30 55ms | 123123123131232131231231231231231231231231231231123123123131232131231231231231231231231
""");
}

Expected results:
The console prints my complete logs.

Actual results:
The console only prints a portion of my logs.

Screenshots
Screenshot 2022-08-25 at 12 01 36 PM

Desktop (please complete the following information):

Refer to flutter flutter/flutter#110236

Smartphone (please complete the following information):

Refer to flutter flutter/flutter#110236

Additional context

The solution is use "debugPrint" instead of "print" in "talker_logger.dart line 11". But this needs talk_logger to be dependent on flutter SDK. I don't know what's the best solution. so post the issue here instead of sending the pull request.
Screenshot 2022-08-25 at 12 07 15 PM

Recieve message misprint

Describe the bug
Eventing message is Blocname recvie event

To Reproduce
Steps to reproduce the behavior:

  1. Use Bloc.observer like Bloc.observer = TalkerBlocObserver( talker: talker, settings: const TalkerBlocLoggerSettings( printEventFullData: false, printStateFullData: false, ), );
  2. Add some event
  3. See message with misprint

Expected behavior
Message is Blocname recieve event, not recvie

Screenshots
image

Desktop (please complete the following information):

  • OS: Win10
  • Version: talker_bloc_logger 2.0.0

Проблема с talker_bloc_logger-2.3.1 в flutter, нет некоторых enum

Описание ошибки
Я использую пакет talker_bloc_logger-2.3.1 с пакетом talker_flutter-3.5.5, на стадии сборки проекта вызывается две ошибки
/C:/Users/%USER%/AppData/Local/Pub/Cache/hosted/pub.dev/talker_bloc_logger-2.3.1/lib/bloc_logs.dart:120:39: Error: Member not found: 'blocCreate'.
String get title => WellKnownTitles.blocCreate.title;

/C:/Users/%USER%/AppData/Local/Pub/Cache/hosted/pub.dev/talker_bloc_logger-2.3.1/lib/bloc_logs.dart:147:39: Error: Member not found: 'blocClose'.
String get title => WellKnownTitles.blocClose.title;

Воспроизведение ошибки
Шаги по воспроизведению поведения:

  1. Установить talker_flutter: ^3.5.5 и talker_bloc_logger: ^2.3.1
  2. Запустить flutter приложение
  3. См. ошибку

Ожидаемое поведение
A clear and concise description of what you expected to happen.

Скриншоты
image

Конфигурация:

  • ОС: Windows 11 Pro 10.0.22621 Сборка 22621
  • Браузер: Microsoft Edge 119.0.2151.93

Смартфон:

  • Девайс: Pixel 3A
  • ОС: Android 14

Попытки решения
Удаление обоих плагинов из pubspec.yaml, удаление всего кеша пакетов по пути C:\Users%USER%\AppData\Local\Pub\Cache\hosted, после чего flutter clean в окне проекта, переустановка всех пакетов.

Need for Associating Responses with Corresponding Requests

Is your feature request related to a problem? Please describe.
When there are too many requests and responses, the sequence of operations gets disrupted. In such cases, it becomes difficult to determine which response corresponds to which request.

Describe the solution you'd like
It's necessary to somehow indicate which request the response is associated with when it arrives.

Response replaced in talker http monitor screen

Describe the bug
Talker monitor not showing the correct response.

To Reproduce

  1. first hit login api with invalid credential
  2. then hit login api with valid credential
  3. you can now check on talker monitor list replacing error response with later success response

Expected behavior
response should be in list with respected request.

Screenshots

second requests response replaced with first request response

Screenshot 2023-02-26 at 12 08 05 AM

Desktop (please complete the following information):

  • OS: All
  • Browser All
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: ALL
  • OS: All
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Security issue with TalkerHttpLogger: Bearer tokens

Hi,

I was playing with Talker and the talker_http_logger package.

My app uses a piece of code very similar to the example:

import 'package:http_interceptor/http_interceptor.dart';
import 'package:talker_http_logger/talker_http_logger.dart';

void main() async {
  final client = InterceptedClient.build(interceptors: [
    TalkerHttpLogger(),
  ]);

  await client.get("https://google.com".toUri());
}

Looking at the http logger:

class TalkerHttpLogger extends InterceptorContract {
  TalkerHttpLogger({Talker? talker}) {
    _talker = talker ?? Talker();
  }

  late Talker _talker;

  @override
  Future<BaseRequest> interceptRequest({
    required BaseRequest request,
  }) async {
    final message = '${request.url}';
    _talker.logTyped(HttpRequestLog(message, request: request));
    return request;
  }

  @override
  Future<BaseResponse> interceptResponse({
    required BaseResponse response,
  }) async {
    final message = '${response.request?.url}';
    _talker.logTyped(HttpResponseLog(message, response: response));
    return response;
  }
}

The logger simply writes the request to the logs, including the headers, without obfuscating anything. This is a problem when the headers contain stuff like Bearer 1234.... These sensitive values are written in clear to the logs.

I would suggest obfuscating these specific fields by default, with maybe a flag to disable the obfuscation.

Cheers

logs file naming and path

Describe the bug
in Windows files names cant have :
image

but the logs file is talker_logs_2023-02-24 00:13:22.710122.txt which is forbiden

To Reproduce
Steps to reproduce the behavior:
Talker screen
share logs file

Expected behavior
it should save the file with diffrent naming.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows
  • Version 10

Additional context
Add any other context about the problem here.

LogLevel.info has lower priority than debug and verbose

Describe the bug
In most logging libraries (like Logger or every Java logging libs) the info has higher priority than debug or verbose (or other libraries use trace at this level).

I think the good level should be higher than debug or verbose, but I'm not sure in that (this log level doesn't exist in other logger libs).

Expected behavior
The LogLevel.info doesn't show the debug and verbose log messages.

Pipes for Error Handling

Is your feature request related to a problem? Please describe.
There are at least two scenarios where you might need a pipe. In both case the pipe should act upon the error details before before it's passed down to observers or even cancel any further handling

Scenario 1:
Before you even handle any errors you want to check additional conditions. For example you might want to ask the user if they want to submit this report in the first place.

Scenario 2:
Before the error details reach the observers you want to add additional information, like an internal app version. This is specifically for those kind of information that you would need for every log and would otherwise need to add in every single observer. There is also the option to remove certain information.

This feature goes along well with my other feature request (#74), so they could both use a context property.

Describe the solution you'd like
When initializing talker you can provide a new property "pipes", which is an array of TalkerPipes. The order of the pipes should dictate the execution order. A TalkerPipe can either cancel any further execution or attach additional information.

The overall flow would look like this:

  1. talker.handle is called with some parameters
  2. Talker builds a TalkerException object
  3. Talker passes that object through the pipelines
  4. If the execution was not canceled, the object is handled by the observers

In the end observers have an enriched TalkerException.

Describe alternatives you've considered
You would have to add the wanted logic to all observers, which is a lot of redundant code. So no real alternative as far as I know.

Additional context
The idea of having a way to add information to all error details is based on Serilog Enrichers.

Unsupported operation: Cannot add to an unmodifiable list

Describe the bug
Issue while adding any filter in the TalkerScreen

To Reproduce
Steps to reproduce the behavior:

  1. Go to TalkerScreen
  2. Click on any filter

Expected behavior
The filters should be added without errors

Additional context

Unsupported operation: Cannot add to an unmodifiable list

When the exception was thrown, this was the stack: 
#0      UnmodifiableListMixin.add (dart:_internal/list.dart:114:5)
#1      TalkerScreenController.addFilterTitle (package:talker_flutter/src/controller/talker_screen_controller.dart:57:56)
#2      TalkerScreenFilter._onToggleTitle (package:talker_flutter/src/ui/widgets/filter/talker_screen_filter.dart:167:18)
#3      TalkerScreenFilter.build.<anonymous closure> (package:talker_flutter/src/ui/widgets/filter/talker_screen_filter.dart:115:23)
#4      _GroupButtonBodyState._generateButtonsList.<anonymous closure> (package:group_button/src/group_button_body.dart:170:38)
#5      _InkResponseState.handleTap (package:flutter/src/material/ink_well.dart:1072:21)
#6      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:253:24)
#7      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:627:11)
#8      BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:306:5)
#9      BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:276:7)
#10     GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:163:27)
#11     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:464:20)
#12     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:440:22)
#13     RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:337:11)
#14     GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:395:7)
#15     GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:357:5)
#16     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:314:7)
#17     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:295:7)
#18     _invoke1 (dart:ui/hooks.dart:167:13)
#19     PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:341:7)
#20     _dispatchPointerDataPacket (dart:ui/hooks.dart:94:31)
Handler: "onTap"
Recognizer: TapGestureRecognizer#13c3e
  debugOwner: GestureDetector
  state: ready
  won arena
  finalPosition: Offset(44.3, 280.0)
  finalLocalPosition: Offset(34.3, 21.0)
  button: 1
  sent tap down
====================================================================================================

Export talker cards

Is your feature request related to a problem? Please describe.
I really like this package. It even provides UI to show the logs in which is great.
However, the TalkerScreen has a bit too many features for my taste,
and doesnt fit with the design of my app too well.

Describe the solution you'd like
It would be nice if the TalkerDataCard was exported, so we can build our own screen.

Describe alternatives you've considered
I have considered building the entire screen myself as well as the card.
However, with that have to create the colors and the frame, etc. myself.

Additional context
(it would also be nice if the icon button inside the cards could be configured via a "trailing" parameter)

Reverse logs.

Is it possible to reverse the order of the logs? It's earliest first, a bit hard to scroll to the bottom to see the newest logs.

Talker card message overlapped by title

Describe the bug
Opening the log shows the log items being overlapped by their title.

To Reproduce
Steps to reproduce the behavior:

  1. add a TalkerScreen
  2. open said screen
  3. observe UI weirdness

Expected behavior
The item text should be below the title.

Screenshots
image

Smartphone:

  • Device: Galaxy S20
  • OS: Android 12

Package:

  • talker_flutter 0.12.0

custom date/time and header format

Perhaps I'm missing something, but there does not appear to be an easy way to customize the date/time format of the log entries or the metadata header. For example, instead of
[WARNING] | 20:38:08 851ms | this is my log message
the developer might prefer
[WARN 2023-12-13 20:38:08.851] this is my log message

From what I can tell, to make this change one would have to override or add new methods to TalkerDateTimeFormatter then either override TalkerDataInterface.displayTitleWithTime or create a custom TalkerDataInterface, and then somewhere, replace the default versions with your custom/overridden versions of these classes.

Describe the solution you'd like
to be able to define the metadata header format as easily as creating and using a custom LoggerFormatter

Describe alternatives you've considered
I'm aware you can create an entirely custom log type, however this prevents you from using the default talker.info, talker.debug, etc and you're stuck with talker.logTyped(YourCustomLog('Something like your own service message'));

Additional context
There is a lot to like about talker and the ecosystem you've built but given all the possible customization options, it feels strange to not be able to re-define the metadata header format.

TalkerObserver onException/onError/onLog provide dynamic object for additional information passed through by handle method

Is your feature request related to a problem? Please describe.
Just getting Error Details (exception, reason, stack) limits the ability to provide more context information. You can run into situations where just having these isn't enough to identify the cause and you want to send additional information like local variables or the arguments that were passed in to the crashing function. In my case I want to attach custom properties to a Crashlytics report.

Describe the solution you'd like
You should be able to set an optional dynamic object to the handle method, that then can be accessed in a talker observer.
Example of calling .handle:

final item = getItemById(id);
try {
// Something might throw when using the amount
}
catch(e,st){
final context = {"itemAmount": item.amount};
talker.handle(e,st, "Couldn't modify item amount", context);
}

Example of a TalkerObserver using the context

 Function(TalkerException e) get onException => (e) {
       final report =   FirebaseCrashlytics.instance;
       e.context.ForEach((key,value) => {
              report.setCustomKey(key,value);
       });
       report.recordError(e.exception, stack: e.stackTrace, reason: e.message);
      };

Describe alternatives you've considered
Alternatively you could write your own error handler, but you would lose all the benefits of this package.

Additional context
The idea with additional context information is based on structured logging in the .net world.

Crashlytics is it send twice errors?

It is really a useful library
I want to add crashlytics integration but I wonder what will happen if I receive a crash in Talker and Crashlytics catches it too
By default Crashlytics catches errors so is this a duplicate catch if I add a CrashlyticsTalkerObserver

  void onError(err) {
      FirebaseCrashlytics.instance.recordError(
        err.error,
        err.stackTrace,
        reason: err.message,
      );
  }

TalkerFlutter.init() not printing logs onto console with iOS 16

Describe the bug
When developing on physical iOS device, TalkerFlutter.init() is not printing logs onto the console.

Smartphone:

  • Device: iPhone 13 Pro Max
  • OS: 16.6
  • Flutter Version: 3.13.0 (stable)

Additional context
When i shifted to just Talker(), it worked but prints special characters before and after the message - <....>

Не выводит логи в дебаг консоль на macos

При отладке приложения с целевой платформой macos, перестали выводиться логи в консоль отладки. Т.е. всё что вывожу принтом выводится а всё что вывожу Talker'ом нет. Появился этот баг пару дней назад.
Macos sanoma 14.1.1
Flutter 3.16.2
Dart 3.2.2
talker_flutter 3.5.6

Stack trace not printed when throwing String

Describe the bug
Stack trace not printed when throwing String (or any type except Error/Exception).

To Reproduce
Call talker.log('message', exception: 'Exception message', stackTrace: stack); in try-catch

Expected behavior
Prints stack trace

Solution?
String exceptions are mapped to TalkerLog (in error_handler.dart:8) and this interface not includes stackTrace in itsgenerateTextMessage() function.

talker_dio_logger exception when hot reloading: Addon currently exist

Describe the bug
talker_dio_logger interceptor crashes when app is hot reloaded.

To Reproduce

  1. Talker deps:
  talker: ^2.4.0
  talker_flutter: ^2.4.1
  talker_dio_logger: ^1.3.0
  1. Set up Talker as singleton:
import 'package:talker_flutter/talker_flutter.dart';

class Logger {
  Logger._();

  static final instance = TalkerFlutter.init();
}
  1. Register dio interceptor:
dio.interceptors.add(
      TalkerDioLogger(
        talker: Logger.instance,
        settings: const TalkerDioLoggerSettings(
          printRequestHeaders: true,
          printResponseHeaders: true,
          printResponseMessage: false,
        ),
      ),
    );
  1. Initial run works fine, however, any hot reload crashes with the following error:
======== Exception caught by widgets library =======================================================
The following _Exception was thrown building Builder(dirty, dependencies: [_LocalizationsScope-[GlobalKey#05c0e]]):
Exception: Addon currently exist

The relevant error-causing widget was: 
  MaterialApp MaterialApp:file:///Users/oleg/Projects/app/lib/main.dart:85:34
When the exception was thrown, this was the stack: 
#0      Talker.registerAddon (package:talker/src/talker.dart:306:7)
#1      new TalkerDioLogger (package:talker_dio_logger/talker_dio_logger_interceptor.dart:18:13)
#2      new Api (package:app/services/api.dart:26:7)
#3      new TokenApi (package:app/services/token_api.dart:10:35)
#4      AppRouter.router.<anonymous closure> (package:app/navigation/app_router.dart:58:34)
#5      RouteBuilder._buildPageForRoute (package:go_router/src/builder.dart:297:27)
#6      RouteBuilder._buildRecursive (package:go_router/src/builder.dart:184:34)
#7      RouteBuilder.buildPages (package:go_router/src/builder.dart:143:7)

Expected behavior
Hot reload would happen without any issues.

Smartphone:

  • Device: iPhone 14 simulator
  • OS: iOS 16.2

Same issue happens in latest Chrome on Mac OS.

[✓] Flutter (Channel stable, 3.7.3, on macOS 12.6.3 21G419 darwin-arm64, locale en-NO)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[!] Android Studio (version 2022.1)
    ✗ Unable to find bundled Java version.
[✓] Android Studio (version 2021.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.3.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.3.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.3.1)
[✓] VS Code (version 1.75.1)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

RenderFlex overflow error while using the TalkerScreen.

Describe the bug
When I've included the TalkerScreen into my page screen I've gotten the RenderFlex overflow error.

To Reproduce
Here is my source code
Steps to reproduce the behavior:

  1. Add and open the TalkerScreen widget on any page
  2. Include the following code on the main.dart:
    FlutterError.onError = (details) => GetIt.I<Talker>().handle(details.exception, details.stack);
  3. See the error

Expected behavior
No RenderFlex overflow errors while using the TalkerScreen.

Screenshots
image
image

Desktop (please complete the following information):

  • OS: [e.g. MacOS]
  • Version [e.g. 13.4]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone14 Pro Max]
  • OS: [e.g. iOS16.4]

4.0 How to migrate from Talker.good() (& others?)

I'm not sure how to migrate from Talker.good(). There's no mention of its removal that I can find in the changelog, and I also can't find a migration guide posted anywhere. Also, WellKnownTitles has been removed, and I assume has been replaced with TalkerLogType, but there's no title property on that either.

Logs be saved automatically

Hi, Thank you for great package.
Can logs be saved automatically on the phone? Regardless of whether the app crashes or the user closes it, I want to keep all old logs. Is there any way to prevent old bugs from being cleared from history when the app crashes or closes?

Sophisticated log message retriving

Is your feature request related to a problem? Please describe.
As of right now, its only possible to get the entire combined message of a TalkerDataInterface.
I have seen that internally, this message is used and then picked apart again with a Regex in the flutter_talker implementation,
so that certain texts can be displayed in the UI.

Describe the solution you'd like
I feel like it would be nicer if separate parts of the message could be gotten without knowing the exact type of the TalkerDataInterface at hand.

Additional context
Locally, I have already written extensions to provide such a mechanic, though it would be really cool to have something similar inbuilt.
Here is what it looks like in my code;

extension Messages on TalkerDataInterface {
  String get logShort {
    switch (runtimeType) {
      case TalkerException:
        return displayException;
      case TalkerError:
        return displayError;
      case TalkerLog:
        return '${message?.substring(0, 30)}...'; // arbitrarily picked 30.
      default:
        return '';
    }
  }

  String get logLong {
    switch (runtimeType) {
      case TalkerException:
        return '$displayException\n\n$displayStackTrace';
      case TalkerError:
        return '$displayError\n\n$displayStackTrace';
      case TalkerLog:
        return message ?? '';
      default:
        return '';
    }
  }

  String get logTitle {
    return '$displayTitle | ${(DateFormat.jms(Platform.localeName)).format(time)}.${time.millisecond}';
  }

  String get logMessage {
    return '$logTitle\n\n$logLong';
  }
}

in this code we have:

  • short text (ellipsed message/error message/exception without stacktrace),
  • long text (full message, error/exception with stacktrace)
  • just title
  • entirety (title + long).

The package has functions to get the title with and without timestamp as well as the entire message,
but there are no methods to get the body alone or parts of the body.

(relying on less runtimeType would also be good)

Проблема с сборкой проекта с talker_flutter 3 5 4

С установленным talker_flutter не собирается сборка. Ошибка:
`Launching lib\main.dart on SM M315F in debug mode...
�訡�� � �ଠ� ��ࠬ��� -

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:checkDebugDuplicateClasses'.

A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.7.10 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10)
Duplicate class kotlin.internal.jdk7.JDK7PlatformImplementations found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk7-1.7.10 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10)
Duplicate class kotlin.internal.jdk7.JDK7PlatformImplementations$ReflectSdkVersion found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk7-1.7.10 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10)
Duplicate class kotlin.internal.jdk8.JDK8PlatformImplementations found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.7.10 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10)
Duplicate class kotlin.internal.jdk8.JDK8PlatformImplementations$ReflectSdkVersion found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.7.10 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10)
Duplicate class kotlin.io.path.ExperimentalPathApi found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk7-1.7.10 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10)
Duplicate class kotlin.io.path.PathRelativizer found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk7-1.7.10 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10)
Duplicate class kotlin.io.path.PathsKt found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk7-1.7.10 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10)
Duplicate class kotlin.io.path.PathsKt__PathReadWriteKt found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk7-1.7.10 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10)
Duplicate class kotlin.io.path.PathsKt__PathUtilsKt found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk7-1.7.10 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10)
Duplicate class kotlin.jdk7.AutoCloseableKt found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk7-1.7.10 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10)
Duplicate class kotlin.jvm.jdk8.JvmRepeatableKt found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.7.10 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10)
Duplicate class kotlin.jvm.optionals.OptionalsKt found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.7.10 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10)
Duplicate class kotlin.random.jdk8.PlatformThreadLocalRandom found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.7.10 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10)
Duplicate class kotlin.streams.jdk8.StreamsKt found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.7.10 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$1 found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.7.10 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$2 found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.7.10 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$3 found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.7.10 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$4 found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.7.10 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10)
Duplicate class kotlin.text.jdk8.RegexExtensionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.7.10 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10)
Duplicate class kotlin.time.jdk8.DurationConversionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.10 (org.jetbrains.kotlin:kotlin-stdlib:1.8.10) and jetified-kotlin-stdlib-jdk8-1.7.10 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10)

 Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.
  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

BUILD FAILED in 40s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
build.gradle android/buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}

dependencies {
    classpath 'com.android.tools.build:gradle:7.3.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}

}

allprojects {
repositories {
google()
mavenCentral()
}
}

rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
delete rootProject.buildDir
}
build.gradle app/gradleplugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

android {
namespace "com.example.hackaton2"
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
    jvmTarget = '1.8'
}

sourceSets {
    main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    applicationId "com.example.hackaton2"
    // You can update the following values to match your application needs.
    // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
    minSdkVersion flutter.minSdkVersion
    targetSdkVersion flutter.targetSdkVersion
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
}

buildTypes {
    release {
        // TODO: Add your own signing config for the release build.
        // Signing with the debug keys for now, so `flutter run --release` works.
        signingConfig signingConfigs.debug
    }
}

}

flutter {
source '../..'
}

dependencies {}
`

Member not found: 'MediaQuery.paddingOf'

After updating the pubspec dependencies, i think the package probably broke after the #131

image

I'm using flutter version 3.7.12 and this method inside the MediaQuery is probably something on the newer versions.

This is probably a breaking change

Some special character added to debug console when using ios simulator

Xcode build done.                                            7.8s
Connecting to VM Service at ws://127.0.0.1:52154/Aby-yF-KYa4=/ws
flutter: \^[[38;5;255m┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────<…>
flutter: \^[[38;5;255m│ [DEBUG] | 3:25:56 664ms | Provider is: NotifierProviderImpl<CounterNotifier, int> <…>
flutter: \^[[38;5;255m│ previous value: 0<…>
flutter: \^[[38;5;255m│ new value: 1<…>
flutter: \^[[38;5;255m└──────────────────────────────────────────────────────────────────────────────────────────────────────────────<…>
flutter: Hello
flutter: \^[[38;5;255m┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────<…>
flutter: \^[[38;5;255m│ [DEBUG] | 3:25:57 1ms | Provider is: NotifierProviderImpl<CounterNotifier, int> <…>
flutter: \^[[38;5;255m│ previous value: 1<…>
flutter: \^[[38;5;255m│ new value: 2<…>
flutter: \^[[38;5;255m└──────────────────────────────────────────────────────────────────────────────────────────────────────────────<…>
flutter: Hello

Screenshot 2023-03-17 at 3 26 58 AM

dio log every line have '<…>'

Hi all, new user with talker and have a question, I'm using TalkerDioLogger like this:
image

The log looks like this:

image

every single line has a '<…>', is that a problem or I'm missing some settings of talker? Thank you.

Support share_plus 7.0.0

Is your feature request related to a problem? Please describe.

Because talker_flutter 2.4.3 depends on share_plus ^6.3.1 and no versions of talker_flutter match >2.4.3 <3.0.0, talker_flutter ^2.4.3 requires share_plus ^6.3.1.

share_plus

TalkerScreen does not respect configured LogLevel setting

Describe the bug
TalkerScreen does not respect configured LogLevel while console logs do respect it.

I initialize a global Talker instance like this:

late final Talker logger;

void main() {
  logger = TalkerFlutter.init(
    logger: TalkerLogger(
      settings: TalkerLoggerSettings(level: LogLevel.warning),
    ),
  );

  runApp(const App());
}

And create a TalkerScreen like this:

showDialog(
  context: context,
  builder: (_) => SimpleDialog(
    children: [
      SizedBox(
        width: 1000,
        height: 600,
        child: TalkerScreen(
          appBarTitle: 'Logs',
          talker: logger, // same global instance
        ),
      ),
    ],
  ),
);

When running, I can see that console logs are outputted correctly – only warnings and more severe, but TalkerScreen still shows all logs, even those that should be filtered out.

Expected behavior
Both console and TalkerScreen correctly filter out logs based on configured LogLevel.

Additional context
Flutter Web
talker_flutter: 3.5.6

Text color not always visible

Describe the bug
TalkerScreenTheme textColor is not used consistently throughout the TalkerScreen page

To Reproduce
Steps to reproduce the behavior:

  1. Create talkerscreen with white background
  2. go to talkerscreen
  3. you'll see that not all text is readable

Expected behavior
Text to be readable when background is not dark

Screenshots
Screenshot 2024-01-15 at 16 50 39
Screenshot 2024-01-15 at 16 50 32

Copying too much log error

Describe the bug
If i try to copy the logs with "Copy all logs", i get this error if the text is too large. I'm getting the error on Android emulator.

_PlatformException(error, android.os.TransactionTooLargeException: data parcel size 3366808 bytes, null, java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 3366808 bytes
at android.content.ClipboardManager.setPrimaryClip(ClipboardManager.java:107)
at io.flutter.plugin.platform.b.t(Unknown Source:16)
at io.flutter.plugin.platform.b.c(Unknown Source:0)
at io.flutter.plugin.platform.b$a.j(Unknown Source:2)
at y3.i$a.onMethodCall(Unknown Source:237)
at z3.k$a.a(Unknown Source:17)
at n3.c.l(Unknown Source:18)
at n3.c.m(Unknown Source:20)
at n3.c.i(Unknown Source:0)
at n3.b.run(Unknown Source:12)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: android.os.TransactionTooLargeException: data parcel size 3366808 bytes
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(BinderProxy.java:540)
at android.content.IClipboard$Stub$Proxy.setPrimaryClip(IClipboard.java:288)
at android.content.ClipboardManager.setPrimaryClip(ClipboardManager.java:105)
... 16 more)
#0 JSONMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:181)
#1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:296)
#2 Clipboard.setData (package:flutter/src/services/clipboard.dart:38) /

Expected behavior
Maybe the snackBar that pop up, should say the log is too big for copying, try share logs as a file.

Replace matrix transformation with negative position

In the TalkerDataCard as of right now, matrix transformations are used to align the title.
This seems a bit more complex than needed.

transform: Matrix4.translationValues(0, -8, 0),

I propose a different solution, which would be to simply specify a negative value for the position of the Positioned in the Stack.
Like this:

Positioned(
  left: 15,
  top: -8,
  child: Container(
    color: options.backgroudColor,
    padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 10),
    child: Text(
      title,
      style: TextStyle(
        color: _color,
        fontSize: 16,
        fontWeight: FontWeight.bold,
      ),
    ),
  ),
),

it is also possible to make elements placed outside of the bounds of the Stack visible:

Stack(
  clipBehavior: Clip.none,

by disabling its clipping. I dont think we need that here though.

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.