# logbrok

> Simple logger that add some colors to node's default console. Inspired by consolation: https://github.com/alexjab/consolation.git

Latest version **0.1.4** (published 2014-09-28) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2014-09-28 |
| First published | 2014-07-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Hugo Müller |
| Maintainers | hmuller |
| Keywords | color, colors, console, logger, log, lightweight |

## Links

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

## 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

- 0.1.4 (latest) — 2014-09-28
- 0.1.3 — 2014-07-04
- 0.1.2 — 2014-07-04
- 0.1.1 — 2014-07-04
- 0.1.0 — 2014-07-04

## README

logbrok
=======

[![NPM version](https://badge.fury.io/js/logbrok.png)](http://badge.fury.io/js/logbrok)

Simple logger that add some colors to node's default console.  
Inspired by [consolation](https://github.com/alexjab/consolation.git).

-------

![image](http://i.imgur.com/YPZabhd.png?1)

Installation
------------

    npm install logbrok

Usage
-----

###Basic Usage

    var console = require('logbrok')(__filename);
    
    console.info('this is an information');
    console.log('hello');
    console.warn('warning!');
    console.error('ERROR!!!');

You can also chain method calls:

    console
      .info('this is an information')
      .log('hello')
      .warn('warning!')
      .error('ERROR!!!');

###Extented Usage

#####Options

You can pass some options when instanciating the logger:

    var console = require('logbrok')({ title: __filename, log_level: 'warn', color: true });
    
The available options you can use are:

 - `title [String]`: a custom title for the logger. It can be the filename, or whatever you want. (default is `null`),
 - `color [Boolean]`: whether to output colored lines or not. `false` is a good choice if you need to output the log lines to a file (default is `true`),
 - `bright [Boolean]`: whether to use bright colors, or normal colors. It has no effect if color is false (default is `true`),
 - `time [Boolean]`: whether to display the record time on each line, or not (default is `true`),
 - `show_date [Boolean]`: whether to display the full date time, or just the time. It has no effect if time is false (default is `true`),
 - `log_level [String]`: the minimum level of log. The supported levels are: `['info', 'log', 'warn', 'error']` (default is `'log'`).

**Note**: The title is parsed using *path.basename*. So, `'my/own/custom.title'` becomes `'custom.title'`.

#####Change the options

If you want, you can change some options after the instanciation.

    var console = require('logbrok')({ title: __filename, color: true });
    
    console
      .error('this error is printed in red!')
      .set({color: false})
      .error('and this one is printed with the default color...');

Running tests
-------------

Unit Tests are run with [mocha](http://visionmedia.github.io/mocha/).
You need to install this framework in order to run the tests:
    
    npm install mocha -g

Then, to run the tests, simply do:

    npm test

License
-------

[The MIT License](https://github.com/HugoMuller/logbrok/blob/master/LICENSE)

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