# @dkuida/logger-wrapper

> commodity wrapper

Latest version **1.6.0-beta5** (published 2019-08-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install @dkuida/logger-wrapper
pnpm add @dkuida/logger-wrapper
yarn add @dkuida/logger-wrapper
bun add @dkuida/logger-wrapper
```

## 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.6.0-beta5 |
| Published | 2019-08-15 |
| First published | 2018-11-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.0.0 |
| Dependencies | 0 |
| Unpacked size | 14.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Dan Kuida |
| Maintainers | dkuida |
| Keywords | logger |

## Links

- npm: https://www.npmjs.com/package/@dkuida/logger-wrapper
- Repository: https://github.com/dkuida/logger-wrapper
- Homepage: https://github.com/dkuida/logger-wrapper#readme
- Issues: https://github.com/dkuida/logger-wrapper
- npm.io page: https://npm.io/package/@dkuida/logger-wrapper

## 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.6.0-beta5 (latest) — 2019-08-15
- 1.6.0-beta3 — 2019-08-15
- 1.6.0-beta1 — 2019-08-15
- 1.6.0-beta0 — 2019-08-09
- 1.5.3 — 2019-05-06
- 1.5.2 — 2019-05-04
- 1.5.1 — 2019-05-04
- 1.4.24 — 2019-05-04
- 1.4.23 — 2019-05-04
- 1.4.22 — 2019-05-04
- 1.4.16 — 2019-01-15
- 1.4.15 — 2018-11-26
- 1.4.14 — 2018-11-26
- 1.4.13 — 2018-11-04
- 1.4.12 — 2018-11-02
- … 4 more at https://npm.io/package/@dkuida/logger-wrapper/versions

## README

[![Build Status](https://travis-ci.com/dkuida/logger-wrapper.svg?branch=master)](https://travis-ci.com/dkuida/logger-wrapper)
# wrapper for winston configuration loader

## Build Setup

``` bash
# Install dependencies
npm install @dkuida/logger-wrapper
```

## usage

### short version 

check the example folder

###longer version
the config file will initialize the availbale transports by passing the configuration to each 

* console - official winston console

* file - official winston file logger

* fluentd - using [fluent-logger](https://github.com/fluent/fluent-logger-node)

* logstash - have a look at [winston-logstash-transport](https://github.com/dkuida/winston-logstash)

* service - a common name that will be identify the project/service
create a singleton loader in the form of 

```typescript
 import logger from '@dkuida/logger-wrapper';
 import * as loggerConfig from './config/logger';
 const loggerInstance = logger(loggerConfig);
 
 export default loggerInstance;
```

use the logger wherever you need
```typescript
import loggerInstance from './logger';
const logger = loggerInstance(module);
logger.info('HELLO');
```

The label for the log message is extracted from the (module) - and is the file in which the call was invoked.
In case you use [moleculer.js](https://moleculer.services/) you can add a property

```typescript
labelExtractors: [LabelExtractor.moleculer]
```

which allow on service call to extract the labels for the nodes/brokers

## Breaking changes

###### 1.6.x
* winston, winston-logstash-transport, fluentd-logger are all peer dependencies now.

###### 1.5.x
* the logger is not exported as default from the library
* fatal level removed

# License
The project is available under the [MIT license](https://tldrlegal.com/license/mit-license).

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