mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-23 18:04:34 +00:00
Merge pull request #65 from guewen/filter-monitoring-status-log
[12.0] Filter /monitoring/status werkzeug logs
This commit is contained in:
@@ -1,2 +1 @@
|
||||
|
||||
from . import controllers
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Copyright 2016-2018 Camptocamp SA
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
||||
|
||||
import logging
|
||||
import json
|
||||
|
||||
import werkzeug
|
||||
@@ -9,6 +10,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