mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-24 02:08:36 +00:00
Add possibility to add a filter
But still output everything
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
'author': 'Camptocamp',
|
'author': 'Camptocamp',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
'category': 'category',
|
'category': 'category',
|
||||||
'depends': ['base'],
|
'depends': ['base', 'web'],
|
||||||
'website': 'http://www.camptocamp.com',
|
'website': 'http://www.camptocamp.com',
|
||||||
'data': [],
|
'data': [],
|
||||||
'installable': True,
|
'installable': True,
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ class IrHttp(models.AbstractModel):
|
|||||||
begin = time.time()
|
begin = time.time()
|
||||||
response = super(IrHttp, self)._dispatch()
|
response = super(IrHttp, self)._dispatch()
|
||||||
end = time.time()
|
end = time.time()
|
||||||
if not self._monitoring_blacklist(http_request):
|
if (not self._monitoring_blacklist(http_request) and
|
||||||
|
self._monitoring_filter(http_request)):
|
||||||
info = self._monitoring_info(http_request, response, begin, end)
|
info = self._monitoring_info(http_request, response, begin, end)
|
||||||
self._monitoring_log(info)
|
self._monitoring_log(info)
|
||||||
return response
|
return response
|
||||||
@@ -32,7 +33,11 @@ class IrHttp(models.AbstractModel):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def _monitoring_filter(self, request):
|
||||||
|
return True
|
||||||
|
|
||||||
def _monitoring_info(self, request, response, begin, end):
|
def _monitoring_info(self, request, response, begin, end):
|
||||||
|
path = request.httprequest.environ.get('PATH_INFO')
|
||||||
info = {
|
info = {
|
||||||
# timing
|
# timing
|
||||||
'start_time': time.strftime("%Y-%m-%d %H:%M:%S",
|
'start_time': time.strftime("%Y-%m-%d %H:%M:%S",
|
||||||
@@ -41,17 +46,17 @@ class IrHttp(models.AbstractModel):
|
|||||||
# HTTP things
|
# HTTP things
|
||||||
'method': request.httprequest.method,
|
'method': request.httprequest.method,
|
||||||
'url': request.httprequest.url,
|
'url': request.httprequest.url,
|
||||||
'path': request.httprequest.environ.get('PATH_INFO'),
|
'path': path,
|
||||||
'content_type': request.httprequest.environ.get('CONTENT_TYPE'),
|
'content_type': request.httprequest.environ.get('CONTENT_TYPE'),
|
||||||
'user_agent': request.httprequest.environ.get('HTTP_USER_AGENT'),
|
'user_agent': request.httprequest.environ.get('HTTP_USER_AGENT'),
|
||||||
# Odoo things
|
# Odoo things
|
||||||
'db': None,
|
'db': None,
|
||||||
'uid': request.uid,
|
'uid': request.uid,
|
||||||
'login': None,
|
'login': None,
|
||||||
'json_method': None,
|
|
||||||
'server_environment': config.get('running_env'),
|
'server_environment': config.get('running_env'),
|
||||||
'model': None,
|
'model': None,
|
||||||
'model_method': None,
|
'model_method': None,
|
||||||
|
'workflow_signal': None,
|
||||||
# response things
|
# response things
|
||||||
'response_status_code': response.status_code,
|
'response_status_code': response.status_code,
|
||||||
}
|
}
|
||||||
@@ -60,12 +65,11 @@ class IrHttp(models.AbstractModel):
|
|||||||
'login': request.session.get('login'),
|
'login': request.session.get('login'),
|
||||||
'db': request.session.get('db'),
|
'db': request.session.get('db'),
|
||||||
})
|
})
|
||||||
if hasattr(request, 'jsonrequest'):
|
|
||||||
info['json_method'] = request.jsonrequest.get('method')
|
|
||||||
if hasattr(request, 'params'):
|
if hasattr(request, 'params'):
|
||||||
info.update({
|
info.update({
|
||||||
'model': request.params.get('model'),
|
'model': request.params.get('model'),
|
||||||
'model_method': request.params.get('method'),
|
'model_method': request.params.get('method'),
|
||||||
|
'workflow_signal': request.params.get('signal'),
|
||||||
})
|
})
|
||||||
return info
|
return info
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user