sitemap.js icon indicating copy to clipboard operation
sitemap.js copied to clipboard

[Feature] replace console logs with logger

Open marcoreni opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe. After #337, some references to console.warn are still in the codebase:

  • https://github.com/ekalinin/sitemap.js/blob/965c4a77d9034d5e8aab8843aac76d8853a4a629/lib/utils.ts#L64
  • https://github.com/ekalinin/sitemap.js/blob/965c4a77d9034d5e8aab8843aac76d8853a4a629/lib/utils.ts#L74

It should be useful to switch to a logger implementation entirely.

Describe the solution you'd like 1- Pass a logger inside the options, that defaults to console. (for backwards compatibility), 2- AND/OR allow to pass a custom "handleError" function as an option, so that we can customize the handling of internal errors.

marcoreni avatar Feb 17 '21 09:02 marcoreni

Thanks for your PR. I've merged and released it. It looks like validator's console.warn still needs to be handled. I'll take a look at that tomorrow.

derduher avatar Feb 17 '21 20:02 derduher