Mercurial > p > roundup > code
diff roundup/rest.py @ 7726:6f66d74d37f3
Add configurable logging for REST
We now log status code and error message for failing REST requests.
Introduces new config item rest_logging in section [web].
Fixes (part of) issue2551274.
| author | Ralf Schlatterbeck <rsc@runtux.com> |
|---|---|
| date | Wed, 17 Jan 2024 17:07:23 +0100 |
| parents | 3eca3462ba0c |
| children | 216662fbaaee |
line wrap: on
line diff
--- a/roundup/rest.py Tue Jan 02 11:32:37 2024 -0500 +++ b/roundup/rest.py Wed Jan 17 17:07:23 2024 +0100 @@ -107,6 +107,10 @@ # decorate it self.client.response_code = code if code >= 400: # any error require error format + logmethod = getattr(logger, self.db.config.WEB_REST_LOGGING, None) + if logmethod: + logmethod("statuscode: %s" % code) + logmethod('message: "%s"' % data) result = { 'error': { 'status': code,
