Skip to content

Commit

Permalink
Separate profiling middleware logs (#107)
Browse files Browse the repository at this point in the history
* Separate profiling middleware logs

* Profiling logs will write to 'profiling' logger instead of the
  standard 'security.middleware' logger

* Fix typo
  • Loading branch information
RouganStriker authored Jul 25, 2024
1 parent bc5429b commit 8a37130
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "django-security"
version = "1.0.1"
version = "1.0.2"
homepage = "https://github.com/sdelements/django-security"
description = "Models, views, middlewares and forms to facilitate security hardening of Django applications."
authors = ["Security Compass <[email protected]>"]
Expand Down
4 changes: 3 additions & 1 deletion security/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
from ua_parser import user_agent_parser

logger = logging.getLogger(__name__)
profiling_logger = logging.getLogger("profiling")

DJANGO_CLICKJACKING_MIDDLEWARE_URL = (
"https://docs.djangoproject.com/en/4.2/ref/clickjacking/"
)
Expand Down Expand Up @@ -1212,6 +1214,6 @@ def __call__(self, request):
out.write(self.format_queries_and_time_for_logs(queries))

out.write(self.request_separator)
logger.debug(out.getvalue())
profiling_logger.debug(out.getvalue())

return response

0 comments on commit 8a37130

Please sign in to comment.