sitemap.js
sitemap.js copied to clipboard
[Feature] replace console logs with logger
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.
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.