# @prairielearn/logger

Latest version **4.0.2** (published 2026-10-01) · 0 weekly downloads

## Install

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

## Health

**Score 65/100 (B)** — status: active.

Positive: esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 4.0.2 |
| Published | 2026-10-01 |
| First published | 2023-02-26 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=24.0.0 |
| Dependencies | 2 |
| Unpacked size | 55.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 533 |
| Maintainers | nwalters512, mwest1066 |

## Links

- npm: https://www.npmjs.com/package/@prairielearn/logger
- Repository: https://github.com/PrairieLearn/PrairieLearn
- npm.io page: https://npm.io/package/@prairielearn/logger

## Dependencies (2)

- [pino](https://npm.io/package/pino.md) ^10.3.1
- [pino-pretty](https://npm.io/package/pino-pretty.md) ^13.1.3

## Recent versions

- 4.0.2 (latest) — 2026-10-01
- 4.0.1 — 2026-09-18
- 4.0.0 — 2026-08-17
- 3.1.7 — 2026-08-11
- 3.1.6 — 2026-07-10
- 3.1.5 — 2026-06-01
- 3.1.4 — 2026-05-16
- 3.1.3 — 2026-05-07
- 3.1.2 — 2026-04-29
- 3.1.1 — 2026-03-04
- 3.1.0 — 2026-02-10
- 3.0.1 — 2026-01-31
- 3.0.0 — 2026-01-16
- 2.0.25 — 2026-01-15
- 2.0.24 — 2025-12-31
- … 40 more at https://npm.io/package/@prairielearn/logger/versions

## README

# `@prairielearn/logger`

Provides a shared [Pino](https://getpino.io/) logger with human-readable console output and JSON file output.

## Usage

```ts
import { logger, addFileLogging, reopenFileLogging } from '@prairielearn/logger';

// Log all messages to a file.
addFileLogging({ filename: '/path/to/file.log' });

// Log all errors to another file.
addFileLogging({ filename: '/path/to/errors.log', level: 'error' });

// Reopen configured log files after an external tool rotates them.
process.on('SIGHUP', reopenFileLogging);

logger.debug('debug');
logger.verbose('verbose');
logger.info('info');
logger.warn('warn');

try {
  await mightError();
} catch (err) {
  logger.error('An error occurred', err);
}
```

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