restify / node-restify

The future of Node.js REST development
http://restify.com
MIT License
10.71k stars 981 forks source link

Allow overriding log in `plugins/audit` #1947

Open juneidy opened 1 year ago

juneidy commented 1 year ago

Feature Request

Use Case

So the change in 528ecbcec5d70c458749bdd4c4cc3f9e06ab69a2 means that whatever log I passed into auditLogger is not prioritised over the log from createServer.

I would imagine that whatever new log passed to auditLogger should take precedence.

Example API

const server = restify.createServer({ log: loggerA , ... });
server.on('after', restify.plugins.auditLogger({ log: loggerB, ... }));

I would expect loggerB would be used instead of loggerA.

Are you willing and able to implement this?

I can quickly do the fix, but not sure about the tests.