chore: add custom logging config
This commit is contained in:
parent
10dbb06957
commit
69c9faa4bc
|
@ -41,7 +41,8 @@ class WebhookReceiver(BaseReceiver):
|
||||||
if not sender:
|
if not sender:
|
||||||
raise ValueError("message has no sender")
|
raise ValueError("message has no sender")
|
||||||
|
|
||||||
logging.getLogger("django.server").info(
|
logger.info(
|
||||||
f"received sms via webhook\nkey: {key}\nfrom: {sender}\nadditional fields: {pformat(kwargs)}\n\n{text}"
|
f"received sms via webhook\nkey: {key}\nfrom: {sender}\nadditional fields: {pformat(kwargs)}\n\n{text}"
|
||||||
)
|
)
|
||||||
|
|
||||||
yield Message(key, sender=sender, text=text, type=MessageType.INBOUND)
|
yield Message(key, sender=sender, text=text, type=MessageType.INBOUND)
|
||||||
|
|
|
@ -240,3 +240,23 @@ SMS_OUTBOUND_BACKEND = ".".join(
|
||||||
)
|
)
|
||||||
SMS_SETTINGS = env.dict("SMS_SETTINGS", default={})
|
SMS_SETTINGS = env.dict("SMS_SETTINGS", default={})
|
||||||
SMS_WEBHOOK_SECRET = env("SMS_WEBHOOK_SECRET", default=None)
|
SMS_WEBHOOK_SECRET = env("SMS_WEBHOOK_SECRET", default=None)
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
# https://docs.djangoproject.com/en/5.0/howto/logging/#customize-logging-configuration
|
||||||
|
|
||||||
|
LOGGING = {
|
||||||
|
"version": 1,
|
||||||
|
"disable_existing_loggers": False,
|
||||||
|
"handlers": {
|
||||||
|
"console": {
|
||||||
|
"level": "DEBUG" if DEBUG else "WARNING",
|
||||||
|
"class": "logging.StreamHandler",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"loggers": {
|
||||||
|
"shiftregister": {
|
||||||
|
"level": "DEBUG" if DEBUG else "WARNING",
|
||||||
|
"handlers": ["console"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue