# abstract-logging

> A noop logger that conforms to the Log4j interface for modules to stub out internal logging

Latest version **2.0.1** (published 2020-10-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install abstract-logging
pnpm add abstract-logging
yarn add abstract-logging
bun add abstract-logging
```

## 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 | 2.0.1 |
| Published | 2020-10-17 |
| First published | 2016-10-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 34 |
| Author | James Sumners |
| Maintainers | jsumners |
| Keywords | log, logging, logger, pino |

## Links

- npm: https://www.npmjs.com/package/abstract-logging
- Repository: https://github.com/jsumners/abstract-logging
- Homepage: https://github.com/jsumners/abstract-logging#readme
- Issues: https://github.com/jsumners/abstract-logging/issues
- npm.io page: https://npm.io/package/abstract-logging

## 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.1 (latest) — 2020-10-17
- 2.0.0 — 2019-11-13
- 1.0.0 — 2016-10-20

## README

# abstract-logging

This module provides an interface for modules to include so that they can
support logging via an external logger that conforms to the standard Log4j
interface. One such logger is [Pino](https://npm.im/pino). This module
is intended for modules that are meant to be used by other modules.

Example:

```js
'use strict'

function AwesomeLibrary (options) {
  this.log = (options.logger) ? options.logger : require('abstract-logging')
}

AwesomeLibrary.prototype.coolMethod = function () {
  this.log.trace('AwesomeLibrary.coolMethod was invoked')
  return {}
}

module.exports = AwesomeLibrary
```

## Interface

Available methods:

+ `fatal`
+ `error`
+ `warn`
+ `info`
+ `debug`
+ `trace`

All methods are no operation functions.

Some loggers, like [Pino](https://getpino.io/), implement a `child()` method. This method can be easily added to an `abstract-logging` instance when stubbing out such loggers:

```js
const logger = require('abstract-logging')
logger.child = () => logger
```

## License

[MIT License](http://jsumners.mit-license.org/)

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