aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/api/viewsets.py
diff options
context:
space:
mode:
authorGravatar Johannes Christ <[email protected]>2019-04-10 19:50:32 +0200
committerGravatar Johannes Christ <[email protected]>2019-04-10 19:50:32 +0200
commite00b347ca513e83029110ef740657b2ecda028a2 (patch)
treece1029fe09e735bd79727501c06c5f4b51b482b9 /pydis_site/apps/api/viewsets.py
parentAdd the `message` field. (diff)
Document `LogEntryViewSet`.
Diffstat (limited to 'pydis_site/apps/api/viewsets.py')
-rw-r--r--pydis_site/apps/api/viewsets.py28
1 files changed, 27 insertions, 1 deletions
diff --git a/pydis_site/apps/api/viewsets.py b/pydis_site/apps/api/viewsets.py
index b97f19b6..47915256 100644
--- a/pydis_site/apps/api/viewsets.py
+++ b/pydis_site/apps/api/viewsets.py
@@ -282,7 +282,33 @@ class InfractionViewSet(CreateModelMixin, RetrieveModelMixin, ListModelMixin, Ge
class LogEntryViewSet(CreateModelMixin, GenericViewSet):
- # TODO: doc me foobar baz boom bang crow caw caw caw
+ """
+ View providing support for creating log entries in the site database
+ for viewing via the log browser.
+
+ ## Routes
+ ### POST /logs
+ Create a new log entry.
+
+ #### Request body
+ >>> {
+ ... 'application': str, # 'bot' | 'seasonalbot' | 'site'
+ ... 'logger_name': str, # such as 'bot.cogs.moderation'
+ ... 'timestamp': Optional[str], # from `datetime.utcnow().isoformat()`
+ ... 'level': str, # 'debug' | 'info' | 'warning' | 'error' | 'critical'
+ ... 'module': str, # such as 'pydis_site.apps.api.serializers'
+ ... 'line': int, # > 0
+ ... 'message': str, # textual formatted content of the logline
+ ... }
+
+ #### Status codes
+ - 201: returned on success
+ - 400: if the request body has invalid fields, see the response for details
+
+ ## Authentication
+ Requires a API token.
+ """
+
queryset = LogEntry.objects.all()
serializer_class = LogEntrySerializer