# simple-log-methods

> a simple and opinionated logging library. plays well with aws lambda + cloudwatch.

Latest version **0.6.12** (published 2026-04-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install simple-log-methods
pnpm add simple-log-methods
yarn add simple-log-methods
bun add simple-log-methods
```

## Health

**Score 60/100 (C)** — status: stable.

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

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

## Facts

| | |
|---|---|
| Version | 0.6.12 |
| Published | 2026-04-04 |
| First published | 2025-06-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=8.0.0 |
| Dependencies | 6 |
| Unpacked size | 43.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 0 |
| Author | ehmpathy |
| Maintainers | uladkasach |
| Keywords | log, logs, level, simple, filter, aws, lambda, cloudwatch, requestId |

## Links

- npm: https://www.npmjs.com/package/simple-log-methods
- Repository: https://github.com/ehmpathy/simple-log-methods
- Issues: https://github.com/ehmpathy/simple-log-methods/issues
- npm.io page: https://npm.io/package/simple-log-methods

## Dependencies (6)

- [iso-time](https://npm.io/package/iso-time.md) ^1.11.5
- [type-fns](https://npm.io/package/type-fns.md) 1.21.2
- [domain-objects](https://npm.io/package/domain-objects.md) 0.31.10
- [helpful-errors](https://npm.io/package/helpful-errors.md) 1.7.3
- [@ehmpathy/error-fns](https://npm.io/package/@ehmpathy/error-fns.md) ^1.3.7
- [domain-glossary-procedure](https://npm.io/package/domain-glossary-procedure.md) ^1.0.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.6.12 (latest) — 2026-04-04
- 0.6.11 — 2026-04-02
- 0.6.10 — 2026-04-02
- 0.6.9 — 2026-01-05
- 0.6.8 — 2026-01-05
- 0.6.7 — 2026-01-05
- 0.6.5 — 2025-12-09
- 0.6.4 — 2025-12-09
- 0.6.3 — 2025-12-09
- 0.6.2 — 2025-11-24
- 0.6.1 — 2025-07-04
- 0.6.0 — 2025-07-04
- 0.5.0 — 2025-06-25

## README

# simple-log-methods

a simple and opinionated logging library. plays well with aws lambda + cloudwatch.

# features

- distinguish different priorities of logs with standard levels
  - i.e., `log.debug`, `log.info`, `log.warn`, and `log.error`
- filter which levels of log to emit
  - i.e., choose based on environment whether to emit all logs or skip some of the logs
- utilizes `console.warn` and `console.log` under the hood
  - which ensures that the aws cloudwatch requestId is present on each log message automatically
- formats log metadata based on environment
  - i.e., stringify in local environments to reduce visual noise
  - i.e., don't stringify in aws-lambda environment for optimal cloudwatch parsing


# installation

```
npm install --save simple-log-methods
```

# usage

### init
```ts
// e.g., in `src/utils/log.ts
import { generateLogMethods } from 'simple-log-methods';

export const log = generateLogMethods();
```

### use in code
```ts
import { log } from '../utils/log';

log.error(`the sky is falling and we're loosing money!`, metadata); // use `.error` when you want someone to respond immediately, even if its 4am

log.warn(`this shouldn't be happening and should be looked at asap`, metadata); // use `.warn` when you want someone to look at it asap, but not wake up in the middle of the night

log.info(`we either want to or should keep track of this`, metadata); // use `.info` for anything we may be interested in knowing about

log.debug(`this will help debug if things go wrong`, metadata); // use this for any information that could help debug when things go wrong (e.g., request/response data)
```

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