Skip to content
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

allow to ignore routes based on req and res #64

Merged
merged 1 commit into from Apr 9, 2015

Conversation

saadtazi
Copy link
Contributor

Added an optional ignoreRoute option that expects a function that receives req and res as params and should return true when the request should be ignored (= not logged), false otherwise.
IgnoredRoutes now also uses req.originalUrl or url instead of req.path, which should fix #63

@@ -144,6 +144,7 @@ function logger(options) {
options.msg = options.msg || "HTTP {{req.method}} {{req.url}}";
options.colorStatus = options.colorStatus || false;
options.expressFormat = options.expressFormat || false;
options.ignoreRoute = options.ignoreRoute || function () { return false; };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we be making sure options.ignoreRoute is actually a function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I will add that.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done... And I squashed the commit for the same price.

Added an optional ignoreRoute option that expects a function that receives req and res as params and should return true when the request should be logged, false otherwise.
Fixes bithavoc#63

check if ignoreRoute is a function
@robbiet480
Copy link
Contributor

👍 for this

floatingLomas added a commit that referenced this pull request Apr 9, 2015
allow to ignore routes based on req and res
@floatingLomas floatingLomas merged commit 0f5f6bb into bithavoc:master Apr 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ignoredRoutes Doesn't Work
3 participants