Giter Club home page Giter Club logo

Comments (17)

RobinTail avatar RobinTail commented on July 28, 2024 1

Need to check prototype in isBuiltinLoggerConfig.

Confirmed, @boarush
Thank you for reporting this.

from express-zod-api.

RobinTail avatar RobinTail commented on July 28, 2024 1

No-no, it does not interfere in their operation. It's just a check of the object shape.

from express-zod-api.

boarush avatar boarush commented on July 28, 2024 1

I think you misunderstood me, I am agreeing with what you suggested.

from express-zod-api.

boarush avatar boarush commented on July 28, 2024 1

@RobinTail I had also been using it in production with Winston specifically with v18. Didn't really face any issue or crashes.

from express-zod-api.

RobinTail avatar RobinTail commented on July 28, 2024 1

🚀 Should be fixed in v19.1.2 , @boarush
I tested it on your repo.
Thank you once again for your contribution!
I highly appreciate it.

from express-zod-api.

boarush avatar boarush commented on July 28, 2024 1

Thanks for the speedy fix!

from express-zod-api.

RobinTail avatar RobinTail commented on July 28, 2024 1

You need to set both levels and level.
Last one acts as a filter (ignores what's below it), @boarush

from express-zod-api.

RobinTail avatar RobinTail commented on July 28, 2024 1

@boarush , configuring winston is not easy, so I moved from it.
But you can check out how it was configured in v17 for inspiration

return create({
silent: isSilent,
levels: npm.levels,
exitOnError: false,
transports: [
new transports.Console({
level: isSilent ? "warn" : config.level,
handleExceptions: true,
format: combine(
useTimestamp(),
...(config.color ? [colorize()] : []),
customFormat,
),

from express-zod-api.

boarush avatar boarush commented on July 28, 2024 1

Yep, it works, thanks a lot again!

from express-zod-api.

RobinTail avatar RobinTail commented on July 28, 2024

Seems to be similar to #1605 , @boarush

image

Trying to figure out why

from express-zod-api.

boarush avatar boarush commented on July 28, 2024

Was trying to figure it out myself, couldn't really narrow it down 😅

from express-zod-api.

RobinTail avatar RobinTail commented on July 28, 2024

The issue comes from the the problem of distinguishing a built-in logger config from an instance of actual logger.
I think I'm going to apply an inverted logic there, instead of isBuiltinLoggerConfig() it will be isActualLogger(), and use expression like this to check for the presence of a logging method both in the supplied argument and its prototype (class instance case).

"debug" in logger || "debug" in Object.getPrototypeOf(logger)

from express-zod-api.

boarush avatar boarush commented on July 28, 2024

I think this is general enough to not break popular logging libraries.

from express-zod-api.

RobinTail avatar RobinTail commented on July 28, 2024

Ok, thank you.
I checked the documentation:
in on the logger itself should actually be enough, since it does check the prototype chain.

from express-zod-api.

RobinTail avatar RobinTail commented on July 28, 2024

Checked this statement

worked as expected in v18

The issue is present in v18.

from express-zod-api.

boarush avatar boarush commented on July 28, 2024

Trying it my example repo with the latest v18 release, it worked. Not sure about other cases though.

from express-zod-api.

boarush avatar boarush commented on July 28, 2024

@RobinTail Another question, with winston, I'm only able to use 4 severity (debug, info, warn and error), all others don't work. How do I enable those for it? Have tried setting the levels config in winston.createLogger, and then using the generic logger.log with different levels, but it straight up ignores the logs for any severity other than these four.

from express-zod-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.