# nbrest-logger

> Basic logging framework for node apps

Latest version **1.0.7** (published 2023-12-06) · ISC license · 0 weekly downloads

## Install

```sh
npm install nbrest-logger
pnpm add nbrest-logger
yarn add nbrest-logger
bun add nbrest-logger
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: no vulnerabilities; high maintenance score.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2023-12-06 |
| First published | 2022-07-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | nbrest |
| Maintainers | nbrest |
| Keywords | logger |

## Links

- npm: https://www.npmjs.com/package/nbrest-logger
- Repository: https://github.com/nbrest/kamehouse
- Homepage: https://github.com/nbrest/kamehouse/blob/dev/node/modules/nbrest-logger/
- Issues: https://github.com/nbrest/kamehouse/issues
- npm.io page: https://npm.io/package/nbrest-logger

## 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.0.7 (latest) — 2023-12-06
- 1.0.6 — 2023-12-06
- 1.0.5 — 2023-12-06
- 1.0.4 — 2022-07-24
- 1.0.3 — 2022-07-24
- 1.0.2 — 2022-07-24
- 1.0.1 — 2022-07-24
- 1.0.0 — 2022-07-24

## README

| [Home](/README.md) | [Docs](/docs/README.md) |
---------------------------------------------------------------

*********************

# nbrest-logger:

Basic logging framework to format logs to the console in a node app.

# Install or Update:

- In the root of your node app:

```sh
npm i nbrest-logger
```

# Usage:

```js
const logger = require("nbrest-logger");
logger.trace("my message");
logger.debug("my message");
logger.info("my message");
logger.warn("my message");
logger.error("my message");
```

- Change the log level during runtime:
```js
logger.setLogLevel("ERROR");
logger.setLogLevel("WARN");
logger.setLogLevel("DEBUG");
logger.setLogLevel("trace");
```

- The default log level is `INFO`, so `DEBUG` and `TRACE` entries are hidden by default. To change the log level at application startup, pass the log or LOG argument to your node app:

```sh
npm start LOG=TRACE // enables both trace and debug logs
npm start log=debug // enables debug logs
npm start log=warn // set log level to warn
npm start log=error // set log level to error
```

# Output:

```
> sample-express-server@1.0.0 start
> npm run devserver LOG=trace


> sample-express-server@1.0.0 devserver
> node ./server/node/server.js LOG=trace

2023-12-06 23:01:53 - [INFO] - Overriding logLevel with command line parameter log: trace mapped to logLevelNumber: 4
2023-12-06 23:01:54 - [TRACE] - Finished initializing nbrest-logger
2023-12-06 23:01:54 - [INFO] - Initializing endpoints
2023-12-06 23:01:54 - [INFO] - Startup server
2023-12-06 23:01:54 - [DEBUG] - my DEBUG message
2023-12-06 23:01:54 - [TRACE] - my TRACE message
2023-12-06 23:01:54 - [INFO] - Listening on http://localhost:8080
```

# Publish:

- Update version in `package.json`
- Publish changes to [npmjs](https://www.npmjs.com/package/nbrest-logger) with:

```sh
npm publish
```

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