-
Notifications
You must be signed in to change notification settings - Fork 19
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
Log options - provide an event emitter API #68
Comments
Can you provide a bit more detail on how you expect this to look? We don't want to add any logging dependency here, I think the only way to make this generic would be to:
An event emitter could be backwards compatible and could be a good thing to have. |
thanks for the rely! let's say I want to know what is the exactly reason caused proposal:
|
Yep, I think events are going to be a better option. I don't want So what I'm proposing instead would look something like this: if (typeof csrfCookie !== "string") {
eventEmitter.emit('csrfCookieInvalid', req, csrfCookie);
return false;
} And it would allow you to do something like this: eventEmitter.on('csrfCookieInvalid', (req, csrfCookie) => {
logger('error', 'csrfCookie type is incorrect');
}); Where To achieve the same thing, the benefit here is, the events emitted can be used to do anything at particular steps of the CSRF middleware, not just log. It also keeps any logging users want to do out of the middleware itself and in complete control of the user. This event approach also sets things up to make the default export a class instance which extends the Node |
sounds good! thanks! |
Any plan to add custom logger?
or I can send a PR
The text was updated successfully, but these errors were encountered: