morgan
Battle-tested HTTP request logger middleware for Node.js and Express.
Repository Health
Technical Analysis
Morgan is an HTTP request logger middleware for Node.js, maintained under the expressjs GitHub organization and used with both Express and plain Node HTTP servers. It logs incoming requests using predefined formats (combined, common, dev, short, tiny) or fully custom format strings built from named tokens.
Morgan supports custom tokens, conditional/skip logic for filtering which requests get logged, and configurable output streams, making it a lightweight, dependency-light choice for request-level observability in Node.js applications.
What You Get
- Predefined log formats (combined, common, dev, short, tiny) matching common web server log conventions
- Custom format strings built from named tokens (:method, :url, :status, :response-time, etc.)
- Support for registering custom tokens to log application-specific request/response data
- Configurable skip functions to conditionally omit logging specific requests
- Pluggable output streams for directing logs to files, external services, or stdout
Common Use Cases
- Logging every incoming HTTP request/response in an Express application for debugging
- Producing Apache-style combined/common access logs for production Node.js servers
- Filtering logs to only capture errors or slow requests via custom skip functions
- Piping request logs into a file or external log aggregator via a custom stream
Under The Hood
Architecture - Morgan is implemented as a single middleware factory function (index.js) that wraps on-finished to hook into the response lifecycle, on-headers to capture response timing before headers are sent, and a token registry (morgan.token()) that resolves format placeholders like :method or :status at log time. Tech Stack - Pure JavaScript with minimal runtime dependencies: basic-auth for the :remote-user token, debug for internal debug logging, depd for deprecation warnings, and on-finished/on-headers for response lifecycle hooks; no build step or TypeScript, published as CommonJS. Code Quality - The project has a single but extensive test suite (test/morgan.js, ~1,800 lines) covering all predefined formats, custom tokens, skip functions, and streaming behavior; linting is enforced via ESLint with the standard config, and coverage is tracked via Coveralls. API Design - The API is a single default export (morgan(format, options)) used directly as Express/Connect middleware, with an extremely low barrier to entry — a one-line app.use(morgan('combined')) covers the common case, while morgan.token() provides an escape hatch for custom fields.
Used by 17 apps in this directory
Automatisch
Automation · No Code Platforms
Self-hosted, no-code workflow automation that keeps your data on your own servers—a privacy-first alternative to Zapier with 90+ integrations.
CapRover
Developer Tools · Devops · Hosting Control Panel
Deploy any app, database, or website to your own server in minutes—no Docker or Linux expertise required.
ChartBrew
Analytics · Databases
Open-source reporting platform to build live dashboards from SQL, NoSQL, APIs, and SaaS tools with an AI assistant that creates charts from natural language.
FormBee
Forms Surveys
A self-hostable form backend that accepts HTML form submissions and routes them to email, Telegram, Discord, webhooks, and automation platforms — without writing any server-side code.
Grist
Databases · No Code Platforms
A modern relational spreadsheet that combines Python-powered formulas, drag-and-drop dashboards, and granular access controls in a self-hostable, SQLite-backed data platform.
Helicone
Monitoring · AI Development · Analytics
An open-source AI gateway and LLM observability platform that routes requests to 100+ models while logging cost, latency, and full traces for every call.
Hoppscotch
Developer Tools
A lightweight, offline-capable API development ecosystem for testing HTTP, GraphQL, WebSocket, MQTT, and SSE endpoints across web, desktop, and CLI.
Huly Platform
Project Management · Team Chat · Collaboration
Open-source all-in-one workspace that replaces Linear, Jira, Slack, and Notion for product and engineering teams.
Laudspeaker
Marketing · Automation
Open-source customer engagement platform for building visual, event-triggered messaging journeys across email, SMS, push, in-app, and webhooks.