mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-23 18:04:34 +00:00
[FIX] logging_json: forward compatibility
Make the module compatible w/ ``python-json-logger==3.3.*`` (importing ``jsonlogger`` displays a deprecation warning)
This commit is contained in:
committed by
SilvioC2C
co-authored by
SilvioC2C
parent
fdbf1b4e4b
commit
9c364fea1c
@@ -6,17 +6,23 @@ import os
|
||||
import threading
|
||||
import uuid
|
||||
|
||||
import pythonjsonlogger
|
||||
|
||||
from odoo import http
|
||||
|
||||
from .strtobool import strtobool
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
try:
|
||||
from pythonjsonlogger import jsonlogger
|
||||
except ImportError:
|
||||
# Module ``jsonlogger`` of package ``python-json-logger`` is deprecated since version
|
||||
# 3.1.0, keep it for backward compatibility
|
||||
if hasattr(pythonjsonlogger, "json"):
|
||||
jsonlogger = pythonjsonlogger.json
|
||||
elif hasattr(pythonjsonlogger, "jsonlogger"):
|
||||
jsonlogger = pythonjsonlogger.jsonlogger
|
||||
else:
|
||||
jsonlogger = None # noqa
|
||||
_logger.debug("Cannot 'import pythonjsonlogger'.")
|
||||
_logger.debug("Cannot import 'json' or 'jsonlogger' from 'pythonjsonlogger'.")
|
||||
|
||||
|
||||
def is_true(strval):
|
||||
|
||||
Reference in New Issue
Block a user