# bower-logger

> The logger used in the various architecture components of Bower.

Latest version **0.2.2** (published 2014-01-14) · 0 weekly downloads

## Install

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

## 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.2.2 |
| Published | 2014-01-14 |
| First published | 2013-07-20 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.8.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Twitter |
| Maintainers | satazor, wibblymat, paulirish |

## Links

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

## Recent versions

- 0.2.2 (latest) — 2014-01-14
- 0.2.1 — 2013-08-19
- 0.2.0 — 2013-08-18
- 0.1.0 — 2013-07-27
- 0.1.0-rc.1 — 2013-07-20

## README

# bower-logger [![Build Status](https://secure.travis-ci.org/bower/logger.png?branch=master)](http://travis-ci.org/bower/logger)

The logger used in the various architecture components of Bower.


## Usage

### .error(id, message, data)

Alias to `.log('error', id. message, data)`


### .conflict(id, message, data)

Alias to `.log('conflict', id. message, data)`


### .warn(id, message, data)

Alias to `.log('warn', id. message, data)`


### .action(id, message, data)

Alias to `.log('action', id. message, data)`


### .info(id, message, data)

Alias to `.log('info', id. message, data)`


### .debug(id, message, data)

Alias to `.log('debug', id. message, data)`


### .log(level, id, message, data)

Emits a `log` event, with an object like so:

```js
logger.log('warn', 'foo', 'bar', { dog: 'loves cat' })
{
    level: 'warn',
    id: 'foo',
    message: 'bar',
    data: {
        dog: 'loves cat'
    }
}
```


### .prompt(prompts, callback)

Emits a `prompt` event with an array of `prompts` with a `callback`.   
`prompts` can be an object or an array of objects. The `callback` will be called with an
the answer or an object of answers (if prompts was only one or an array respectively).
The `callback` is guaranteed to run only once.

```js
logger.on('prompt', function (prompts, callback) {
    // "prompts" is always an array of prompts
    // Call "callback" with an object of answers when done

    // In this example, we will use the inquirer module to do the
    // prompting for us
    inquirer(prompts, callback);
})

logger.prompt({
    type: 'input'  // Can be 'input', 'confirm' or 'password'
    message: 'Type something',
    validate: function (value) {
        if (value !== 'I am awesome') {
            return 'You must type "I am awesome"'
        }

        return true;
    }
}, function (err, answer) {
    // Error will only happen on unsupported 'type'
    if (err) {
        return console.error(err.message);
    }

    console.log(answer);
});


```


### .pipe(logger)

Pipes all logger events to another logger.   
Basically all events emitted with `.emit()` will get piped.


### .geminate()

Creates a new logger that pipes events to the parent logger.   
Alias for `(new Logger()).pipe(logger)`.


### .intercept(fn)

Intercepts `log` events, calling `fn` before listeners of the instance.


### #LEVELS

A static property that contains an object where keys are the recognized log levels and values their importance.   
The higher the importance, the more important the level is.


## License

Released under the [MIT License](http://www.opensource.org/licenses/mit-license.php).

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