npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@openknot-ts/logging

v0.0.6-preview

Published

OpenKnot's logging contract: a logger for operations, handlers and plugs, written by a console default or a plug.

Readme

OpenKnot logging

@openknot-ts/logging is OpenKnot's own logging contract. Operations, handlers and plugs declare logger in their requirements like any other dependency; an implementation writes the records. The console writes them until a plug provides another implementation.

operation, handler, plug   → requirements: { logger } → Logger { trace, debug, info, warn, error, fatal, child }
@openknot-ts/logging       → LOG_LEVEL filter → Logging { write(record) }
implementation             → console (default) or a plug, such as pino

Log

import { logger } from "@openknot-ts/logging/wire";

const renameRole = operation<RenameRole, RoleState>()({
  requirements: { findRole, logger },
  run: async (input, { findRole, logger }) => {
    logger.debug("renaming role", { roleId: input.id });
    // ...
  },
});

const createRole = command<CreateRole>()({
  requirements: { saveRole, logger },
  run: async (input, ctx) => {
    ctx.logger.info("role created", { roleId: input.id });
    // ...
  },
});
  • Each method takes a message and optional attributes. Pass a failure as the error attribute: logger.error("delivery failed", { error }).
  • child(attributes) returns a logger that adds those attributes to every record.
  • LOG_LEVEL (trace, debug, info, warn, error or fatal, the levels pino and OpenTelemetry share; info by default) is read at runApplication(); any other value stops startup. The console writes trace with console.debug and fatal with console.error.
  • With a tracing implementation bound, such as provideOpenTelemetry(), every written record carries the active span's traceId and spanId, as Spring Sleuth adds them to the MDC. Records outside a span carry neither, records filtered by their level never ask, and nothing changes without tracing.
  • Logging never fails the work that logs: a record the implementation cannot write is reported on the console with the implementation's error.
  • Flow also logs its own executions per kind. No failure is silent by default: exposures and subscriptions write their defects, listeners and schedulers every failure; other kinds are set like LOG_LEVEL_COMMAND=debug with LOG_DURATION=true: see execution logs.
  • Behavior operations may require logger beside readers and operations. standalone() uses the console logger unless override(logger, value) supplies one.

Implement and bind

logging is a unit whose own declaration writes on the console; one binding replaces it:

import type { Logging } from "@openknot-ts/logging";
import { logging } from "@openknot-ts/logging/wire";

const jsonLines = unit({
  provides: logging,
  factory: (): Logging => ({
    write: (record) => process.stdout.write(`${JSON.stringify(record)}\n`),
  }),
});

A record carries level, message and frozen attributes; time, format and destination belong to the implementation. @openknot-ts/pino-logging writes through the application's pino instance.

API

| Entry | Export | Description | | --- | --- | --- | | root | Logger, Logging, LogRecord, LogLevel, LogAttributes | The contract types. | | root | createLogger(logging, { level?, attributes?, correlation? }) | A logger over an implementation, without Wire; correlation() adds attributes to each written record. | | root | consoleLogging, parseLogLevel(value), isLogLevel(value) | The console implementation and level parsing. | | root | isLoggerReference(value), LoggerMarker | Recognizes the /wire logger without loading Wire, as Behavior does. | | /wire | logger, logging, loggingConfig | What consumers require, what implementations provide, and LOG_LEVEL. |