# qiot-io-logger

> A logging library for bunyan streams to manage local file system and GELF deployments

Latest version **1.0.3** (published 2017-02-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install qiot-io-logger
pnpm add qiot-io-logger
yarn add qiot-io-logger
bun add qiot-io-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.3 |
| Published | 2017-02-21 |
| First published | 2017-02-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | hello@quantumiot.com |
| Maintainers | awolverton |

## Links

- npm: https://www.npmjs.com/package/qiot-io-logger
- Repository: https://github.com/QuantumIOT/qiot-io-logger
- Homepage: https://github.com/QuantumIOT/qiot-io-logger#readme
- Issues: https://github.com/QuantumIOT/qiot-io-logger/issues
- npm.io page: https://npm.io/package/qiot-io-logger

## Dependencies (2)

- [bunyan](https://npm.io/package/bunyan.md) ^1.8.5
- [gelf-stream](https://npm.io/package/gelf-stream.md) ^1.1.1

## Recent versions

- 1.0.3 (latest) — 2017-02-21
- 1.0.2 — 2017-02-21

## README

*qiot-io-logger* is a simple library based on [bunyan](https://github.com/trentm/node-bunyan)

It aims to provide a default configuration to satisfy qiot.io logging needs.

## Usage

```
const qiotLogger = require('qiot-io-logger');

const logger = qiotLogger.createLogger({ name: 'myapp' });
```

This will create a new logger only with STDOUT output. `name` option is *required*

## Streams configurations

STDOUT, GELF and ROTATING_FILE are default outputs for logging. It means, that
the library will ask for its configuration, but not fail. Anyway, it's going to
log a warning message saying that wasn't able to load the configuration and will skip the output.

If you want to specify STREAMS to avoid this warning, you can:

```
const logger = qiotLogger.createLogger({
  name: 'myapp'
}, ['stdout']);
```

### STDOUT

This is the default stream to log. It uses `info` as default level.
If you want to provide a different level you can overwrite this doing:

```
const logger = qiotLogger.createLogger({
  name: 'myapp',
  stdout: {
    level: 'debug',
  },
});
```

### GELF

```
const logger = qiotLogger.createLogger({
  name: 'myapp',
  gelf: {
    level: 'debug',
    url: 'localhost',
    port: 12201,
  },
});
```

`level` (`info` is used by default) and `port` can be omitted but `url` configuration is required.

### ROTATING FILE

```
const logger = qiotLogger.createLogger({
  name: 'myapp',
  'rotating-file': {
    level: 'debug',
    path: 'folder/file',
  },
});
```

`path` configuration is required.

It uses these configurations by default (all of them can be overwritten):

```
{
  level: 'info',
  period: '1d', # daily rotation
  count: 7, # keep 7 back copies
}
```

## Other Configurations

Please refer to [bunyan](https://github.com/trentm/node-bunyan) documentation, to check out more options.

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