bugfix
This commit is contained in:
parent
d0bf300975
commit
7140863800
@ -1,5 +1,6 @@
|
|||||||
import sys
|
import sys
|
||||||
import codecs
|
import codecs
|
||||||
|
from traceback import format_exc
|
||||||
from appPublic.timeUtils import timestampstr
|
from appPublic.timeUtils import timestampstr
|
||||||
from appPublic.Singleton import SingletonDecorator
|
from appPublic.Singleton import SingletonDecorator
|
||||||
import inspect
|
import inspect
|
||||||
@ -15,8 +16,9 @@ def my_function():
|
|||||||
@SingletonDecorator
|
@SingletonDecorator
|
||||||
class MyLogger:
|
class MyLogger:
|
||||||
levels={
|
levels={
|
||||||
"debug":5,
|
"client":7,
|
||||||
"info":6,
|
"info":6,
|
||||||
|
"debug":5,
|
||||||
"warning":4,
|
"warning":4,
|
||||||
"error":3,
|
"error":3,
|
||||||
"exception":2,
|
"exception":2,
|
||||||
@ -63,6 +65,11 @@ class MyLogger:
|
|||||||
self.logger.flush()
|
self.logger.flush()
|
||||||
self.close_logger()
|
self.close_logger()
|
||||||
|
|
||||||
|
def client(message):
|
||||||
|
frame_info = inspect.currentframe()
|
||||||
|
logger = MyLogger('Test')
|
||||||
|
logger.log('client', message, frame_info)
|
||||||
|
|
||||||
def info(message):
|
def info(message):
|
||||||
frame_info = inspect.currentframe()
|
frame_info = inspect.currentframe()
|
||||||
logger = MyLogger('Test')
|
logger = MyLogger('Test')
|
||||||
@ -90,6 +97,8 @@ def critical(message):
|
|||||||
|
|
||||||
def exception(message):
|
def exception(message):
|
||||||
frame_info = inspect.currentframe()
|
frame_info = inspect.currentframe()
|
||||||
|
tb_msg = format_exc()
|
||||||
|
msg = f'{message}\n{tb_msg}'
|
||||||
logger = MyLogger('exception')
|
logger = MyLogger('exception')
|
||||||
logger.log('exception', message, frame_info)
|
logger.log('exception', msg, frame_info)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user