jprichardson / node-fs-extra

Node.js: extra methods for the fs object like copy(), remove(), mkdirs()
MIT License
9.44k stars 776 forks source link

refactor: replace console.warn with process.emitWarning #954

Closed lamweili closed 2 years ago

lamweili commented 2 years ago

To have consistent warnings from https://github.com/jprichardson/node-fs-extra/pull/953#issuecomment-1092663914 by @JPeer264

Yes process.emitWarning sounds also like a great option to add (just my opinion on it). However, a separate PR would be nice if you want to go the extra mile as we squash our PRs. @manidlou @RyanZim @jprichardson any objections?

Prints out via process.emitWarning in the following format:

image

RyanZim commented 2 years ago

Should we consider this: https://nodejs.org/api/process.html#avoiding-duplicate-warnings?

lamweili commented 2 years ago

My motivation was to retain the behavior of the console.warn which warns duplicatedly if called multiple times.

Should we change it to use https://nodejs.org/api/process.html#avoiding-duplicate-warnings instead, so it only warns on the first time?

What do you guy think? Let me know and I'll make the adjustments. 😊 @RyanZim @JPeer264 @manidlou @jprichardson