[Mod]Close #540,实现LogEngine的单例模式
This commit is contained in:
parent
2406d4a586
commit
84e6eb277f
@ -518,6 +518,16 @@ class LogEngine(object):
|
||||
LEVEL_WARN = logging.WARN
|
||||
LEVEL_ERROR = logging.ERROR
|
||||
LEVEL_CRITICAL = logging.CRITICAL
|
||||
|
||||
# 单例对象
|
||||
instance = None
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def __new__(cls, *args, **kwargs):
|
||||
"""创建对象,保证单例"""
|
||||
if not cls.instance:
|
||||
cls.instance = super(LogEngine, cls).__new__(cls, *args, **kwargs)
|
||||
return cls.instance
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def __init__(self):
|
||||
|
Loading…
Reference in New Issue
Block a user