diegohaz / diegohaz/constate

Allow user to control console

Open
#104 2 comments 6 reactions 0 assignees View on GitHub
discussion enhancement
Dominant language
TypeScript
Stars
4k
Forks
94
Avg merge
27m
Merged PRs (30d)
43

Description

I currently intentionally have some providers as optional, so I often get console warnings from constate about the provider not being provided.
```typescript
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.

```typescript
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(.....);
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.