hg-pyun / axios-logger

Beautify Axios Logging Messages
MIT License
169 stars 33 forks source link

Add body trimming #55

Open Fylipp opened 4 years ago

Fylipp commented 4 years ago

When logging the bodies of large requests or responses it would make sense to allow them to be limited to a certain size. Otherwise large bodies clutter the console without adding value.

hg-pyun commented 4 years ago

Great idea. But I think It can be controlled by axios maxContentLength property. This part looks good to delegate to axios.

Fylipp commented 4 years ago

The problem is that an application might need the entire response. For my use case I expect to receive multiple kilobytes of text data and it all has to be processed, meaning I need Axios to properly treat the response (ruling out maxContentLength). However, this fills up the logs with lots of clutter from the logging. Being able to only the log the first 100 characters or so would allow logging to be used with large responses.

hg-pyun commented 4 years ago

Oh, I see. You means that It need to limit for only log data. I will consider. Thank you for feedback.

giogonzo commented 2 years ago

👍 this would be very helpful

richardscholten commented 1 year ago

https://github.com/hg-pyun/axios-logger/pull/129

ducnguyen-healthemed commented 2 months ago

@hg-pyun Could you please take a look on #129 and merge it?