import logging from odoo import api, fields, models, _ from odoo import tools from .dss_settings import dssSettings class OdooCustomLogger(logging.Logger): dolog = True """ Custom Logger class for Odoo that overrides the info and warn methods. """ def setloging(self,dolog): self.dolog = dolog def info(self, msg, *args, **kwargs): # Custom behavior for the info method msg = f"[INFO - Custom]: {msg}" if self.dolog: # Log the message at the INFO level super().info(msg, *args, **kwargs) def warn(self, msg, *args, **kwargs): # Custom behavior for the warn method msg = f"[WARN - Custom]: {msg}" # super().warning(msg, *args, **kwargs) # Use `warning` instead of `warn` (deprecated in Python 3) # settings = dssSettings.search(dssSettings,domain=[],limit=1) # showdebug= settings.showdebug if self.dolog: # Log the message at the INFO level super().info(msg, *args, **kwargs)