ZHA log helper (#25543)
* Logging helper. * Use log helper for ZHA entities. * Use log helper for ZHA core device. * Log helper for ZHA core channels. * Lint * ZHA fixture fix.
This commit is contained in:
parent
2c144bc412
commit
5aa35b52cc
13 changed files with 106 additions and 105 deletions
|
@ -207,3 +207,27 @@ def async_is_bindable_target(source_zha_device, target_zha_device):
|
|||
if any(bindable in bindables for bindable in matches):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
class LogMixin:
|
||||
"""Log helper."""
|
||||
|
||||
def log(self, level, msg, *args):
|
||||
"""Log with level."""
|
||||
raise NotImplementedError
|
||||
|
||||
def debug(self, msg, *args):
|
||||
"""Debug level log."""
|
||||
return self.log(logging.DEBUG, msg, *args)
|
||||
|
||||
def info(self, msg, *args):
|
||||
"""Info level log."""
|
||||
return self.log(logging.INFO, msg, *args)
|
||||
|
||||
def warning(self, msg, *args):
|
||||
"""Warning method log."""
|
||||
return self.log(logging.WARNING, msg, *args)
|
||||
|
||||
def error(self, msg, *args):
|
||||
"""Error level log."""
|
||||
return self.log(logging.ERROR, msg, *args)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue