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

You Might Also Like
Monitor your whole IT Infrastructure Icon
Monitor your whole IT Infrastructure

Know what's up and what's new: Monitor all your systems, devices, traffic and applications.

Caters to tech staff, system Administrators, and companies of any size, from small and medium sized businesses to enterprises that need their IT network to be reliable and easy to monitor in real-time. Equipped with an easy-to-use, intuitive interface with a cutting-edge monitoring engine. PRTG optimizes connections and workloads as well as reducing operational costs by avoiding outages while saving time and controlling service level agreements (SLAs).
Start Your Free PRTG Trial Now
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