Skip to content
eliwarePublic

About

Structured ESM logging for Node.js with redaction and defensive serialization, backed by Winston.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

eliware.org

@eliware/log npm License CI

Structured ESM logging for Node.js with redaction and defensive serialization, backed by Winston.

Table of Contents

Features

  • Create Winston loggers with text or JSON output, level filtering, and configurable transports.
  • Add shared context with child loggers for requests or other operations.
  • Redact selected metadata keys before the package sends records to transports.
  • Apply configured output limits to serialized objects and errors. The serializer does not call toJSON().
  • Add timestamps to JSON records when you set timestamp: true.

Read the documentation for setup and use. Read the specifications for package requirements.

Requirements

Use Node.js 26 or later in a native ESM project.

Setup

Install the package with npm:

npm install @eliware/log

Usage

Import createLogger() from the package root to create a logger:

import { createLogger } from "@eliware/log";

const logger = createLogger({ format: "json" });
logger.info("Request received", { requestId: "demo" });

Read the release notes for package changes.

Development

Run npm ci to install the lockfile dependencies.

Testing

Run npm test for aggregate validation. Run npm run lint, npm run audit, npm run format:check, npm run typecheck, or npm run pack for focused checks. Run npm run format to format files.

Troubleshooting

Problem Cause Action
createLogger() reports an invalid level Winston does not define the level. Set level to a level supported by Winston.
createLogger() reports an invalid format The format is not text or json. Set format to text or json.
timestamp must be a boolean The timestamp option is not Boolean. Set timestamp to true or false.
transports must be an array The transports option is not an array. Pass an array of Winston transports.
A log record is missing The configured level filters it, or the transport changes output. Check the level and inspect the transport output.

Read Sensitive data and errors for more help.

Security

Set keys to the metadata property names that contain sensitive data. The logger does not redact string messages by property name. Remove secrets from messages before you log them.

Inspect the final output from each custom transport. A transport can add fields or change a record. Do not use redaction or bounded serialization as a replacement for access controls on log storage.

Read Sensitive data and errors for redaction limits and safe logging guidance.

API

Import createLogger, safeSerialize, the named log, and the default logger from the package root. Read the API reference for options, declarations, and methods.

Packaging

The package includes package.json and the files listed in package.json.files: src/, docs/, README.md, AGENTS.md, LICENSE, RELEASE_NOTES.md, examples/, specs/, and .env.example. Use numeric MAJOR.MINOR.PATCH versions and matching v<version> release tags. Get approval through the Operations release handoff before publication.

Examples

Read examples/README.md for commands and expected results.

Support

For help, questions, or to chat with the author and community, visit:

Discordeliware.org

eliware.org on Discord

Links

License

MIT © Eliware

About

Structured ESM logging for Node.js with redaction and defensive serialization, backed by Winston.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages