# @pubsweet/logger

> A module encapsulating standard logging features for pubsweet components and services.

Latest version **0.2.61** (published 2021-06-08) · MIT license · 0 weekly downloads

## Install

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

## 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.2.61 |
| Published | 2021-06-08 |
| First published | 2017-09-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=7.9.0 |
| Dependencies | 2 |
| Unpacked size | 15.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Antony Denyer |
| Maintainers | jure, shockandaudrey, diversemix, andrei.c9, yannisbarlas |
| Keywords | logger, pubsweet |

## Links

- npm: https://www.npmjs.com/package/@pubsweet/logger
- Repository: https://gitlab.coko.foundation/pubsweet/pubsweet
- npm.io page: https://npm.io/package/@pubsweet/logger

## Dependencies (2)

- [config](https://npm.io/package/config.md) ^3.0.1
- [@hapi/joi](https://npm.io/package/@hapi/joi.md) ^14.5.0

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

- 0.2.61 (latest) — 2021-06-08
- 0.2.19 (next) — 2019-04-18
- 0.2.60 — 2021-06-08
- 0.2.59 — 2021-04-13
- 0.2.58 — 2021-04-08
- 0.2.57 — 2021-04-05
- 0.2.56 — 2021-03-30
- 0.2.55 — 2021-03-29
- 0.2.54 — 2021-03-08
- 0.2.53 — 2021-02-25
- 0.2.52 — 2021-02-23
- 0.2.51 — 2021-02-23
- 0.2.50 — 2020-12-21
- 0.2.49 — 2020-11-19
- 0.2.48 — 2020-11-18
- … 52 more at https://npm.io/package/@pubsweet/logger/versions

## README

A module encapsulating standard logging features for pubsweet components and services.

### Usage

Either:

```js static
const myLogger = require('winston') // or something else
const logger = require('@pubsweet/logger')
logger.configure(myLogger)
```

Or set the logger in config:

```js static
const myLogger = require('winston') // or something else

{
  'pubsweet-server':{
    logger: myLogger
  }
}
```

The configured logger can then be imported from anywhere:

```js static
const logger = require('@pubsweet/logger')
logger.info('log')
```

The logger exposes the following methods:

- `info`
- `debug`
- `error`
- `warn`
- `configure`
- `getRawLogger` (returns the logger passed to `configure`)

As well as:

- `stream` (an object for passing to `morgan`)

Note that the logger used to configure the module must implement `error`, `warn`, `info` and `debug` functions.

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