django-log-formatter-asim 0.0.0__tar.gz → 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {django_log_formatter_asim-0.0.0 → django_log_formatter_asim-0.0.1}/PKG-INFO +2 -3
- {django_log_formatter_asim-0.0.0 → django_log_formatter_asim-0.0.1}/django_log_formatter_asim/__init__.py +4 -8
- {django_log_formatter_asim-0.0.0 → django_log_formatter_asim-0.0.1}/pyproject.toml +2 -3
- {django_log_formatter_asim-0.0.0 → django_log_formatter_asim-0.0.1}/LICENSE +0 -0
- {django_log_formatter_asim-0.0.0 → django_log_formatter_asim-0.0.1}/README.md +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: django-log-formatter-asim
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.1
|
|
4
4
|
Summary: Formats Django logs in ASIM format.
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: Department for Business and Trade Platform Team
|
|
@@ -12,8 +12,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.10
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
-
Requires-Dist: django (>=
|
|
16
|
-
Requires-Dist: django-ipware (>=5.0.2,<6.0.0)
|
|
15
|
+
Requires-Dist: django (>=3,<5)
|
|
17
16
|
Description-Content-Type: text/markdown
|
|
18
17
|
|
|
19
18
|
# Django ASIM log formatter
|
|
@@ -22,7 +22,7 @@ class ASIMFormatterBase:
|
|
|
22
22
|
user.first_name = "{{FIRST_NAME}}"
|
|
23
23
|
user.last_name = "{{LAST_NAME}}"
|
|
24
24
|
|
|
25
|
-
def
|
|
25
|
+
def get_log_dict(self):
|
|
26
26
|
record = self.record
|
|
27
27
|
log_time = datetime.utcfromtimestamp(record.created).isoformat()
|
|
28
28
|
log_dict = {
|
|
@@ -68,16 +68,12 @@ class ASIMFormatterBase:
|
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
class ASIMSystemFormatter(ASIMFormatterBase):
|
|
71
|
-
|
|
72
|
-
return self._get_log_dict_base()
|
|
71
|
+
pass
|
|
73
72
|
|
|
74
73
|
|
|
75
74
|
class ASIMRequestFormatter(ASIMFormatterBase):
|
|
76
|
-
def __init__(self, record):
|
|
77
|
-
super().__init__(record)
|
|
78
|
-
|
|
79
75
|
def get_log_dict(self):
|
|
80
|
-
log_dict =
|
|
76
|
+
log_dict = super().get_log_dict()
|
|
81
77
|
|
|
82
78
|
request = self.record.request
|
|
83
79
|
|
|
@@ -118,7 +114,7 @@ class ASIMRequestFormatter(ASIMFormatterBase):
|
|
|
118
114
|
request = self.record.request
|
|
119
115
|
http_user_agent = getattr(request, "user_agent", None)
|
|
120
116
|
if not http_user_agent:
|
|
121
|
-
http_user_agent = getattr(request.headers, "
|
|
117
|
+
http_user_agent = getattr(request.headers, "User-Agent", None)
|
|
122
118
|
if not http_user_agent:
|
|
123
119
|
http_user_agent = request.META.get("HTTP_USER_AGENT", None)
|
|
124
120
|
return http_user_agent
|
|
@@ -3,7 +3,7 @@ line-length = 100
|
|
|
3
3
|
|
|
4
4
|
[tool.poetry]
|
|
5
5
|
name = "django-log-formatter-asim"
|
|
6
|
-
version = "0.0.
|
|
6
|
+
version = "0.0.1"
|
|
7
7
|
description = "Formats Django logs in ASIM format."
|
|
8
8
|
authors = ["Department for Business and Trade Platform Team <sre-team@digital.trade.gov.uk>"]
|
|
9
9
|
license = "MIT"
|
|
@@ -13,8 +13,7 @@ packages = [
|
|
|
13
13
|
]
|
|
14
14
|
|
|
15
15
|
[tool.poetry.dependencies]
|
|
16
|
-
django = "
|
|
17
|
-
django-ipware = "^5.0.2"
|
|
16
|
+
django = ">=3,<5"
|
|
18
17
|
python = ">=3.9,<4"
|
|
19
18
|
|
|
20
19
|
[tool.poetry.group.dev.dependencies]
|
|
File without changes
|
|
File without changes
|