# @digipolis/log

> Logging tool for Digipolis kibana logging

Latest version **1.1.2** (published 2026-07-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @digipolis/log
pnpm add @digipolis/log
yarn add @digipolis/log
bun add @digipolis/log
```

## Health

**Score 45/100 (D)** — status: active.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2026-07-07 |
| First published | 2021-12-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 16.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Olivier Van den Mooter |
| Maintainers | trianglejuice, lievenvg, stefanpante, vademo, jan-bart |
| Keywords | digipolis, antwerpen, log, logger |

## Links

- npm: https://www.npmjs.com/package/@digipolis/log
- Repository: https://github.com/digipolisantwerp/log_module_nodejs
- Homepage: https://github.com/digipolisantwerp/log_module_nodejs#readme
- Issues: https://github.com/digipolisantwerp/log_module_nodejs/issues
- npm.io page: https://npm.io/package/@digipolis/log

## 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.1.2 (latest) — 2026-07-07
- 1.1.1 — 2025-08-12
- 1.1.0 — 2023-11-06
- 1.0.2 — 2023-10-20
- 1.0.1 — 2023-08-16
- 1.0.0 — 2023-08-10
- 0.4.0 — 2022-10-11
- 0.3.1 — 2022-07-08
- 0.3.0 — 2022-02-23
- 0.2.0 — 2022-02-10
- 0.1.1 — 2021-12-23
- 0.1.0 — 2021-12-17
- 0.0.6 — 2021-12-16
- 0.0.5 — 2021-12-15
- 0.0.4 — 2021-12-15
- … 3 more at https://npm.io/package/@digipolis/log/versions

## README

![CI](https://github.com/digipolisantwerp/log_module_nodejs/actions/workflows/ci.yml/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/digipolisantwerp/log_module_nodejs/badge.svg?branch=main)](https://coveralls.io/github/digipolisantwerp/log_module_nodejs?branch=main)
[![npm version](https://badge.fury.io/js/@digipolis%2Flog.svg)](https://badge.fury.io/js/%40digipolis%2Flog)

**npm:** [npmjs.com/package/@digipolis/log](https://www.npmjs.com/package/@digipolis/log)
# @digipolis/log
<img src="assets/log.svg" alt="log" width="100"/>

Log helper which converts default logs to indexable json log.


### Table of contents:

<!--ts-->
   * [Installing](#installing)
      * [npm](#npm)
      * [Yarn](#yarn)
   * [Configuration](#configuration)
   * [Logging](#logging)
   * [Running the tests](#running-the-tests)
   * [Dependencies](#dependencies)
   * [Versioning](#versioning)
   * [Authors](#authors)
   * [License](#license)
<!--te-->

## Spec
[https://github.com/digipolisantwerpdocumentation/logging-requirements](https://github.com/digipolisantwerpdocumentation/logging-requirements)
## Installing

#### npm:
```sh
$ npm i @digipolis/log
```

#### Yarn:
```sh
$ yarn add @digipolis/log
```

## Configuration

### Params:
| Param                       | Description                                              | Values                                                           |
| :---                        | :---                                                     | :---                                                             |
| ***type*** *(optional)*     | Set logging mode                                         | **log** (default) / **json** / **text** / **silent**             |
| ***override*** *(optional)* | Set to override given console (default)                  | **true** / **false** (default)                                   |
| ***level*** *(optional)*    | Set the log level (given level and higher will be logged | **debug** (default) / **info** / **log** / **warn** / **error**  |

## Examples

##### Example:
```javascript
const digipolisLogger = require('@digipolis/log');

const mylogger = digipolisLogger(console, {
  type: 'text', // log(default) | json | text
  override: false, // false(default) | true
});

// human readable for local development
mylogger.log('hello');
/*
type: 'text' -> INFO: 2021-12-01T09:43:19.173Z hello
*/

const mylogger = digipolisLogger(console, {
  type: 'json', // log(default) | json | text
  override: false, // false(default) | true
});

// human readable json local development
mylogger.log('hello');
/*
type: 'json' -> {
  message: 'hello',
  timestamp: '2021-12-01T09:44:20.565Z',
  type: [ 'technical' ],
  level: 'INFO',
  correlationId: ''
}
*/

const mylogger = digipolisLogger(console, {
  type: 'log', // log(default) | json | text
  override: false, // false(default) | true
});
// log for kibana json for production
mylogger.log('hello');
/*
type: 'log' -> {"message":"hello","timestamp":"2021-12-01T09:45:56.515Z","type":["technical"],"level":"INFO","correlationId":""}
*/

const mylogger = digipolisLogger(console, {
  type: 'log', // log(default) | json | text
  override: false, // false(default) | true
  level: "error", // debug(default) | info | log | warn | error
});
// log for kibana json for production only error
mylogger.log('logmessage'); // -> won't be visible
mylogger.error('error');
/*
type: 'log' ->
type: 'error' -> {"message":"error","timestamp":"2021-12-01T09:45:56.515Z","type":["technical"],"level":"ERROR","correlationId":""}
*/
```
##### Example (override the global log (this will impact more than just your code)):
```javascript
const digipolisLogger = require('@digipolis/log');

digipolisLogger((console, {
  type: 'text', // log(default) | json | text
  override: true, // false(default) | true
});

// human readable for local development
console.log('hello');
/*
type: 'text' -> INFO: 2021-12-01T09:43:19.173Z hello
*/

digipolisLogger((console, {
  type: 'json', // log(default) | json | text
  override: true, // false(default) | true
});
// human readable json local development
console.log('hello');
/*
type: 'json' -> {
  message: 'hello',
  timestamp: '2021-12-01T09:44:20.565Z',
  type: [ 'technical' ],
  level: 'INFO',
  correlationId: ''
}
*/

digipolisLogger((console, {
  type: 'log', // log(default) | json | text
  override: true, // false(default) | true
});
// log for kibana json for production
console.log('hello');
/*
type: 'log' -> {"message":"hello","timestamp":"2021-12-01T09:45:56.515Z","type":["technical"],"level":"INFO","correlationId":""}
*/

```


#### output examples
```javascript

// type: json
console.log('hello');
/*
{
  message: 'hello',
  timestamp: '2021-12-01T09:44:20.565Z',
  type: [ 'technical' ],
  level: 'INFO',
  correlationId: ''
}
*/

// type: json
console.error('hello');
/*
{
  message: 'hello',
  timestamp: '2021-12-01T09:44:20.565Z',
  type: [ 'technical' ],
  level: 'ERROR',
  correlationId: ''
}
// type: json
*/

console.error(new Error('Errormessage'));
/*
{
  message: 'Errormessage Error: Errormessage\n' +
    '    at Object.<anonymous> (/Users/oliviervandenmooter/Projects/Digipolis/diglog/example/index.js:17:13)\n' +
    '    at Module._compile (node:internal/modules/cjs/loader:1095:14)\n' +
    '    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1124:10)\n' +
    '    at Module.load (node:internal/modules/cjs/loader:975:32)\n' +
    '    at Function.Module._load (node:internal/modules/cjs/loader:816:12)\n' +
    '    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)\n' +
    '    at node:internal/main/run_main_module:17:47',
  timestamp: '2021-12-01T11:00:13.073Z',
  type: [ 'technical' ],
  level: 'ERROR',
  correlationId: ''
}
*/

// structured message
console.log({ message: 'logmessage2', timestamp: 'timestamp123' })
/*
{
  message: 'logmessage2',
  timestamp: 'timestamp123',
  type: [ 'technical' ],
  level: 'INFO',
  correlationId: ''
}

// structured message with extra params
*/
console.log({ message: 'logmessage2', timestamp: 'timestamp123', extra_param1: "extra_value" });

/*
{
  message: 'logmessage2 Extrainfo: {"extra_param1":"extra_value"}',
  timestamp: 'timestamp123',
  type: [ 'technical' ],
  level: 'INFO',
  correlationId: ''
}
*/
```


## Running the tests

Run the tests in this repo:

```bash
$ npm run test
$ npm run coverage
```
## Dependencies

none.

## Versioning

We use [SemVer](http://semver.org/)

for versioning. For the released version check changelog / tags

## Contributing

Pull requests are always welcome, however keep the following things in mind:

- New features (both breaking and non-breaking) should always be discussed with the [repo's owner](#support). If possible, please open an issue first to discuss what you would like to change.
- Fork this repo and issue your fix or new feature via a pull request.
- Please make sure to update tests as appropriate. Also check possible linting errors and update the CHANGELOG if applicable.

## Authors

* Olivier Van den Mooter (<olivier.vandenmooter@digipolis.be>) - Initial work - [Vademo](https://github.com/vademo)

See also the list of [contributors](https://github.com/digipolisantwerp/log_module_nodejs/graphs/contributors) who participated in this project.

## License

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details

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