# ns-log

> Easy (yet complete) logging for node and browser

Latest version **0.0.4** (published 2016-10-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install ns-log
pnpm add ns-log
yarn add ns-log
bun add ns-log
```

## 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.0.4 |
| Published | 2016-10-06 |
| First published | 2016-09-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 22 |
| Author | Emery Denuccio |
| Maintainers | emery |
| Keywords | logger, that, does, not, suck |

## Links

- npm: https://www.npmjs.com/package/ns-log
- Repository: https://github.com/em/elem
- Homepage: https://github.com/em/elem#readme
- Issues: https://github.com/em/elem/issues
- npm.io page: https://npm.io/package/ns-log

## 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.0.4 (latest) — 2016-10-06
- 0.0.3 — 2016-10-06
- 0.0.2 — 2016-09-27
- 0.0.1 — 2016-09-27

## README

[![Build Status](https://drone.io/github.com/em/ns-log/status.png)](https://drone.io/github.com/em/ns-log/latest)

# Namespaced Logger

Very simple logger for node and browser.

- Outputs log messages with prefixes
- Globally filter logs by string matching

You can do everything with this.

# Example Usage
```
npm install ns-log
```

```
let log = require('ns-log');
log.enable('[ERROR] [INFO] [WARN]'); // This is just an all-inclusive string match
```

```
let log = require('ns-log').ns('mymodule'); // This just adds 'mymodule' to the beginning of each log line
log.info('Hello');
=> [INFO] my:module 2016-12-1 10:10:10 (UTC) Hello
```

# Log Levels
These are built-in namespaces.

- log.error = log.ns('[ERROR]');
- log.info = log.ns('[INFO]');
- log.warn = log.ns('[WARN]');
- log.debug = log.ns.prefix('[DEBUG]');

```
log.error('error');
log.warn('warn');
log.info('info');
log.debug('debug');
```

# Browser usage 
TODO

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