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

Implement Logger middleware regex exclude pattern #1723

Merged
merged 9 commits into from Oct 19, 2020

Conversation

mattgathu
Copy link
Contributor

@mattgathu mattgathu commented Oct 3, 2020

PR Type

Feature

PR Checklist

Check your PR fulfills the following:

  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • A changelog entry has been made for the appropriate packages.
  • Format code with the latest stable rustfmt

Overview

Support use of regex for logger exclusion rules

part of #1682

@mattgathu mattgathu changed the title Implement regex log exclusion rules Implement Logger middleware regex exclude pattern Oct 3, 2020
@codecov-commenter
Copy link

codecov-commenter commented Oct 3, 2020

Codecov Report

Merging #1723 into master will increase coverage by 0.10%.
The diff coverage is 94.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1723      +/-   ##
==========================================
+ Coverage   53.49%   53.60%   +0.10%     
==========================================
  Files         128      126       -2     
  Lines       11979    11985       +6     
==========================================
+ Hits         6408     6424      +16     
+ Misses       5571     5561      -10     
Impacted Files Coverage Δ
src/middleware/logger.rs 76.98% <94.44%> (+1.17%) ⬆️
...ctix-http/src/header/common/if_unmodified_since.rs
actix-http/src/header/common/allow.rs
actix-http/src/header/common/if_none_match.rs
actix-http/src/header/common/accept_language.rs
actix-http/src/header/common/etag.rs 0.00% <0.00%> (ø)
actix-http/src/header/common/if_modified_since.rs 0.00% <0.00%> (ø)
actix-http/src/header/common/mod.rs 10.00% <0.00%> (+2.30%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c2c71cc...b6938de. Read the comment docs.

What
--
Support use of regex for logger exclusion rules

part of actix#1682
@mattgathu mattgathu marked this pull request as ready for review October 9, 2020 11:42
@codecov-io
Copy link

codecov-io commented Oct 9, 2020

Codecov Report

Merging #1723 into master will increase coverage by 0.07%.
The diff coverage is 94.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1723      +/-   ##
==========================================
+ Coverage   53.51%   53.58%   +0.07%     
==========================================
  Files         125      125              
  Lines       11987    12001      +14     
==========================================
+ Hits         6415     6431      +16     
+ Misses       5572     5570       -2     
Impacted Files Coverage Δ
src/middleware/logger.rs 76.98% <94.44%> (+1.17%) ⬆️
actix-http/src/header/common/content_language.rs
actix-http/src/header/common/accept_language.rs
actix-http/src/header/common/if_none_match.rs
actix-http/src/header/common/accept_charset.rs 0.00% <0.00%> (ø)
actix-http/src/header/common/etag.rs 0.00% <0.00%> (ø)
actix-http/src/header/common/allow.rs 0.00% <0.00%> (ø)
actix-http/src/header/common/mod.rs 11.11% <0.00%> (+1.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d765e90...78668ad. Read the comment docs.

CHANGES.md Outdated Show resolved Hide resolved
@robjtede robjtede added A-web project: actix-web B-semver-minor labels Oct 9, 2020
@robjtede robjtede requested review from a team October 9, 2020 14:11
Copy link
Member

@robjtede robjtede left a comment

Choose a reason for hiding this comment

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

Looks alright so far. I think that middleware constructors should panic on invalid input so we can either just panic or require that a regex is passed in that we extract the known good pattern from.

src/middleware/logger.rs Outdated Show resolved Hide resolved
src/middleware/logger.rs Outdated Show resolved Hide resolved
src/middleware/logger.rs Outdated Show resolved Hide resolved
@mattgathu
Copy link
Contributor Author

Looks alright so far. I think that middleware constructors should panic on invalid input so we can either just panic or require that a regex is passed in that we extract the known good pattern from.

I went with panic, to avoid the user having to rely on the regex crate and also avoid incompatibility if the user's regex crate version significantly differs from the one used by Actix.

@robjtede robjtede self-requested a review October 19, 2020 05:28
@robjtede robjtede linked an issue Oct 19, 2020 that may be closed by this pull request
Copy link
Member

@robjtede robjtede left a comment

Choose a reason for hiding this comment

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

I agree that not forwarding (leaking) the regex error type is a compelling reason to panic instead. Thanks for tackling this.

@robjtede robjtede merged commit cfd5b38 into actix:master Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-web project: actix-web B-semver-minor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Logger middleware exclude pattern
4 participants