Compound js log user's actions

1.3k Views Asked by At

I need to find a way to log user's activities in my Compound.JS + MongoDB app.

It would be great to create a table and insert information like who (what login) updated/created/deleted which record in what table, what fields were changed from what to what?

I thought there might be a npm-package for this, but so far in google I find only about logging (writing to log-file) which is not what I want.

1

There are 1 best solutions below

2
On

If you want to save it to a MongoDB collection, why not just create a model for it and save away?

LoggingModel.create({ user : req.session.user.id, action : "Created a new user." });
LoggingModel.create({ user : req.session.user.id, action: "Deleted user with id " + aId + "."});