|
1 | 1 | import logging |
2 | 2 | import sys |
3 | 3 |
|
4 | | -from azure_storage_logging.handlers import ( |
5 | | - BlobStorageTimedRotatingFileHandler as storage, |
6 | | -) |
7 | | -from django.conf import settings |
8 | | - |
9 | 4 | formatter = logging.Formatter(fmt="%(asctime)s %(levelname)-8s %(message)s", datefmt="%Y-%m-%d %H:%M:%S") |
10 | 5 |
|
11 | 6 | screen_handler = logging.StreamHandler(stream=sys.stdout) |
|
15 | 10 | logger.setLevel("DEBUG") |
16 | 11 | logger.addHandler(screen_handler) |
17 | 12 |
|
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.") |
0 commit comments