# jrf-graylog

> client for Graylog

Latest version **1.0.3** (published 2020-10-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install jrf-graylog
pnpm add jrf-graylog
yarn add jrf-graylog
bun add jrf-graylog
```

## 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.3 |
| Published | 2020-10-05 |
| First published | 2020-08-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 0 |
| Unpacked size | 12.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | jirufik |
| Maintainers | jirufik |
| Keywords | jrf, jrfGraylog, graylog, log, client |

## Links

- npm: https://www.npmjs.com/package/jrf-graylog
- Repository: https://github.com/jirufik/jrf-graylog
- Homepage: https://github.com/jirufik/jrf-graylog#readme
- Issues: https://github.com/jirufik/jrf-graylog/issues
- npm.io page: https://npm.io/package/jrf-graylog

## 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
- [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
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 1.0.3 (latest) — 2020-10-05
- 1.0.2 — 2020-08-24
- 1.0.1 — 2020-08-24
- 1.0.0 — 2020-08-23

## README

# jrf-graylog

## Description 

A package that implements the `udp` logging client for [Graylog](https://www.graylog.org/)

## Example

```js
const Graylog = require('jrf-graylog');

const graylog = new Graylog({
  address: 'graylog.server.address',
  host: 'my-web-project.com',
  node: 'dev.log.test',
  compress: false
});

graylog.log('String line log');
graylog.log({code: 1245, label: 'label'});
graylog.log({code: 1245, label: 'label'}, graylog.level.DEBUG);
graylog.log({code: 1245, label: 'label', level: 6});
graylog.log({code: 1245, label: 'label', level: graylog.level.ALERT});
graylog.log({code: 1245, label: 'label', level: 'error'});

graylog.log({
  data: ['sss', 'sfdsf', 'sfddsf', {odd: {a: 'a', b: {b: [{a: 'a', b: {a: 'a'}}, 'ss']}}}],
  message: 'array data'
});

let error;
try {
  throw new Error('test error');
} catch (e) {
  error = e;
}
graylog.error(error);
graylog.error({message: 'exec test error', error});

graylog.info('info');
graylog.debug('debug');
graylog.emergency('emergency');
graylog.alert('alert');
graylog.critical('critical');
graylog.notice('notice');
```

## Levels

`graylog.level[levelNameUppercase]`

| code | name | description |
|---|---|---|
| 0 | emergency | system is unusable |
| 1 | alert | action must be taken immediately |
| 2 | critical | critical conditions |
| 3 | error | error conditions |
| 4 | warning | warning conditions |
| 5 | notice | normal, but significant, condition |
| 6 | info | informational message |
| 7 | debug | debug level message |

## Constructor

| name | type | default | description |
|---|---|---|---|
| port | number | 12201 | port on server |
| address | string | localhost | Address Graylog server |
| host | string |  | client hostname |
| node | string | node | client node name |
| defaultLevel | string/number/Object | INFO | default log level |
| compress | boolean | true | log data compression |

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