# @amazebot/logger

> Basic log handling with overrides for use within other modules.

Latest version **0.1.1** (published 2018-12-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @amazebot/logger
pnpm add @amazebot/logger
yarn add @amazebot/logger
bun add @amazebot/logger
```

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2018-12-11 |
| First published | 2018-12-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | > 8.0.0 |
| Dependencies | 0 |
| Unpacked size | 6.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Tim Kinnane |
| Maintainers | timkinnane |
| Keywords | util, typescript, logger, log, console |

## Links

- npm: https://www.npmjs.com/package/@amazebot/logger
- Repository: git@github.com:Amazebot/util
- Homepage: https://github.com/Amazebot/util/tree/master/packages/logger
- npm.io page: https://npm.io/package/@amazebot/logger

## 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
- [@luma.gl/experimental](https://npm.io/package/@luma.gl/experimental.md) — 77.1K 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

## Recent versions

- 0.1.1 (latest) — 2018-12-11
- 0.1.0 — 2018-12-06

## README

# 📓 Logger
Basic log handling with overrides for use within other modules.
---

When building dependencies of more complex apps, you don't want to be too
opinionated about how logs are written, nor add more dependencies that might not
play with choices made in the app. However, you also don't want to hard code
`console.log` and end up with multiple output streams.

This package provides standard logging methods for packages requiring it. They
route to console.log by default, but apps requiring those packages can pass in
their own log utility, to overwrite the default methods (as long as the logger
instance is exported).

___

### Import logger in package

```
import { logger } from '@amazebot/logger'
```

Provides standard debug/info/warning/error methods

### Package re-exports logger

```
export const pkgLogger = logger
```

### Write your logs in packages

```
pkgLogger.info(`That's pretty much it.`)
```

Outputs to console by default, but allows override.

### Replace with external logger in app

```
import { logger } from 'amazing-logger'
import * as myPackage from 'my-package'
myPackage.logger.replace(logger)
```

Routes to debug/info/warning/error of new interface.

### Silence/restore logs before/after tests

```
import { silence } from '@amazebot/logger'
describe('test methods that log', () => {
  before(() => silence())
  after(() => silence(false))
})
```

Routes debug/info/warning/error to null output.

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