mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-08-24 08:21:34 +00:00
Get the logger from a central place
This commit is contained in:
parent
7e141724c1
commit
795dfd38df
55 changed files with 157 additions and 167 deletions
19
jellyfin_kodi/helper/lazylogger.py
Normal file
19
jellyfin_kodi/helper/lazylogger.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import division, absolute_import, print_function, unicode_literals
|
||||
|
||||
|
||||
class LazyLogger(object):
|
||||
"""`helper.loghandler.getLogger()` is used everywhere.
|
||||
This class helps avoiding import errors.
|
||||
"""
|
||||
__logger = None
|
||||
__logger_name = None
|
||||
|
||||
def __init__(self, logger_name=None):
|
||||
self.__logger_name = logger_name
|
||||
|
||||
def __getattr__(self, name):
|
||||
if self.__logger is None:
|
||||
from helper.loghandler import getLogger
|
||||
self.__logger = getLogger(self.__logger_name)
|
||||
return getattr(self.__logger, name)
|
Loading…
Add table
Add a link
Reference in a new issue