# -*-coding:utf-8 -*- #
# ---------------------------------------------------------------------------
# ProjectName:   test
# FileName:      __init__.py
# Author:       mwx
# Datetime:     2024/11/5 18:31
# Description:
# 
# ---------------------------------------------------------------------------
import logging
import os
import time
from math import lgamma


def api_log():
    logger = logging.getLogger()
    logger.level = logging.INFO
    log_dir_path = os.path.join(os.path.join(os.path.dirname(__file__),"report"),"log")
    log_file_name = time.strftime("%Y-%m-%d-%H-%M-%S",time.localtime()) + ".log"
    log_path =os.path.join(log_dir_path,log_file_name)
    handler = logging.FileHandler(filename=log_path, mode="a", encoding="utf-8")
    formatter = logging.Formatter('%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s')
    handler.setFormatter(formatter)
    logger.addHandler(handler)
    return logger

log = api_log()
