kwelch / babel-plugin-captains-log

Babel plugin that injects helpful details into console statements
MIT License
85 stars 5 forks source link

Added support for changing the logger name #35

Closed amrdraz closed 4 years ago

amrdraz commented 4 years ago

So I wrap the console in a package that does other logging things and also calls console.log I would like the path and function call to refer to where I called the logger, and not inside the actual logger.

allow referencing logger.info instead of console.info or whatever name the user specifies.

In this PR in addition to doing that I also memoized buildOptions for maybe a bit of performance since the options don't change and no need to run reduce every time.

I also upgraded the packages as I was getting a node-gyp build error due to legacy packages

The package now assumes at least node 14 (the current version as of this PR) since node 14 supports esModules I removed the legacy fs and path dev dependencies

I made the mistake of upgrading prettier which affected all the PR sorry about that.

I think change g the node or jest version also affected the snapshot generated, but I did that over 2 commits in order for the change brought by my code to be clear, where I added just one test for my purposed option.

kwelch commented 4 years ago

Thanks!

kwelch commented 4 years ago

This change has been released under v1.3.2 on npm