mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-24 02:08:36 +00:00
Merge pull request #66 from guewen/11.0-filter-monitoring-status-log
[11.0] Filter /monitoring/status werkzeug logs
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
# Copyright 2016 Camptocamp SA
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
||||
|
||||
import logging
|
||||
import json
|
||||
|
||||
import werkzeug
|
||||
@@ -10,6 +11,21 @@ from odoo import http
|
||||
from odoo.addons.web.controllers.main import ensure_db
|
||||
|
||||
|
||||
class HealthCheckFilter(logging.Filter):
|
||||
|
||||
def __init__(self, path, name=''):
|
||||
super().__init__(name)
|
||||
self.path = path
|
||||
|
||||
def filter(self, record):
|
||||
return self.path not in record.getMessage()
|
||||
|
||||
|
||||
logging.getLogger('werkzeug').addFilter(
|
||||
HealthCheckFilter('"GET /monitoring/status HTTP/1.1"')
|
||||
)
|
||||
|
||||
|
||||
class Monitoring(http.Controller):
|
||||
|
||||
@http.route('/monitoring/status', type='http', auth='none')
|
||||
|
||||
Reference in New Issue
Block a user