Skip to content

fagbokforlaget/audit-logging

Repository files navigation

[DEPRECATED]

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);