# loge

> Singleton logging with levels

Latest version **1.0.5** (published 2018-03-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install loge
pnpm add loge
yarn add loge
bun add loge
```

## 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.0.5 |
| Published | 2018-03-06 |
| First published | 2014-01-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Christopher Brown |
| Maintainers | chbrown |
| Keywords | logger, logging, levels |

## Links

- npm: https://www.npmjs.com/package/loge
- Repository: https://github.com/chbrown/loge
- Issues: https://github.com/chbrown/loge/issues
- npm.io page: https://npm.io/package/loge

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

- 1.0.5 (latest) — 2018-03-06
- 1.0.4 — 2015-12-17
- 1.0.3 — 2015-10-21
- 1.0.2 — 2015-10-06
- 1.0.1 — 2015-07-24
- 1.0.0 — 2015-07-24
- 0.0.3 — 2014-09-21
- 0.0.2 — 2014-01-03

## README

## loge

[![latest version published to npm](https://badge.fury.io/js/loge.svg)](https://www.npmjs.com/package/loge)

My very own Node.js logging library! Crazy that no one else thought of this first!

```sh
npm install --save loge
```


### Basic use

The singleton `Logger` instance defaults to writing to `process.stderr`.

```js
import {logger, Level} from 'loge'

logger.level = Level.error
logger.warning('You should probably get a doctor to look at that.')
// (nothing)
logger.critical('OMG your face I you what no really just does it hurt?')
// [critical] OMG your face I you what no really just does it hurt?
```

Alternatively, write to `process.stdout`:

```js
import {Logger, Level} from 'loge'

const logger = new Logger(process.stdout, Level.info)
```


### Formatting

Loge's calls Node's [`util.format`](http://nodejs.org/api/util.html#util_util_format_format) (but only when the called method's level is greater than or equal to the logger's `level`), so the following interpolation variables are available:

* `%s` - String
* `%d` - Number (integer / float)
* `%j` - JSON (`JSON.stringify()` called without replacer or indentation

Use `%%` for an escaped percent sign


### Levels

```js
import {Level} from 'loge'

console.log(Level.notset)
// 0
console.log(Level.debug)
// 10
console.log(Level.info)
// 20
console.log(Level.warning)
// 30
console.log(Level.error)
// 40
console.log(Level.critical)
// 50
```


### License

Copyright © 2014-2015 Christopher Brown.
[MIT Licensed](https://chbrown.github.io/licenses/MIT/#2014-2015).

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