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

@routup/logger

v2.0.0

Published

HTTP request logger handler for routup, with morgan-compatible tokens and presets.

Downloads

381

Readme

@routup/logger

npm version main codecov Known Vulnerabilities Conventional Commits

An HTTP request logger for routup — morgan-compatible token DSL on top of routup's web-API helpers.

Table of Contents

Installation

npm install @routup/logger --save

Documentation

To read the docs, visit https://routup.net

Usage

logger() returns a routup CoreHandler — pass it to router.use(...). It logs after the response is resolved so :status, :response-time, and :res[*] tokens see real values.

import { App, defineCoreHandler, serve } from 'routup';
import { logger } from '@routup/logger';

const router = new App();

router.use(logger('tiny'));

router.get('/', defineCoreHandler(() => 'ok'));

serve(router, { port: 3000 });

Logger is intentionally a handler factory rather than a routup Plugin. Routup plugins install into a dedicated sub-router whose event.next() only walks that sub-router's stack — sibling routes are invisible. Logging needs the resolved Response, so the handler form is the right shape.

Options

logger(options?: Options);
logger(format: string | Formatter, options?: Options);

| Option | Type | Default | Description | |---|---|---|---| | format | string \| Formatter | 'tiny' | Format string (e.g. ':method :url :status'), preset name ('tiny' \| 'short' \| 'common' \| 'combined' \| 'dev'), or a Formatter function. | | skip | (event, response) => boolean | — | Skip a request from being logged. | | write | (line: string) => void | console.log | Where to write the log line. | | immediate | boolean | false | Emit at request start instead of after the response. :status / :response-time render as -. | | tokens | Record<string, Token> | {} | Additional tokens merged on top of the built-ins. |

Preset formats

combined   :remote-addr - :remote-user [:date[clf]] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"
common     :remote-addr - :remote-user [:date[clf]] ":method :url HTTP/:http-version" :status :res[content-length]
short      :remote-addr :remote-user :method :url HTTP/:http-version :status :res[content-length] - :response-time ms
tiny       :method :url :status :res[content-length] - :response-time ms
dev        :method :url :status (color-coded by status range) :response-time ms - :res[content-length]

Pass the preset name directly:

router.use(logger('combined'));

Tokens

| Token | Renders | |---|---| | :method | HTTP method (GET, POST, ...) | | :url | pathname + search from the request URL | | :status | Response status code (- if not yet sent in immediate mode) | | :response-time / :total-time | Milliseconds since request start, 3 decimals | | :date[web\|iso\|clf] | Current time in the requested format (defaults to web) | | :remote-addr | Client IP (via getRequestIP) | | :remote-user | Username from Authorization: Basic … | | :user-agent | User-Agent header | | :referrer | Referer / Referrer header | | :http-version | 1.1 unless srvx exposes a richer value | | :req[name] | Request header by name | | :res[name] | Response header by name | | :pid | Process id |

Missing values render as -.

Custom tokens

router.use(logger(':method :url :user', {
    tokens: {
        user: (event) => event.store.userId as string | undefined,
    },
}));

Or use a Formatter directly to bypass the token DSL:

router.use(logger(
    (_tokens, event, response) => {
        return `[${event.method}] ${event.path} → ${response?.status ?? '?'}`;
    },
));

License

Made with 💚

Published under MIT License.