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

[Discussion] Should be there two different functions: makeLoggable and makeAutoLoggable? #40

Open
inoyakaigor opened this issue Mar 30, 2023 · 2 comments

Comments

@inoyakaigor
Copy link
Contributor

Currently I added mobx-log and got wall of text:
image
I don't need almost all of this logs exclude few specific so I think it will be better split function makeLoggable to two almost the same:
makeAutoLoggable and makeLoggable. Difference between these is almost the same as makeAutoObservable and makeObservable:

constructor() {
  makeAutoLoggable(this)
}
constructor() {
  makeLoggable(this, [
    'methodName1', 
    'methodName2', 
    'variable1', 
  ])
}

i.e. makeLoggable requires explicit definition of methods/variables that should be logged.

I think it can be handful.

@kubk
Copy link
Owner

kubk commented Mar 30, 2023

It's a good idea and there are such feature requests already: #24

Introducing makeAutoLoggable is going to be a BC break, so we can stick with the following API:

makeLoggable(this) - logs everything related to the store
makeLoggable(this, { filters: { events: { computed: true } } }) - logs only computed related to store. It's already implemented: https://github.com/kubk/mobx-log#log-observables--computeds--actions-of-a-specific-store
makeLoggable(this, { filters: { events: { computed: ['isEven'] } } }) - could log only changes in isEven computed.

Seems like a nice addition. No ETA from my side yet, but I'll try to take into account that issue since it's getting quite popular.

@TechAkayy
Copy link
Contributor

This will be very valuable. Thanks for having this under your radar!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants