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 wildcard for customPrettifiers option #431

Open
ankology opened this issue Jun 13, 2023 · 1 comment
Open

Allow wildcard for customPrettifiers option #431

ankology opened this issue Jun 13, 2023 · 1 comment

Comments

@ankology
Copy link

When not using the nestedKey Pino option, it's hard to figure a way to custom pretty the value log based on coming keys, by example using util.inspect():

customPrettifiers: {      
    //when using a nestedKey option key like 'payload' its easy to perform visual changes, but when log merge the values it's not.
    payload(value) {

        return util.inspect(value, {

            depth: null,
            breakLength: 4,
            colors: true
        });
    },
    //A custom wildcard for any other non-setted keys can be useful
    '*'(value) {

        return util.inspect(value, {

            depth: null,
            breakLength: 4,
            colors: true
        });
    },
},

//Expect foo and other keys to be auto inspected by '*' callback:
logger.info({foo: {bar: {zoo: -1}}});
@jsumners
Copy link
Member

jsumners commented Sep 4, 2023

Would you like to send a Pull Request to address this issue? Remember to add unit tests.

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

2 participants