# long-con

> Create a console logger w/ formatting, timestamp, color, namespace

Latest version **0.1.3** (published 2013-05-23) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install long-con
pnpm add long-con
yarn add long-con
bun add long-con
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2013-05-23 |
| First published | 2013-05-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | codeactual |
| Keywords | console, log, logger, logging, colors |

## Links

- npm: https://www.npmjs.com/package/long-con
- Repository: https://github.com/codeactual/long-con
- Issues: https://github.com/codeactual/long-con/issues
- npm.io page: https://npm.io/package/long-con

## Dependencies (1)

- [cli-color](https://npm.io/package/cli-color.md) ~0.2.2

## 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.3 (latest) — 2013-05-23
- 0.1.2 — 2013-05-08
- 0.1.1 — 2013-05-07
- 0.1.0 — 2013-05-07

## README

# long-con

Create a console logger w/ formatting, timestamp, color, namespace

[![Build Status](https://travis-ci.org/codeactual/long-con.png)](https://travis-ci.org/codeactual/long-con)

## Examples

### stdout, timestamp, namespaces

```js
var longCon = require('long-con');.create();
longCon.set('time', true).set('namespace', 'myLib');

var log = longCon.create('cache');

// [Sun, 21 Apr 2013 21:33:20 GMT] myLib cache
log('hit key: %s', 'key-name');
```

### stderr, color, no namespace

```js
// namespace: white foreground, red background
// body: white foreground, green background
var log = longCon.create(null, console.error, 'white.bgRed', 'white.bgGreen');
```

See [cli-color](https://github.com/medikoo/cli-color) for color names.

### Automatic object-specific stack trace

```js
function Klass() {
  this.console = longCon.create();
  this.log = this.console.create(null, console.log);
  this.console.traceMethods('Klass', this, this.log, Klass.prototype);
}
Klass.prototype.foo = function() {
  this.log('foo1');
  this.bar();
  this.log('foo2');
};
Klass.prototype.bar = function() {
  this.log('bar1');
  this.baz();
  this.log('bar2');
};
Klass.prototype.baz = function() {
  this.log('baz');
};
(new Klass()).foo();
```

Output:

    Klass#foo
    |    foo1
    |    Klass#bar
    |    |    bar1
    |    |    Klass#baz
    |    |    |    baz
    |    |    bar2
    |    foo2


See [traceMethods()](docs/LongCon.md).

### Manual stack trace

```js
var log = longCon.create(null, console.log);
log.push('foo');
log('msg1')
log.push('bar')
log('msg2')
log.pop();
log.pop();
log('msg3');
```

    foo
    |    msg1
    |    bar
    |    |    msg2
    msg3


## Installation

### [NPM](https://npmjs.org/package/long-con)

    npm install long-con

## API

[Documentation](docs/LongCon.md)

## License

  MIT

## Tests

    npm test

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