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

Allow user to control console #104

Open
MattShrider opened this issue Mar 5, 2020 · 1 comment
Open

Allow user to control console #104

MattShrider opened this issue Mar 5, 2020 · 1 comment
Labels
discussion enhancement New feature or request

Comments

@MattShrider
Copy link

MattShrider commented Mar 5, 2020

I currently intentionally have some providers as optional, so I often get console warnings from constate about the provider not being provided.

    if (isDev && value === NO_PROVIDER) {
      // eslint-disable-next-line no-console
      console.warn("[constate] Component not wrapped within a Provider.");
    }

I would like to hide them for my use-case. I'd recommend the feature be "fixed" by allowing the user to add their own console object, then it would be up to the user to filter this specific message.

import constate, { useConsole } from 'constate';
import log from 'loglevel';

const constateLogger= log.getLogger('constate');
constateLogger.setLevel(log.levels.ERROR);
useConsole(constateLogger)

const [Provider, hook] = constate(.....);
@aspirisen
Copy link

Hi, any updates on optional providers? I think it is often case when you have no providers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants