Reformat project into workspaces
CI/CD Pipeline / test (push) Failing after 1m51s
CI/CD Pipeline / deploy-internal (push) Has been skipped

This commit is contained in:
chris committed 2026-08-28 19:58:43 -04:00
1 parent 20bb10114b
commit c3e2cf5ed3
38 files changed
+4863 -4186

No files matched your search

+40 -1
View File
@@ -7,7 +7,7 @@
HTTP request logger middleware for node.js
> Named after [Dexter](http://en.wikipedia.org/wiki/Dexter_Morgan), a show you should not watch until completion.
> Named after [Dexter](https://en.wikipedia.org/wiki/Dexter_Morgan), a show you should not watch until completion.
## Installation
@@ -21,6 +21,16 @@ $ npm install morgan
## API
For ES Modules:
<!-- eslint-disable no-unused-vars -->
```js
import morgan from 'morgan'
```
For CommonJS:
<!-- eslint-disable no-unused-vars -->
```js
@@ -98,6 +108,30 @@ morgan('combined', {
Output stream for writing log lines, defaults to `process.stdout`.
If the stream is in object mode (`stream.writableObjectMode` is `true`) and the
format function returns an object, the object is written to the stream as-is,
without a trailing newline. This allows passing structured log entries to
loggers that accept objects:
<!-- eslint-disable no-undef -->
```js
morgan(function (tokens, req, res) {
return {
method: tokens.method(req, res),
url: tokens.url(req, res),
status: Number(tokens.status(req, res))
}
}, {
stream: {
writableObjectMode: true,
write: function (entry) {
// entry is the object returned by the format function
}
}
})
```
#### Predefined Formats
There are various pre-defined formats provided:
@@ -134,6 +168,11 @@ for information codes.
GET /dev 200 0.224 ms - 2
```
Coloring is disabled when the [`NO_COLOR`](https://no-color.org) environment
variable is set to any non-empty value, in which case the output above is
written without any escape sequences. The variable is read once, when `morgan`
is first required.
##### short
Shorter than default, also including response time.