diff options
author | foxfire52 <foxfire52@virgilio.it> | 2024-11-15 07:38:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-15 07:38:51 +0100 |
commit | f38428ab23a1ec1f6ee22b976189d7e9da9b9167 (patch) | |
tree | d1f0ab8b2f849a8162e2a1430910d0b41d300de5 /g4f/api/_logging.py | |
parent | Merge pull request #2331 from NoelisTired/main (diff) | |
download | gpt4free-f38428ab23a1ec1f6ee22b976189d7e9da9b9167.tar gpt4free-f38428ab23a1ec1f6ee22b976189d7e9da9b9167.tar.gz gpt4free-f38428ab23a1ec1f6ee22b976189d7e9da9b9167.tar.bz2 gpt4free-f38428ab23a1ec1f6ee22b976189d7e9da9b9167.tar.lz gpt4free-f38428ab23a1ec1f6ee22b976189d7e9da9b9167.tar.xz gpt4free-f38428ab23a1ec1f6ee22b976189d7e9da9b9167.tar.zst gpt4free-f38428ab23a1ec1f6ee22b976189d7e9da9b9167.zip |
Diffstat (limited to '')
-rw-r--r-- | g4f/api/_logging.py | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/g4f/api/_logging.py b/g4f/api/_logging.py index e91dff76..884d7529 100644 --- a/g4f/api/_logging.py +++ b/g4f/api/_logging.py @@ -1,6 +1,6 @@ import sys,logging -from loguru import logger +#from loguru import logger def __exception_handle(e_type, e_value, e_traceback): if issubclass(e_type, KeyboardInterrupt): @@ -9,24 +9,24 @@ def __exception_handle(e_type, e_value, e_traceback): sys.__excepthook__(e_type, e_value, e_traceback) -class __InterceptHandler(logging.Handler): - def emit(self, record): - try: - level = logger.level(record.levelname).name - except ValueError: - level = record.levelno - - frame, depth = logging.currentframe(), 2 - while frame.f_code.co_filename == logging.__file__: - frame = frame.f_back - depth += 1 - - logger.opt(depth=depth, exception=record.exc_info).log( - level, record.getMessage() - ) +#class __InterceptHandler(logging.Handler): +# def emit(self, record): +# try: +# level = logger.level(record.levelname).name +# except ValueError: +# level = record.levelno +# +# frame, depth = logging.currentframe(), 2 +# while frame.f_code.co_filename == logging.__file__: +# frame = frame.f_back +# depth += 1 + +# logger.opt(depth=depth, exception=record.exc_info).log( +# level, record.getMessage() +# ) def hook_except_handle(): sys.excepthook = __exception_handle -def hook_logging(**kwargs): - logging.basicConfig(handlers=[__InterceptHandler()], **kwargs) +#def hook_logging(**kwargs): +# logging.basicConfig(handlers=[__InterceptHandler()], **kwargs) |