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

[Feature] shimLog other console functions #97

Open
svemat01 opened this issue Feb 20, 2022 · 3 comments
Open

[Feature] shimLog other console functions #97

svemat01 opened this issue Feb 20, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@svemat01
Copy link
Member

Is your feature request related to a problem? Please describe.
The shimLog feature allows us to overwrite console.log to a logger method, there are however many more methods in console that we should be able to override such as console.info, console.warn, and console.error

Describe the solution you'd like
optionally pass an object into shimLog instead of a string for the logger method to use. the object would have optional for each one and would only replace those included in the object.

// Replaces `console.log` with `log.debug` !
shimLog(log, 'debug');

// Replaces `console.?` with `log.?` !
shimLog(log, {
    log: 'debug',
    info: 'info',
    warn: 'warn',
    error: 'error',
});

Describe alternatives you've considered
Importing the normal logger everywhere

@svemat01 svemat01 added the enhancement New feature or request label Feb 20, 2022
@svemat01 svemat01 self-assigned this Feb 20, 2022
@lucemans
Copy link
Member

lucemans commented Feb 20, 2022

I am very much in favor of this proposed solution.

@Antony1060
Copy link
Contributor

Agree, but do keep in mind that console.error doesn't write to stdout but stderr

@lucemans
Copy link
Member

Research the purpose of outputting to stderr and potential reasons we would want such? Or potentially a way to customize output depending on logging method? Such that error goes to stderr ?

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

No branches or pull requests

3 participants