diff --git a/shiftregister/messaging/backends/dummy.py b/shiftregister/messaging/backends/dummy.py index dc50ed0..b3483c7 100644 --- a/shiftregister/messaging/backends/dummy.py +++ b/shiftregister/messaging/backends/dummy.py @@ -41,7 +41,8 @@ class WebhookReceiver(BaseReceiver): if not 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}" ) + yield Message(key, sender=sender, text=text, type=MessageType.INBOUND) diff --git a/shiftregister/settings.py b/shiftregister/settings.py index f66b04f..79dbe4b 100644 --- a/shiftregister/settings.py +++ b/shiftregister/settings.py @@ -240,3 +240,23 @@ SMS_OUTBOUND_BACKEND = ".".join( ) SMS_SETTINGS = env.dict("SMS_SETTINGS", default={}) 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"], + }, + }, +}