How to make app log?

I would like to save a user in-app activity log to analyze . is there any suggestion for this porpuse?

A way of doing it is NgRX and a logger middleware. Another way is to implement a LogProvider and call a log method of this provider every time the user does an action.

Firebase also has a nifty solution for event logging (if that what you are looking for)

Thanks @Technbuzz , I am using loopback and mongodb it has some limits to use firebase.

Thanks @Nexi I’m not familiar with them which of the is easy with minimum over head in app.

Why not google analytics?

NgRX is heavy overload. It uses the redux state management model and it is a very good way of implementing event sourcing (every change and action gets logged and persisted). Because all actions of the user, the system or other apis go in a similar form through an event bus, it is easy to log every event that happens.

A more easy way of logging actions is to write a provider for it. Then everywhere where an action is triggered by the user call logger.log('action description'). But it is hard to do a recommendation without knowing what exactly your requirements are:

  • timestamp
  • userId / deviceId or anonymous
  • buffer and persist events on the device when in offline mode
  • ask user for logging permissions

I am In Iran and because of US lows and sanctions.

My app is shopping idea there for i want to collect user’s interested and most visited menu items/categories/places AND app crashes, Failes and …


hope you will find an alternative

@reedrichards thank you so much and , Great Thanks For Ionic Friends.

1 Like

Build a LoggingProvider with a log method that sends a message to your server with HttpClient everytime you call the log method. For error logging, extend ionics error handler and use your logging provider inside of it.

1 Like