pinojs / pino-pretty

🌲Basic prettifier for Pino log lines
MIT License
1.27k stars 150 forks source link

feat: adding possibility to pass an object as parameter to customLevels #400

Closed ademarsj closed 1 year ago

ademarsj commented 1 year ago

Hello, i made the changes to make possible pass in code as object or string the customLevels prop, it's still compatible with the CLI passing as string parameter. I already wrote the tests too and keeps on the 100% coverage and asserted.

Is relative to #399 .

ademarsj commented 1 year ago

I appreciate the request and comments, i fixed them, but i got some doubts/points:

jsumners commented 1 year ago
  • I noticed that in handleCustomlevelNamesOpts method when passing an object as parameter the return is practically the same object that is passed, but i didn't remove the logic because of the lower case transformation, do you think it's appropriate to leave it that way ? Or just return the object as it came (expecting that the user will always pass an object with properties names already in lower case), and pass to lower case only in string mode ?

I would review the git blame for the implementation and the PRs that introduced it. The discussion therein should answer these questions.

  • I added the docs to the PrettyOptions with examples, I hope I made right

I don't understand. What is PrettyOptions?

ademarsj commented 1 year ago

I would review the git blame for the implementation and the PRs that introduced it. The discussion therein should answer these questions.

I did it, in this PR, as it was just passed as a string it always will transform to lower case to make the attributes names to the object returned, now it will receive an object, if the object received it's already with lower case in his attributes names the for loop is useless, once it will return an object same as received.

I don't understand. What is PrettyOptions? The name of the Interface in index.d.ts which describes the pino-pretty options.

I will fix the English errors that you appointed soon.

ademarsj commented 1 year ago

Done, sorry for the bad english.

jsumners commented 1 year ago

Done, sorry for the bad english.

No worries. That's what reviews are for.