New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@remix-run/logger-middleware

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@remix-run/logger-middleware

Middleware for logging HTTP requests and responses

latest
Source
npmnpm
Version
0.1.4
Version published
Maintainers
1
Created
Source

logger-middleware

HTTP request/response logging middleware for Remix. It logs request metadata and response details with configurable output formats.

Features

  • Request/Response Logging - Logs method, path, status, and response metadata
  • Token-Based Formatting - Customize log output with built-in placeholders
  • Structured Timing Data - Includes request duration and timestamps

Installation

npm i remix

Usage

import { createRouter } from 'remix/fetch-router'
import { logger } from 'remix/logger-middleware'

let router = createRouter({
  middleware: [logger()],
})

// Logs: [19/Nov/2025:14:32:10 -0800] GET /users/123 200 1234

Custom Format

You can use the format option to customize the log format. The following tokens are available:

  • %date - Date and time in Apache/nginx format (dd/Mon/yyyy:HH:mm:ss ±zzzz)
  • %dateISO - Date and time in ISO format
  • %duration - Request duration in milliseconds
  • %contentLength - Response Content-Length header
  • %contentType - Response Content-Type header
  • %host - Request URL host
  • %hostname - Request URL hostname
  • %method - Request method
  • %path - Request pathname + search
  • %pathname - Request pathname
  • %port - Request port
  • %query - Request query string (search)
  • %referer - Request Referer header
  • %search - Request search string
  • %status - Response status code
  • %statusText - Response status text
  • %url - Full request URL
  • %userAgent - Request User-Agent header
let router = createRouter({
  middleware: [
    logger({
      format: '%method %path - %status (%duration ms)',
    }),
  ],
})
// Logs: GET /users/123 - 200 (42 ms)

For Apache-style combined log format, you can use the following format:

let router = createRouter({
  middleware: [
    logger({
      format: '%host - - [%date] "%method %path" %status %contentLength "%referer" "%userAgent"',
    }),
  ],
})

Custom Logger

You can use a custom logger to write logs to a file or other stream.

import { createWriteStream } from 'node:fs'

let logStream = createWriteStream('access.log', { flags: 'a' })

let router = createRouter({
  middleware: [
    logger({
      log(message) {
        logStream.write(message + '\n')
      },
    }),
  ],
})
  • fetch-router - Router for the web Fetch API

License

See LICENSE

Keywords

fetch

FAQs

Package last updated on 25 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts