# @namics/remlog-scheme

> ###### Contents

Latest version **0.2.2** (published 2018-10-10) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @namics/remlog-scheme
pnpm add @namics/remlog-scheme
yarn add @namics/remlog-scheme
bun add @namics/remlog-scheme
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2018-10-10 |
| First published | 2018-01-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 8.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Jan Biasi |
| Maintainers | ddegiorgioo, ernscht, janbiasi, jantimon, namicsorg, regaddi, smollweide |
| Keywords | remote, logging, remlog, node, debug, transport, @namics/remlog, remotely, server |

## Links

- npm: https://www.npmjs.com/package/@namics/remlog-scheme
- Repository: https://github.com/namics/node-remlog
- Homepage: https://github.com/namics/node-remlog#readme
- Issues: https://github.com/namics/node-remlog/issues
- npm.io page: https://npm.io/package/@namics/remlog-scheme

## Dependencies (1)

- [shortid](https://npm.io/package/shortid.md) 2.2.8

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [@luma.gl/experimental](https://npm.io/package/@luma.gl/experimental.md) — 77.1K weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads

## Recent versions

- 0.2.2 (latest) — 2018-10-10
- 0.2.0 — 2018-02-01
- 0.1.9 — 2018-02-01
- 0.1.8 — 2018-01-25
- 0.1.6 — 2018-01-24
- 0.1.4 — 2018-01-23
- 0.1.3 — 2018-01-23
- 0.1.2 — 2018-01-22

## README

# @namics/remlog-scheme

###### Contents

```js
const { fields, Scheme, isSchemeIdValid, isCustomField } = require("@namics/remlog-scheme");
```

### Scheme

##### Class interface

```js
type SchemeValidationType {
	key: string,
	error: Error | null
};

interface IScheme {
	get(): Object;
	validate(): Array<SchemeValidationType>;
	clean(): void;
	serialize(): string;
	toString(): string;
}
```

##### Internal use

```js
const { Scheme } = require("@namics/remlog-scheme");

const examplePayload = {
    shortMessage: "Some message",
    fullMessage: "An extended message for the log",
    level: 5,
    file: "example.js",
    line: 172,
    timestamp: "2018-01-18T15:16:15.244Z"
};

const validCustomPayload = Object.assign({}, examplePayload, {
    $custom: "some data ..." // custom fields are prefixed by dollar
});

const invalidPayload = Object.assign({}, examplePayload, {
    id: "8an204asdf1" // it is not allowed to set the ID manually
});

const validScheme = new Scheme(examplePayload);
validScheme.validate(); // returns []

const validCustomScheme = new Scheme(validCustomPayload);
validCustomScheme.validate(); // returns []

const invalidScheme = new Scheme(invalidPayload);
invalidScheme.validate(); // returns [{key: 'id', error: Error('The key id is a computed field and cannot be set manually.')}]

validScheme.get(); // will return the full scheme including timestamp, id etc.
```

> Review the [Changelog](/packages/scheme/CHANGELOG.md)

---
_Source: https://npm.io/package/@namics/remlog-scheme · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
