# @dbcdk/dbc-audittrail-logger

> DBC Audit log module made for use in projects based on nodejs and JavaScript at DBC

Latest version **1.0.1-1** (published 2020-10-30) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install @dbcdk/dbc-audittrail-logger
pnpm add @dbcdk/dbc-audittrail-logger
yarn add @dbcdk/dbc-audittrail-logger
bun add @dbcdk/dbc-audittrail-logger
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1-1 |
| Published | 2020-10-30 |
| First published | 2020-10-28 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=12.0.0 |
| Dependencies | 0 |
| Unpacked size | 15.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | dbcdk |
| Maintainers | dbcdk |
| Keywords | dbc, dbcdk, audit |

## Links

- npm: https://www.npmjs.com/package/@dbcdk/dbc-audittrail-logger
- Repository: https://gitlab.dbc.dk/pu/audit/audit-trail-js
- Issues: https://gitlab.dbc.dk/pu/audit/audit-trail-js/-/issues
- npm.io page: https://npm.io/package/@dbcdk/dbc-audittrail-logger

## Recent versions

- 1.0.1-1 (latest) — 2020-10-30
- 1.0.1-0 — 2020-10-30
- 1.0.0 — 2020-10-28

## README

# DBC Audit trail module for JS

## installation

`npm i @dbcdk/dbc-audittrail-logger`

## Methods & Parameters

The main method is `auditTrace`. It takes the following arguments:

- `action:string`: read|write|login
- `appName:string`: identifier of application
- `clientIps:array`: list of client ips
- `accessingUser:object`: identifier for user accessing data. Most often in the form `{login_token: 'some-valid-token'}` but can also be a login `{login: 'user-id', group: 'netpunkt'}`
- `owningUser:string`: String that can identify the user owning the data
- `accessInfo:object`: accessed information

Actions kan be retrieved as a constant from `ACTIONS`. Values are `read|write|login`.

## Usage

```js
import {auditTrace, ACTIONS} from '@dbcdk/dbc-audittrail-logger';

const applicationName = 'bibliotekdk';
const ips = ['10.10.10.0']; // if using express you can retrieve the list through req.ips()
const owning_user = '1234561010';
const accessing_user = {
  login_token: 'some-valid-token',
};
const accessInfo = {
  loan: '12345',
};
auditTrace(
  ACTIONS.read,
  applicationName,
  ips,
  accessing_user,
  owning_user,
  accessInfo
);
```

## Test

`npm run test`

---
_Source: https://npm.io/package/@dbcdk/dbc-audittrail-logger · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
