-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent defaults and deprecation messages #163
Comments
Ah, good catch. Definitely makes sense! We'll get it updated, though if you want to take it up and make a pull request, feel welcome to do so 👍Just the change in message sounds spot on from your assessment without looking further at it. |
So taking a look, I see what happened here and how you ended up with some weird messages. You didn't actually construct the middleware at all in your exanple, passing the factory as a middleware instead of an actual middleware:
The weirdness I'm not sure can be fixed without actually breaking stuff. If you have an idea for how to do it, please feel free to pull request it. It is eluding me, at least. |
@dougwilson right ! Indeed I was using it wrongly.
I've tackled 2) in #164 And proposed there a way to detect 1) and some doubts on how to handle it. Please check that PR Thanks ! Cheers |
Thanks! The PR does the same thing I tried yesterday which doesn't work: the formats default and combined are different. You can't just suddenly change people's existing code to start using the combined format. That would be a semver major change, in which case all deprecations would be removed as part of any semver major update anyway. |
const morgan = require("morgan"); Make sure you're not calling app.use(morgan) anywhere else in your code. |
Hi guys !
This is probably a really tiny not-too-imporant bug, but well.. just found it and I think that it could help others.
Setting up express with morgan in this way
Gives this deprecation warning (when trying to log a request, not at start up)
morgan deprecated morgan(options): use morgan("default", options) instead node_modules/express/lib/router/layer.js:95:5 morgan deprecated default format: use combined format node_modules/express/lib/router/layer.js:95:5
It is of course wrong, but I believe it was "the old way".
Anyway notice there that id proposes you to use
default
(use morgan("default", options)
)But this is in turn deprecated, so if you change it like that you will get another deprecation message
You get
So, I believe that the first message should be updated to directly instruct you to use the "combined" option instead of the "default".
Thanks !
Regards !
The text was updated successfully, but these errors were encountered: