imergo-logger
=============

[![NPM Version][npm-image]][npm-url] ![Node][node-version]

This module is a generic [winston][winston] logger wrapper for our imergo-frameworks.
It is a globally configurable logger via environment variables, with default values.

## Install

```shell
npm install imergo-logger
```

## Usage

```javascript
import Logger from "imergo-logger"
const logger = Logger(label | config)
logger.error("This is an error message")
```

Where:
 
- `label`: standard descriptive string
- `config`: standard [winston][winston] configuration object

## Environment variables

| Variable                 | Description                                                                | Default                                                              |
|:-------------------------|:---------------------------------------------------------------------------|----------------------------------------------------------------------|
| `NODE_DEBUG`             | Comma-separated list of module names to be debugged (it accepts wildcards) | None                                                                 |
| `NODE_IMERGO_LOGCONSOLE` | When `false`, it deactivates shell logging                                 | `true`                                                               |
| `NODE_IMERGO_LOGDIR`     | Directory where to store logs                                              | `$HOME/.logs` in POSIX systems or ``%USERPROFILE%\.logs`` in Windows |
| `NODE_IMERGO_LOGFILE`    | Name of the log file                                                       | `imergo.log`                                                         |

## Testing

```shell
npm test
```

## Documentation

To install the documentation locally, run:

```shell
npm run doc
``` 

Available online at:
[https://health-open.pages.fraunhofer.de/imergo-logger/](https://health-open.pages.fraunhofer.de/imergo-logger/)

[node-version]: https://img.shields.io/badge/node-24-orange.svg?style=flat-square
[npm-image]: https://img.shields.io/badge/npm-9.0.2-blue.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/imergo-logger
[winston]: https://github.com/winstonjs/winston
