An open API service indexing awesome lists of open source software.

https://github.com/tomeraberbach/etz

🌴 A humble logger.
https://github.com/tomeraberbach/etz

logger logging npm-module

Last synced: over 1 year ago
JSON representation

🌴 A humble logger.

Awesome Lists containing this project

README

          


etz



version


CI


Sponsor


A humble logger.

## Features

- **Humble:** it just prints pretty filterable logs to the console!
- **Filtering:** use `ETZ` and `NO_ETZ` environment variables to filter
- **Cool Name:** just three letters [transliterated from Hebrew](#faq)

## Install

```sh
$ npm i etz
```

## Usage

**index.js**:

```js
import etz from 'etz'

etz.debug(`Hello World!`)
etz.info(`Hello World!`)
etz.warn(`Hello World!`)
etz.error(`Hello World!`)
```

### Log level

_NOTE: The examples below are not colorized, but they will be in your terminal!_

The default log level is `INFO`:

```shell
$ node index.js
ℹ INFO Hello World!
âš  WARN Hello World!
✖ ERROR Hello World!
```

Set the log level with the `ETZ` environment variable:

```shell
$ node index.js
ℹ INFO Hello World!
âš  WARN Hello World!
✖ ERROR Hello World!

$ ETZ=0 node index.js
★ DEBUG Hello World!
ℹ INFO Hello World!
âš  WARN Hello World!
✖ ERROR Hello World!

$ ETZ=debug node index.js
★ DEBUG Hello World!
ℹ INFO Hello World!
âš  WARN Hello World!
✖ ERROR Hello World!

$ ETZ=3 node index.js
★ DEBUG Hello World!
ℹ INFO Hello World!
âš  WARN Hello World!
✖ ERROR Hello World!

$ ETZ=error node index.js
✖ ERROR Hello World!
```

Suppress all logs with `NO_ETZ`:

```shell
$ NO_ETZ=1 node index.js
```

The value of `NO_ETZ` doesn't matter. Any value works.

## FAQ

### What's with the name?

The Hebrew word for tree, wood, and most importantly _log_ is "×¢×¥", which is
pronounced like "etz".

## Contributing

Stars are always welcome!

For bugs and feature requests,
[please create an issue](https://github.com/TomerAberbach/etz/issues/new).

For pull requests, please read the
[contributing guidelines](https://github.com/TomerAberbach/etz/blob/main/contributing.md).

## License

[Apache License 2.0](https://github.com/TomerAberbach/etz/blob/main/license)

This is not an official Google product.