# fancy-log

> Log things, prefixed with a timestamp.

Latest version **2.0.0** (published 2022-01-07) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2022-01-07 |
| First published | 2015-09-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/fancy-log) |
| Module format | CommonJS |
| Node | >=10.13.0 |
| Dependencies | 1 |
| Unpacked size | 6.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 122 |
| Author | Gulp Team |
| Maintainers | sttk, phated |
| Keywords | console.log, log, logger, logging, pretty, timestamp |

## Links

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

## Dependencies (1)

- [color-support](https://npm.io/package/color-support.md) ^1.1.3

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

- 2.0.0 (latest) — 2022-01-07
- 1.3.3 — 2018-11-29
- 1.3.2 — 2017-12-13
- 1.3.1 — 2017-12-12
- 1.3.0 — 2016-12-27
- 1.2.0 — 2016-02-09
- 1.1.0 — 2015-09-14
- 1.0.0 — 2015-09-07

## README

<p align="center">
  <a href="https://gulpjs.com">
    <img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
  </a>
</p>

# fancy-log

[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url]

Log things, prefixed with a timestamp.

## Usage

```js
var log = require('fancy-log');

log('a message');
// [16:27:02] a message

log.error('oh no!');
// [16:27:02] oh no!
```

## API

### `log(msg...)`

Logs the message as if you called `console.log` but prefixes the output with the
current time in HH:mm:ss format.

### `log.error(msg...)`

Logs the message as if you called `console.error` but prefixes the output with the
current time in HH:mm:ss format.

### `log.warn(msg...)`

Logs the message as if you called `console.warn` but prefixes the output with the
current time in HH:mm:ss format.

### `log.info(msg...)`

Logs the message as if you called `console.info` but prefixes the output with the
current time in HH:mm:ss format.

### `log.dir(msg...)`

Logs the message as if you called `console.dir` but prefixes the output with the
current time in HH:mm:ss format.

## Styling

If the terminal that you are logging to supports colors, the timestamp will be formatted as though it were a `Date` being formatted by `util.inspect()`. This means that it will be formatted as magenta by default but can be adjusted following node's [Customizing util.inspect colors](https://nodejs.org/dist/latest-v10.x/docs/api/util.html#util_customizing_util_inspect_colors) documentation.

For example, this will cause the logged timestamps (and other dates) to display in red:

```js
var util = require('util');

util.inspect.styles.date = 'red';
```

## License

MIT

<!-- prettier-ignore-start -->
[downloads-image]: https://img.shields.io/npm/dm/fancy-log.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/fancy-log
[npm-image]: https://img.shields.io/npm/v/fancy-log.svg?style=flat-square

[ci-url]: https://github.com/gulpjs/fancy-log/actions?query=workflow:dev
[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/fancy-log/dev?style=flat-square

[coveralls-url]: https://coveralls.io/r/gulpjs/fancy-log
[coveralls-image]: https://img.shields.io/coveralls/gulpjs/fancy-log/master.svg?style=flat-square
<!-- prettier-ignore-end -->

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