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

@molecule/api-logger-loglevel

v1.0.2

Published

Loglevel logger provider for molecule.dev.

Readme

@molecule/api-logger-loglevel

Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit src/index.ts JSDoc, not this file.

Loglevel logger provider for molecule.dev.

Provides a lightweight logger implementation using loglevel.

Quick Start

import { logger, setLogger } from '@molecule/api-logger'
import { provider } from '@molecule/api-logger-loglevel'

setLogger(provider)
logger.info('Server started on port', 3000)

Type

provider

Installation

npm install @molecule/api-logger-loglevel @molecule/api-logger loglevel

API

Interfaces

Logger

Logger interface that all implementations must satisfy.

interface Logger {
  trace(...args: unknown[]): void
  debug(...args: unknown[]): void
  info(...args: unknown[]): void
  warn(...args: unknown[]): void
  error(...args: unknown[]): void
}

Types

LogLevel

Log levels supported by the logger.

type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent'

Functions

createLogger(options)

Creates a named loglevel logger that implements the Logger interface.

Without an explicit level, the instance is set to pass everything through (TRACE) — loglevel's own out-of-the-box default is WARN, which silently swallows info/debug and makes the logger look broken. Level filtering belongs to @molecule/api-logger's single gate (LOG_LEVEL / setLevel(), default 'info'); pass level here only to add a bond-side gate on top.

Note: loglevel caches instances by name, so createLogger({ name }) with an already-used name returns (and re-levels) that same shared instance.

function createLogger(options?: { level?: LogLevel; name?: string }): Logger
  • options — Logger configuration.
  • options.level — The minimum log level. Defaults to pass-through ('trace').
  • options.name — The logger name (used to create a named loglevel instance).

Returns: A Logger backed by loglevel.

getLevel()

Returns the current log level of the default loglevel instance.

function getLevel(): LogLevel

Returns: The current LogLevel (e.g. 'info', 'debug', 'warn').

setLevel(level)

Sets the minimum log level for the default loglevel instance.

function setLevel(level: LogLevel): void
  • level — The molecule log level to set.

Constants

levelMap

Map molecule log levels to loglevel levels.

const levelMap: Record<LogLevel, loglevel.LogLevelNumbers>

log

The underlying loglevel instance.

const log: loglevel.Logger

loglevel

The underlying loglevel instance.

const loglevel: loglevel.Logger

provider

The loglevel logger provider implementing the standard interface.

const provider: Logger

Core Interface

Implements @molecule/api-logger interface.

Bond Wiring

Setup function to register this provider with the core interface:

import { setLogger } from '@molecule/api-logger'
import { provider } from '@molecule/api-logger-loglevel'

export function setupLoggerLoglevel(): void {
  setLogger(provider)
}

Injection Notes

Requirements

Peer dependencies:

  • @molecule/api-logger ^1.0.1

Runtime Dependencies

  • @molecule/api-logger

  • loglevel

  • The provider passes every level through to loglevel — minimum-level filtering happens once, in @molecule/api-logger (LOG_LEVEL env var / setLevel(), default 'info'). Raw loglevel's own default level is WARN, which would otherwise silently swallow logger.info(...) out of the box.

  • Use this package's setLevel()/createLogger({ level }) only when you want an ADDITIONAL bond-side gate below the core's — a stricter level here makes the core's setLevel('debug') appear to do nothing.

  • trace delegates to console.trace, which prints a stack trace with every call (loglevel behavior, not a bug).