Skip to content

Commit 58cdf45

Browse files
committed
Remove azure-storage-logging
- Update azure-* dependencies using django-storages - Add azure-identity to support azure identity (not used right now)
1 parent 6908352 commit 58cdf45

File tree

3 files changed

+131
-107
lines changed

3 files changed

+131
-107
lines changed

api/logger.py

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import logging
22
import sys
33

4-
from azure_storage_logging.handlers import (
5-
BlobStorageTimedRotatingFileHandler as storage,
6-
)
7-
from django.conf import settings
8-
94
formatter = logging.Formatter(fmt="%(asctime)s %(levelname)-8s %(message)s", datefmt="%Y-%m-%d %H:%M:%S")
105

116
screen_handler = logging.StreamHandler(stream=sys.stdout)
@@ -15,17 +10,25 @@
1510
logger.setLevel("DEBUG")
1611
logger.addHandler(screen_handler)
1712

18-
if settings.AZURE_STORAGE_ACCOUNT is not None and settings.AZURE_STORAGE_KEY is not None:
19-
handler = storage(
20-
account_name=settings.AZURE_STORAGE_ACCOUNT,
21-
account_key=settings.AZURE_STORAGE_KEY,
22-
filename="go.log",
23-
when="M",
24-
interval=90,
25-
container="logs",
26-
encoding="utf-8",
27-
)
28-
handler.setFormatter(formatter)
29-
logger.addHandler(handler)
30-
else:
31-
logger.warning("No Azure credentials found, falling back to local logs.")
13+
# NOTE: Disabled due to old azure_storage_logging package.
14+
# TODO: Replace this with opentelemetry?
15+
# https://learn.microsoft.com/en-us/azure/azure-monitor/app/opentelemetry-enable?tabs=python
16+
# from azure_storage_logging.handlers import (
17+
# BlobStorageTimedRotatingFileHandler as storage,
18+
# )
19+
# from django.conf import settings
20+
#
21+
# if settings.AZURE_STORAGE_ACCOUNT is not None and settings.AZURE_STORAGE_KEY is not None:
22+
# handler = storage(
23+
# account_name=settings.AZURE_STORAGE_ACCOUNT,
24+
# account_key=settings.AZURE_STORAGE_KEY,
25+
# filename="go.log",
26+
# when="M",
27+
# interval=90,
28+
# container="logs",
29+
# encoding="utf-8",
30+
# )
31+
# handler.setFormatter(formatter)
32+
# logger.addHandler(handler)
33+
# else:
34+
# logger.warning("No Azure credentials found, falling back to local logs.")

pyproject.toml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@ dependencies = [
1212
"Pillow==10.3.0",
1313
"PyPDF2==1.27.9",
1414
"pdf2image==1.16.0",
15-
"azure-storage==0.36.0",
16-
"azure-common==1.1.19",
17-
"azure-nspkg==3.0.2",
18-
"azure-storage-blob==1.5.0",
19-
"azure-storage-common==1.4.0",
20-
"azure-storage-logging==0.5.1",
21-
"azure-storage-nspkg==3.1.0",
2215
"beautifulsoup4==4.6.3",
2316
"boto3==1.20.38",
2417
"choicesenum==0.7.0",
@@ -39,7 +32,7 @@ dependencies = [
3932
"django-read-only==1.12.0",
4033
"django-reversion-compare==0.16.2",
4134
"django-reversion==5.0.12",
42-
"django-storages[s3]==1.11.1", # FIXME: Add azure
35+
"django-storages[s3,azure]==1.14.5",
4336
"django-tinymce==4.1.0",
4437
"django-oauth-toolkit==3.0.1",
4538
"djangorestframework-csv==2.1.1",
@@ -85,7 +78,7 @@ dependencies = [
8578
"pyjwt",
8679
"shapely",
8780
"colorlog",
88-
# "azure-identity", # Required by django-storages[azure] if used
81+
"azure-identity", # Required by django-storages[azure] if used
8982
"mapbox-tilesets",
9083
"ipython",
9184
"tiktoken",

uv.lock

Lines changed: 107 additions & 79 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)