mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-24 02:08:36 +00:00
Change CI to GitHub actions
Use copier template from oca/oca-addons-repo-template Target Python3.8 Apply linting Fix a missing call to super Ensure all modules have a 13.0.x.x.x version
This commit is contained in:
@@ -1,2 +1 @@
|
||||
|
||||
from . import json_log
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
# Copyright 2016-2019 Camptocamp SA
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
||||
|
||||
{'name': 'JSON Logging',
|
||||
'version': '13.0.1.0.0',
|
||||
'author': 'Camptocamp,Odoo Community Association (OCA)',
|
||||
'license': 'AGPL-3',
|
||||
'category': 'Extra Tools',
|
||||
'depends': ['base',
|
||||
],
|
||||
'external_dependencies': {
|
||||
'python': ['python-json-logger'],
|
||||
},
|
||||
'website': 'http://www.camptocamp.com',
|
||||
'data': [],
|
||||
'installable': True,
|
||||
}
|
||||
{
|
||||
"name": "JSON Logging",
|
||||
"version": "13.0.1.0.0",
|
||||
"author": "Camptocamp,Odoo Community Association (OCA)",
|
||||
"license": "AGPL-3",
|
||||
"category": "Extra Tools",
|
||||
"depends": ["base"],
|
||||
"external_dependencies": {"python": ["python-json-logger"]},
|
||||
"website": "https://github.com/camptocamp/odoo-cloud-platform",
|
||||
"data": [],
|
||||
"installable": True,
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import logging
|
||||
import os
|
||||
import threading
|
||||
import uuid
|
||||
|
||||
from distutils.util import strtobool
|
||||
|
||||
from odoo import http
|
||||
@@ -20,24 +19,22 @@ except ImportError:
|
||||
|
||||
|
||||
def is_true(strval):
|
||||
return bool(strtobool(strval or '0'.lower()))
|
||||
return bool(strtobool(strval or "0".lower()))
|
||||
|
||||
|
||||
class OdooJsonFormatter(jsonlogger.JsonFormatter):
|
||||
|
||||
def add_fields(self, log_record, record, message_dict):
|
||||
record.pid = os.getpid()
|
||||
record.dbname = getattr(threading.currentThread(), 'dbname', '?')
|
||||
record.request_id = getattr(threading.current_thread(), 'request_uuid', None)
|
||||
record.uid = getattr(threading.current_thread(), 'uid', None)
|
||||
record.dbname = getattr(threading.currentThread(), "dbname", "?")
|
||||
record.request_id = getattr(threading.current_thread(), "request_uuid", None)
|
||||
record.uid = getattr(threading.current_thread(), "uid", None)
|
||||
_super = super(OdooJsonFormatter, self)
|
||||
return _super.add_fields(log_record, record, message_dict)
|
||||
|
||||
|
||||
if is_true(os.environ.get('ODOO_LOGGING_JSON')):
|
||||
format = ('%(asctime)s %(pid)s %(levelname)s'
|
||||
'%(dbname)s %(name)s: %(message)s')
|
||||
formatter = OdooJsonFormatter(format)
|
||||
if is_true(os.environ.get("ODOO_LOGGING_JSON")):
|
||||
format_str = "%(asctime)s %(pid)s %(levelname)s" "%(dbname)s %(name)s: %(message)s"
|
||||
formatter = OdooJsonFormatter(format_str)
|
||||
logging.getLogger().handlers[0].formatter = formatter
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user