Giter VIP home page Giter VIP logo

redux_logging's Issues

State: Instance of 'AppState'

I would like to see the actual output of the AppState, i.e. my state object. But I get only this message:

State: Instance of 'AppState'

Upgrade logging package to 1.2.0

Hi !

Thanks for this package, its very useful.
Could you just update the logging package to 1.2.0?
This causes conflicts in some projects.

Thank you very much

printer() causes Not a Constant Expression exception when using with Flutter, Dart2 preview

Trying to initialise the store with logging middleware:

import 'package:redux_logging/redux_logging.dart';

class MyApp {
  final store = new Store<AppState>(appReducer,
    initialState: new AppState(), 
    middleware: [new LoggingMiddleware.printer()]
  );
}

But get the following exception at runtime:

Exception has occurred.
'package:redux_logging/redux_logging.dart': error: Not a constant expression.

Appears to be a Flutter/Dart 2 issue, works fine with Flutter and Dart 1.

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.1.5, on Mac OS X 10.13.3 17D102, locale en-AU)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
[✓] Android Studio (version 3.0)
[✓] VS Code (version 1.21.1)
[✓] Connected devices (1 available)

type 'List<Object>' is not a subtype of type 'List<(Store<AppState>, dynamic, (dynamic) => void) => void>'

Error

Launching lib/main.dart on iPhone X in debug mode...
[VERBOSE-2:dart_error.cc(16)] Unhandled exception:
type 'List<Object>' is not a subtype of type 'List<(Store<AppState>, dynamic, (dynamic) => void) => void>'
#0      new TangboleApp (file:///Users/jagger/projects/tangbole/app/lib/main.dart:36:79)
#1      main (file:///Users/jagger/projects/tangbole/app/lib/main.dart:18:10)
#2      _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:279:19)
#3      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:165:12)

Code

...

    final persistor = Persistor<AppState>(
      storage: FlutterStorage('tangbole'),
      decoder: AppState.fromJson,
      version: 10000,
      migrations: {},
    );

    var mws = [persistor.createMiddleware()];
    mws.addAll(createMiddlewares());
    mws.add(LoggingMiddleware.printer());

    final store = Store<AppState>(
      appReducer,
      initialState: AppState(),
      middleware: mws,
    );

    persistor.load(store);

...

Env

name: tangbole
description: A tumblr client app.

dependencies:
  cupertino_icons: ^0.1.2
  english_words: ^3.1.0
  flutter:
    sdk: flutter
  flutter_redux: ^0.5.1
  http: ^0.11.3+16
  meta: ^1.1.5
  redux: ^3.0.0
  redux_logging: ^0.3.0
  redux_persist: ^0.7.0-rc.2
  redux_persist_flutter: ^0.6.0-rc.1

dev_dependencies:
  flutter_driver:
    sdk: flutter
  flutter_test:
    sdk: flutter
  mockito: ^2.2.3

flutter:
  uses-material-design: true
  assets:
    - images/lake.jpg

usage with built_redux

Hi guys
Actually this is a question.
When can use this loggin with built_redux?

Thank you in advance

Logging only displays so many lines

When the logging is too many lines of my AppState, the logging is cut off.

When home.toString is short:

I/flutter ( 3632):       me: {
I/flutter ( 3632):         user: { id: 2, socialType: SocialType.facebook, socialId: 1905457732907903, displayName: Curious Chloe, email: [email protected] },
I/flutter ( 3632):       },
I/flutter ( 3632):       home: {
I/flutter ( 3632):         stores: 19 stores,
I/flutter ( 3632):       },
I/flutter ( 3632):       user: Instance of 'UserState',
I/flutter ( 3632):       reward: Instance of 'RewardState',
I/flutter ( 3632):       error: {
I/flutter ( 3632):         message: null,
I/flutter ( 3632):       }
I/flutter ( 3632):     }, ts: 2018-12-01 02:38:08.406835}

When home.toString is too long:

I/flutter ( 3632):       me: {
I/flutter ( 3632):         user: { id: 2, socialType: SocialType.facebook, socialId: 1905457732907903, displayName: Curious Chloe, email: [email protected] },
I/flutter ( 3632):       },
I/flutter ( 3632):       home: {
I/flutter ( 3632):         stores: {4: { id: 4, name: Burn's Cafe }, 5: { id: 5, name: Red Sparrow Pizza }, 6: { id: 6, name: Cie Lest }, 7: { id: 7, name: The Hungry Cartel }, 8: { id: 8, name: Higher Ground }, 15: { id: 15, name: CoCo Fresh Tea & Juice }, 16: { id: 16, name: CoCo Fresh Tea & Juice }, 10: { id: 10, name: CoCo Fresh Tea & Juice }, 11: { id: 11, name: CoCo Fresh Tea & Juice }, 12: { id: 12, name: CoCo Fresh Tea & Juice }, 13: { id: 13, name: CoCo Fresh Tea & Juice }, 14: { id: 14, name: CoCo Fresh Tea & Juice }, 3: { id: 3, name: Workshop Meowpresso }, 9: { id: 9, name: 8bit }, 2: { id: 2, name: Sokyo }, 1: { id: 1, name: Dumplings & Co. }, 17: { id: 17, name: Mad Mex }, 18: { id: 18, name: Mad Mex }, 19: { id: 19, name: Mad Mex }},
I/flutter ( 3632):       },
I/flutter ( 3632):       user: Instance 

Since the last line was cut off at user: Instance maybe it's a character limit???

Flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.11.9, on Microsoft Windows [Version 10.0.17134.407], locale en-AU)
[!] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    X Android license status unknown.
[√] Android Studio (version 3.1)
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
[√] IntelliJ IDEA Ultimate Edition (version 2018.2)
[√] IntelliJ IDEA Ultimate Edition (version 2018.3)
[√] Connected device (1 available)

! Doctor found issues in 1 category.

Dependencies:

    flutter:
        sdk: flutter
    redux: ^3.0.0
    flutter_redux: ^0.5.2
    redux_logging: ^0.3.0
    redux_thunk: ^0.2.0
    redux_persist_flutter: ^0.8.0-rc.0
    redux_persist: ^0.8.0-rc.0
    flutter_facebook_login: ^1.1.1
    google_sign_in: ^3.2.4
    http: ^0.12.0
    graphql_flutter: ^0.9.4
    cupertino_icons: ^0.1.2
    timeago: ^2.0.9
    intl: ^0.15.7
    flutter_svg: ^0.6.3

Maybe this is the desired behaviour?

Thanks for taking the time to read my issue.

Make timestamp optional in formatter

2020-06-22 02:57:32.185 INFO Redux - {
  Action: Clear Sprints Action,
  State: {
      sprints: []
    },
  Timestamp: 2020-06-22 02:57:32.185
}

Hi, I would love to make timestamp optional here. We can create our custom formatter to solve this issue but would be really great if timestamp is boolean in default formatter

redux_logging

// A simple formatter that puts all data on one line
  static String singleLineFormatter(
    dynamic state,
    dynamic action,
    DateTime timestamp,
  ) {
    return "{Action: $action, State: $state, ts: ${new DateTime.now()}}";
  }

  /// A formatter that puts each attribute on it's own line
  static String multiLineFormatter(
    dynamic state,
    dynamic action,
    DateTime timestamp,
  ) {
    return "{\n" +
        "  Action: $action,\n" +
        "  State: $state,\n" +
        "  Timestamp: ${new DateTime.now()}\n" +
        "}";
  }

Support redux ^4.0.0

Currently can't use flutter redux with this library as it requires redux version ^4.0.0.

How to print all action properties?

I've come from the JS world and printing the object props was the default behaviour there.
Here everything is classes and printing a class gives me just the instance: Instance of MyAction.

Maybe there's some known recipe to make a redux_logging behave like a JS version?

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.