# simple-log-function

> Simple Log Function ===================

Latest version **0.0.2** (published 2022-01-27) · 0 weekly downloads

## Install

```sh
npm install simple-log-function
pnpm add simple-log-function
yarn add simple-log-function
bun add simple-log-function
```

## 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.2 |
| Published | 2022-01-27 |
| First published | 2022-01-27 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 8.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | khrome |

## Links

- npm: https://www.npmjs.com/package/simple-log-function
- npm.io page: https://npm.io/package/simple-log-function

## Dependencies (1)

- [loglevel](https://npm.io/package/loglevel.md) ^1.8.0

## Recent versions

- 0.0.2 (latest) — 2022-01-27
- 0.0.1 — 2022-01-27

## README

Simple Log Function
===================

A wrapper for [`loglevel`](https://www.npmjs.com/package/loglevel) which reduces the callable signature to a single function. It also prevents formatting logic execution if the log level isn't running, which most loggers do not concern themselves with.

```js
const log = require('simple-log-function');
//log something with the default level
log('something');
//log something with a warning level
log('something', log.levels.WARN);
//log something with a warning and a data context
log('something', log.levels.WARN, context);
```

If you make your own log wrapper and want it to report a higher level:

```js
log.depth = 2; //default is 1
```

If you want to output structured logs

```js
log.mode = 'json';
```

If you want to output a custom header in text mode

```js
log.header = (filename)=>{
    return `My custom header:`;
};
```

Testing
-------

```bash
npm run test
```
runs the tests ([mocha](https://www.npmjs.com/package/mocha) + [chai](https://www.npmjs.com/package/chai))

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