# bellman

> Yet another console logger. A pretty and powerful one, though.

Latest version **1.1.12** (published 2019-10-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install bellman
pnpm add bellman
yarn add bellman
bun add bellman
```

## 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.1.12 |
| Published | 2019-10-20 |
| First published | 2015-09-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 11.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | nskazki@gmail.com |
| Maintainers | nskazki |
| Keywords | logger |

## Links

- npm: https://www.npmjs.com/package/bellman
- Repository: https://github.com/nskazki/bellman
- Issues: https://github.com/nskazki/bellman/issues
- npm.io page: https://npm.io/package/bellman

## Dependencies (5)

- [chalk](https://npm.io/package/chalk.md) ^2.4.2
- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [moment](https://npm.io/package/moment.md) ^2.24.0
- [uncolor](https://npm.io/package/uncolor.md) ^0.4.0
- [simple-debugger](https://npm.io/package/simple-debugger.md) ^2.0.1

## 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
- [@luma.gl/experimental](https://npm.io/package/@luma.gl/experimental.md) — 77.1K 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

## Recent versions

- 1.1.12 (latest) — 2019-10-20
- 1.1.11 — 2019-10-20
- 1.1.10 — 2019-10-20
- 1.1.9 — 2019-10-19
- 1.1.8 — 2016-02-25
- 1.1.7 — 2016-02-25
- 1.1.6 — 2016-01-28
- 1.1.5 — 2016-01-15
- 1.1.4 — 2016-01-13
- 1.1.3 — 2016-01-13
- 1.1.2 — 2015-12-29
- 1.1.1 — 2015-12-29
- 1.1.0 — 2015-12-29
- 1.0.11 — 2015-10-28
- 1.0.9 — 2015-09-16
- … 8 more at https://npm.io/package/bellman/versions

## README

# Bellman

Yet another console logger. A pretty and powerful one, though.

```
yarn add bellman
```

## Methods

 - `reg` - registers the file from which logging methods will be called to adjust the width of the `:caller` row

### Default config

```js
const Logger = require('bellman')

new Logger()
  .reg()
  .info('info message')
  .debug('debug message')
  .warn('warning message')
  .error('error: %s', new Error())
```

![Default config](/misc/default-config.png)

### Custom config

```js
const Logger = require('bellman')

const userConfig = {
  timeTmp: 'HH:mm',
  lineTmp: ':level :time :caller :message',
  colorize: true,
  callerColor: 'yellow.bold',
  levelMap: {
    debug: 'blue',
    info: 'green',
    panic: 'red'
  },
  levelMin: 'debug',
  isFullStack: true
}

new Logger(userConfig)
  .reg()
  .info('info line')
  .debug('debug line')
  .panic('panic line: %s', new Error())
```

![Custom config](/misc/custom-config.png)

## Config

 - `lineTmp` - sets the logging line format. Supported placeholders:
    * `:time` - a timestamp in the format defined by the `timeTmp` config option
    * `:level` - a name of the logging method that has been called
    * `:caller` - a name of the file and a number of the line from which the logging method has been called
    * `:message` - a formatted message combined from the arguments passed to the logging method ([util.format](https://nodejs.org/api/util.html#util_util_format_format) is used to fromat messages)
 - `timeTmp` - sets the timestamp format ([moment](https://github.com/moment/moment) is used to format timestamps)
 - `colorize` - overrides whether the coloring should be used or not ([chalk](https://github.com/chalk/chalk) is used for colorization)
 - `callerColor` - sets the `:caller` part color.
 - `levelMap` - sets the names, priorities, and colors of the logging methods
 - `levelMin` - sets the logging level
 - `isFullStack` - sets whether the error stack formatter should be used or not
    - if unset, all the lines that refer files out of the project's directory and all the files within `node_modules` directories will be removed
    - if set, no modifications will be applied to the error-stacks
    - `isFullStack` may be overridden with `STACK=full` and `FULLSTACK=true` environment variables

## Events

 - `log` - emits metadata of a logged line:
   - `time` - a formateed timestamp
   - `level` - a name of the logged message that has been called
   - `caller` - a name of the file and a number of the line from which the logging method has been called
   - `message` - a formatted message
   - `args` - arguments passed the logged message

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