fix : TikHub的Logger换为Loguru

This commit is contained in:
shuohigh@gmail.com 2025-06-10 11:10:24 +08:00
parent c56f87eeef
commit b3da96f1fb
2 changed files with 6 additions and 8 deletions

View File

@ -551,8 +551,6 @@ class VideoUtils:
:param output_path: 最终输出文件路径, 片段会根据指定路径附加_1.mp4 _2.mp4等片段编号
:return: 输出片段的本地路径 输出片段时长
"""
import m3u8
seek_head = media_markers[0].start.total_seconds()
seek_tail = media_markers[-1].end.total_seconds()
duration = seek_tail - seek_head
@ -561,8 +559,6 @@ class VideoUtils:
local_m3u8_path, temp_dir = await VideoUtils.convert_m3u8_to_local_source(media_path, head=seek_head,
tail=seek_tail)
logger.info(f"local_playlist: {local_m3u8_path}")
# playlist = m3u8.load(f"file://{local_m3u8_path}")
# stream_total_duration: float = sum(segment.duration for segment in playlist.segments)
stream_total_duration = duration
for segment in media_markers:

View File

@ -41,6 +41,7 @@ import datetime
from pathlib import Path
from rich.logging import RichHandler
from logging.handlers import TimedRotatingFileHandler
import loguru
class Singleton(type):
@ -151,13 +152,13 @@ def log_setup(log_to_console=True):
return logger
# 创建临时的日志目录
temp_log_dir = Path("./logs")
temp_log_dir.mkdir(exist_ok=True)
# temp_log_dir = Path("./logs")
# temp_log_dir.mkdir(exist_ok=True)
# 初始化日志管理器
log_manager = LogManager()
log_manager.setup_logging(
level=logging.INFO, log_to_console=log_to_console, log_path=temp_log_dir
level=logging.INFO, log_to_console=log_to_console, log_path=None
)
# 只保留1000个日志文件
@ -166,4 +167,5 @@ def log_setup(log_to_console=True):
return logger
logger = log_setup()
# logger = log_setup()
logger = loguru.logger