# stream-logger

> Wrapper on top of buster-evented-logger that does pretty outout to stdout and stderr.

Latest version **1.0.1** (published 2015-11-14) · BSD-3-Clause license · 0 weekly downloads

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

## Install

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

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2015-11-14 |
| First published | 2012-06-20 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Christian Johansen |
| Maintainers | augustl, cjohansen, dominykas, dwittner |

## Links

- npm: https://www.npmjs.com/package/stream-logger
- Repository: https://github.com/busterjs/stream-logger
- Homepage: https://github.com/busterjs/stream-logger#readme
- Issues: https://github.com/busterjs/stream-logger/issues
- npm.io page: https://npm.io/package/stream-logger

## Dependencies (1)

- [evented-logger](https://npm.io/package/evented-logger.md) 1.x

## Recent versions

- 1.0.1 (latest) — 2015-11-14
- 1.0.0 — 2013-09-16
- 0.3.1 — 2013-09-16
- 0.3.0 — 2012-06-20

## README

# stream-logger

[![Build status](https://secure.travis-ci.org/busterjs/stream-logger.png?branch=master)](http://travis-ci.org/busterjs/stream-logger)

> Log messages, events and stdout/stdin (or other) streams

`stream-logger` is a logger that prints certain levels to an out stream and
others to an error stream. It's Based on `evented-logger`, and defaults to
printing to stdout/stderr.


## API


### `streamLogger(out, err)`

Creates a new logger. `out` and `err` are two stream objects. `log`,
`info` and `debug` levels are logged to the `out` stream, while `warn`
and `error` levels are logged to the `err` stream. If the streams are omitted,
`process.stdout` and `process.stderr` will be used.

```javascript
var streamLogger = require("stream-logger");

var logger = streamLogger();
logger.level = "debug";
logger.info("Hey there"); // Prints to stdout
logger.error("Oh noes");  // Prints to stderr

logger.level = "error";
logger.info("Hmm"); // Prints nothing
```


### `log(...)`

Also: `info`, `debug`, `warning`, `error`.

If the current log level is `log` or higher, prints a message to the `out`
stream. See `evented-logger <http://github.com/busterjs/evented-logger/>`_ for
more information on the logger API


### `streamForLevel(level)`

Returns an object with a `write` method that will indirectly log messages to
`level`. Note that messages written to this stream will not automatically
append line-breaks.

```javascript
var streamLogger = require("stream-logger");

var logger = streamLogger();
var stream = logger.streamForLevel("warning");
stream.write("Oh");
stream.write(" noes!\n");

// Prints "Oh noes\n!" to stderr
```

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