# nomatic-logger

> Seriously awesome logging library built for Node.js

Latest version **0.0.5** (published 2017-03-27) · ISC license · 0 weekly downloads

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

## Install

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

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2017-03-27 |
| First published | 2017-03-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Brian D. Foster |
| Maintainers | bdfoster |
| Keywords | logger, logging, typescript, nomatic, nomatic-lib |

## Links

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

## Dependencies (3)

- [@types/node](https://npm.io/package/@types/node.md) ^7.0.11
- [string-format](https://npm.io/package/string-format.md) ^0.5.0
- [nomatic-events](https://npm.io/package/nomatic-events.md) ^2.0.0

## 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.5 (latest) — 2017-03-27
- 0.0.4 — 2017-03-27
- 0.0.3 — 2017-03-27
- 0.0.2 — 2017-03-27
- 0.0.1 — 2017-03-27

## README

# nomatic-logger
[![Build Status](https://travis-ci.org/bdfoster/nomatic-logger.svg?branch=master)](https://travis-ci.org/bdfoster/nomatic-logger) [![Coverage Status](https://coveralls.io/repos/github/bdfoster/nomatic-logger/badge.svg?branch=master)](https://coveralls.io/github/bdfoster/nomatic-logger?branch=master)

Get serious about logging. This library takes the best concepts of
[winston](https://github.com/winstonjs/winston) and
[bunyan](https://github.com/trentm/node-bunyan) but diverges to create
an extremely flexible yet elegant logging solution.

To create a logger:
```javascript
const logger = require('nomatic-logger');

// logger.create(namespace: string)
const logger = logging.create('test');
```

Then, to use it:
```javascript
// log[level](message: string[, data: Object])
log.info('This is a test message');
// with data:
log.info('This is a test message with data', {
  isTest: true
});
```

To listen for logging events on a namespace:
```javascript
const logging = require('nomatic-logger');
logging.instance('test').on('info', (entry) => {
  /* `entry` is an object with `namespace`, `message`, `level`,
   * `hostname`, and `createdAt` fields.
   */
  console.log(`[${entry.level}]\t${entry.message}`);
});
```

The pattern works best in the following fashion:
  * Library developers create a namespaced Logger instance, and let their users know about it
  * Application developers subscribe to each instance and decide how they want to handle logging (i.e. display to console, send to a database, etc.). Application developers can also create their own namespaced instances for their own logging needs.

The mechanisms that "do" something with the log entries are called "Transports" (this is taken from ```winston```). This functionality has not been implemented, but it will be very soon. For now, you can subscribe to a logger using the method in the last example above, as it will never go away.

This library is developed with [TypeScript](http://www.typescriptlang.org/), and as such, includes definitions. However, you do not even need to know what TypeScript is to use this package. The compiled project is included in the [npm package](http://npmjs.com/package/nomatic-logger).

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