2.0.0 • Published 2 months ago

@forlagshuset/audit-logging v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Audit Logging

Library to facilitate constructing and sending audit log messages.

Usecase

const auditLog = new AuditLog({
  actorType: ActorType.IP;
  actionType: ActionType.Object;
  objectType: ObjectType.FacebookUser;
  service: {
    type: ServiceType.App;
    id: 'service.name';
  };
});
const auditLogger = new BaseAuditLogger("audit.subject", auditLog, console);
const req = /* any object that we can take data from, typically it should be a request */ {actor_id: 3, object_id: 4}
const params = {
  actorIdGetter: (req: any) => req.actor_id,
  objectIdGetter: (req: any) => req.object_id,
  action: ActionVerb.MODIFIED,
}
await auditLogger.log(params, req);