teler-sh / teler-waf

teler-waf is a Go HTTP middleware that protects local web services from OWASP Top 10 threats, known vulnerabilities, malicious actors, botnets, unwanted crawlers, and brute force attacks.
https://test.teler.sh
Apache License 2.0
354 stars 32 forks source link

feat: add LogWriter field #103

Closed dwisiswant0 closed 1 year ago

dwisiswant0 commented 1 year ago

IMPORTANT: Please do not create a PR without creating an issue first!

(Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request).

Summary

This pull request adds the LogWriter field and makes corresponding code changes in the teler package to ensure that log messages are written to the LogWriter in addition to other destinations if it is provided. It clarifies the behavior of the LogWriter field in the documentation and ensures that log messages are correctly routed to the custom LogWriter when it is non-nil.

Proposed of changes

This PR fixes/implements the following bugs/features:

How has this been tested?

Proof:

go test -v -race -run "TestNewWithLogWriter"

Closing issues

Fixes #

Checklist:

codecov-commenter commented 1 year ago

Codecov Report

All modified lines are covered by tests :white_check_mark:

Comparison is base (209249e) 75.67% compared to head (7c36ae9) 75.80%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #103 +/- ## ========================================== + Coverage 75.67% 75.80% +0.13% ========================================== Files 6 6 Lines 1106 1112 +6 ========================================== + Hits 837 843 +6 Misses 217 217 Partials 52 52 ``` | [Files](https://app.codecov.io/gh/kitabisa/teler-waf/pull/103?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kitabisa) | Coverage Δ | | |---|---|---| | [teler.go](https://app.codecov.io/gh/kitabisa/teler-waf/pull/103?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kitabisa#diff-dGVsZXIuZ28=) | `77.27% <100.00%> (+0.33%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.