Skip to content

Commit

Permalink
refactored deprecation message for default format to fix issue when…
Browse files Browse the repository at this point in the history
… using `esm` module. see expressjs#190
  • Loading branch information
mbrowne committed Jul 19, 2019
1 parent 12a48c5 commit 59e2fc7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ unreleased
* deps: depd@~2.0.0
- Replace internal `eval` usage with `Function` constructor
- Use instance methods on `process` to check for listeners
* refactored deprecation message for `default` format to fix issue when using `esm` module

1.9.1 / 2018-09-10
==================
Expand Down
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ morgan.format('common', ':remote-addr - :remote-user [:date[clf]] ":method :url
* Default format.
*/

// @deprecated
morgan.format('default', ':remote-addr - :remote-user [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"')
deprecate.property(morgan, 'default', 'default format: use combined format')

/**
* Short format.
Expand Down Expand Up @@ -448,6 +448,10 @@ function getFormatFunction (name) {
// lookup format
var fmt = morgan[name] || name || morgan.default

if (fmt === morgan.default) {
deprecate('default format: use combined format')
}

// return compiled format
return typeof fmt !== 'function'
? compile(fmt)
Expand Down

0 comments on commit 59e2fc7

Please sign in to comment.