limit log to debug only

This commit is contained in:
Simon 2025-11-15 11:08:33 +07:00
parent b42b951738
commit d4c3547791
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
1 changed files with 5 additions and 1 deletions

View File

@ -3,6 +3,7 @@
from common.src.env_settings import EnvironmentSettings
from common.src.es_connect import ElasticWrap
from common.src.helper import get_duration_str
from django.conf import settings
class AggBase:
@ -15,7 +16,10 @@ class AggBase:
def get(self):
"""make get call"""
response, _ = ElasticWrap(self.path).get(self.data)
print(f"[agg][{self.name}] took {response.get('took')} ms to process")
if settings.DEBUG:
print(
f"[agg][{self.name}] took {response.get('took')} ms to process"
)
return response.get("aggregations")