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:
Yannick Payot
2023-05-11 11:17:54 +02:00
parent 0000eab313
commit 71da584087
80 changed files with 1596 additions and 879 deletions
-1
View File
@@ -1,2 +1 @@
from . import json_log
+12 -14
View File
@@ -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,
}
+7 -10
View File
@@ -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