This is a Node.js module available through the npm registry. Installation is done using the npm install command. Create a new morgan logger middleware function using the given format and options. The format argument may be a string of a predefined name, a string of a format string, or a function that will produce a log entry. The format function will be called with three arguments tokens, req, and res, where tokens is an object with all defined tokens, req is the HTTP request and res is the HTTP response. The function is expected to return a string that will be the log line, or undefined / null to skip logging. Write log line on request instead of response. This means that a requests will be logged even if the server crashes, but data from the response (like the response code, content length, etc.) cannot be logged. To define a token, simply invoke morgan.token() with the name and a callback function.

Features

  • Use a predefined format string
  • Use a format string of predefined tokens
  • Use a custom format function
  • Output stream for writing log lines, defaults to process.stdout
  • There are various pre-defined formats provided
  • Concise output colored by response status for development use

Project Samples

Project Activity

See All Activity >

Categories

Logging

License

MIT License

Follow morgan

morgan Web Site

Other Useful Business Software
AI-powered service management for IT and enterprise teams Icon
AI-powered service management for IT and enterprise teams

Enterprise-grade ITSM, for every business

Give your IT, operations, and business teams the ability to deliver exceptional services—without the complexity. Maximize operational efficiency with refreshingly simple, AI-powered Freshservice.
Try it Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of morgan!

Additional Project Details

Programming Language

JavaScript

Related Categories

JavaScript Logging Software

Registered

2021-08-23