cabinjs / axe

:axe: Logger-agnostic wrapper that normalizes logs regardless of arg style. Great for large dev teams, old/new projects, and works w/Pino, Bunyan, Winston, console, and more. It is lightweight, performant, highly-configurable, and automatically adds OS, CPU, and Git information to your logs. Hooks, dot-notation remap, omit, and pick of metadata.
https://forwardemail.net/docs/best-practices-for-node-js-logging
MIT License
50 stars 11 forks source link

Feature request/discuss: drop superagent for native solution. #10

Closed spence-s closed 2 years ago

spence-s commented 3 years ago

This is simply just a matter of front end bundle size. superagent is a rather big lib when bundled for front end and takes more than a third of the total size of axe....

Many front end applications are already tied to some form of http lib and if it isn't super agent this could discourage adoption. fetch is likely already polyfilled in most modern applications and/or we could expose an api to allow the user to plug in their own solution.

https://bundlephobia.com/result?p=axe@8.0.0

titanism commented 2 years ago

I think using undici https://github.com/nodejs/undici on server and axios https://github.com/axios/axios with https://github.com/softonic/axios-retry in the browser might be a good approach. This implementation could be done using a wrapper which gets loaded using browser in pkg to load a different wrapper for the browser (the one with axios). I'm not sure if undici supports retries though, so might need to use something like https://www.npmjs.com/package/p-retry.

titanism commented 2 years ago

We completely dropped superagent and now the package is super lightweight. See the docs, you can use an async or Promise fn in the post-hooks for however you want to capture stuff over HTTP or elsewhere with Pino (e.g. to Sentry/Bugsnag/your server/whatever transport you want)