node-bunyan icon indicating copy to clipboard operation
node-bunyan copied to clipboard

Support "warning" as an alias for "warn"

Open voxpelli opened this issue 6 years ago • 6 comments

Having ones app fail because someone configured the log level to be warning rather than warn is not much fun and seems like this could be avoided by supporting warning as an alias for warn.

Example:

Failed to start server: Error: unknown level name: "warning"
  at resolveLevel (/app/node_modules/bunyan/lib/bunyan.js:293:19)

voxpelli avatar Mar 21 '18 09:03 voxpelli

or maybe throw an error if it doesn't match something

ORESoftware avatar Apr 27 '18 05:04 ORESoftware

@ORESoftware Not sure I understand? Throwing an error is precisely what calling .warning() does today does – this issue is about adding .warning() as an alias for .warn() to avoid crashes when someone mistakenly picks the noun rather than the verb as the method name (which is easy, considering that .error() can be both the noun and the verb and .info() is a noun and not a verb)

voxpelli avatar Apr 27 '18 08:04 voxpelli

@voxpelli oh I see what you're saying, yeah I kinda agree now

ORESoftware avatar Apr 27 '18 18:04 ORESoftware

Just happened to me. Would be a great thing

ValentinFunk avatar Jan 13 '19 22:01 ValentinFunk

Agreed, confusing terminology as @voxpelli stated

alyxb avatar May 22 '20 17:05 alyxb

The IETF syslog standard uses warning, not warn, and this has already generated confusion and errors.

same with err and error.

And these can be hard to test for, because those are typically only called for rare exception cases.

The logger.child() construction style also makes monkey patching this non-obvious.

pszabop avatar Oct 20 '22 20:10 pszabop