# log-skeleton

> Object that allows you to use the log API even if the logger was never initialized.

Latest version **1.1.0** (published 2015-08-23) · MIT license · 0 weekly downloads

## Install

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

## 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 | 1.1.0 |
| Published | 2015-08-23 |
| First published | 2015-07-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Mats Julian Olsen |
| Maintainers | mewwts |

## Links

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

## Recent versions

- 1.1.0 (latest) — 2015-08-23
- 1.0.1 — 2015-07-16
- 1.0.0 — 2015-07-16

## README

# log-skeleton
[![build Status](https://travis-ci.org/mewwts/log-skeleton.svg?branch=master)](https://travis-ci.org/mewwts/log-skeleton)

log-skeleton is a simple object with methods `.fatal`, `.error`, `.warn`, `.info`, `.debug` and `.trace`. It is initalized with you favorite log instance, or nothing at all.

I.e. you can do either
```Javascript
var real_log = require('bunyan').createLogger({name: 'example'});
var log = require('log-skeleton')(real_log);
```
or 
```Javascript
var log = require('log-skeleton')();
```

In the first case any simple API call to `log` will be forwarded to `real_log`, while in the latter case, every simple log API call will be silently ignored. It's meant to be a drop in tool for you module when you want to outsource the responsibility of creating a logger, but don't want to have a bunch of `if (log) {}` lying around.

## Usage

```Javascript
var skeleton = require('log-skeleton');

module.exports = function (options) {
  var log = skeleton((options) ? options.log : undefined);
  ...
  log.info("Doesn't matter if options.log is undefined");
};
```

If `options.log` is undefined, the call to `log.info` does nothing. If it's a log object, the logger will log at the appropriate level.

The original log object is exposed at `log.log` in the above example, as to give you an access point to the real log object.

## License

MIT

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