'ReactJS Logging to External File

Is there a way, or a library in React or something that allows me to do something similar to Error Boundary (a small piece of code I can add at just one point that acts as a catch all) but for general logging/tracing instead?

Basically, I want to be able to log when a user navigates to any page or click on any button or does anything(at least user navigation, user interaction and user input) on a page without having to individually add something like console.log to every function, on top of logging errors as well.

The logging will then be sent to an external file, or at least in a way that I can send to an external file.

The logging to meant to keep track when other people use my app.

Preferably not a 3rd party tool like Sentry, rollbar or LogRocket.

I've checked a couple of other similar question on SO and some of them are referring to (really) outdated libraries, which may or may not be viable. So, I'm also hoping for something more recent(or at least up to date)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source