# fm-log

> Console logging facility for Node

Latest version **4.4.3** (published 2016-12-15) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.4.3 |
| Published | 2016-12-15 |
| First published | 2014-04-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Oliver Salzburg |
| Maintainers | oliversalzburg |
| Keywords | console, log, logging |

## Links

- npm: https://www.npmjs.com/package/fm-log
- Repository: https://github.com/fairmanager/fm-log
- Issues: https://github.com/fairmanager/fm-log/issues
- npm.io page: https://npm.io/package/fm-log

## Dependencies (1)

- [chalk](https://npm.io/package/chalk.md) ^1.1.1

## 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

- 4.4.3 (latest) — 2016-12-15
- 4.4.2 — 2016-12-15
- 4.4.1 — 2016-11-17
- 4.4.0 — 2016-11-12
- 4.3.0 — 2016-10-20
- 4.2.1 — 2016-08-11
- 4.2.0 — 2016-06-27
- 4.1.0 — 2016-05-28
- 4.0.3 — 2016-05-18
- 4.0.2 — 2016-05-18
- 4.0.1 — 2016-05-18
- 4.0.0 — 2016-05-18
- 4.0.0-rc0 — 2016-05-11
- 3.1.0 — 2016-04-21
- 3.0.0 — 2016-04-21
- … 24 more at https://npm.io/package/fm-log/versions

## README

fm-log
======
[![npm Package](https://npmjs.org/package/fm-log)](https://img.shields.io/npm/v/fm-log.svg)
[![](https://travis-ci.org/fairmanager/fm-log.svg?branch=master)](https://travis-ci.org/fairmanager/fm-log)
[![Coverage Status](https://coveralls.io/repos/fairmanager/fm-log/badge.svg?branch=master&service=github)](https://coveralls.io/github/fairmanager/fm-log?branch=master)
[![Code Climate](https://codeclimate.com/github/fairmanager/fm-log/badges/gpa.svg)](https://codeclimate.com/github/fairmanager/fm-log)
![GitHub license](https://img.shields.io/github/license/fairmanager/fm-log.svg)

What?
-----
Straight-forward logging module.

- lines up everything in nice columns
- uses colors
- sends everything straight to `process.stderr` (no events, no `nextTick()`) if desired
- condenses repeated messages
- displays stack traces for logged Error instances and other multi-line content nicely
- optionally displays the source of the logging call
- supports wrapping of [morgan](https://github.com/expressjs/morgan) in your express app
- can replace the [debug](https://github.com/visionmedia/debug) module, using [hartwig-at/debug](https://github.com/hartwig-at/debug)

Example
-------

```js
var log = require( "fm-log" ).module( "demo" );

log.info( "Logging without source tracing" );
log.notice( "Initializing application...\nwow\nsuch application" );
log.critical( new Error( "Logging an Error instance." ) );

log.withSource();
log.info( "Logging WITH source tracing" );
log.notice( "You'll never know where this was logged from!" );

log = require( "fm-log" );
log.warn( "We don't need no prefix!" );

log = require( "fm-log" ).module( "something weird" );
log.warn( "...or do we?" );

log = require( "fm-log" );
log.notice( "You're using a longer prefix? I'll adjust." );

log = require( "fm-log" ).module();
log.error( "ouch" );
```

![](img/example.png)

```js
// Wrap morgan
app.use( require( "fm-log" ).module( "HTTP" ).morgan( {format : "dev"} ) );
```

How?
----

Install
```shell
npm install fm-log
```

Put this in every file where you want to log:
```js
var log = require( "fm-log" ).module();
```

Then just use `log.info` or one of the other logging levels shown above.

For loggers without a specific prefix, just `require()` the module and use it directly:
```js
var generic = require( "fm-log" );
generic.notice( "We don't need no prefix" );
```

To log to a different stream (`process.stdout` is the default), use `.to()`:
```js
var logger = require( "fm-log" ).to( process.stderr );
```

To send data straight to the output stream (without `nextTick()`), use `.sync()`:
```js
var logger = require( "fm-log" ).sync();
```

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