mirror of
https://github.com/Eyre-S/Coeur-Morny-Cono-python.git
synced 2024-09-27 18:56:20 +08:00
添加 poetry 工具用于依赖管理,为 log 实现添加了向文件日志输出的功能
This commit is contained in:
parent
b9b06596b6
commit
87d35c9c41
10
.gitignore
vendored
10
.gitignore
vendored
@ -1,2 +1,10 @@
|
||||
__run/
|
||||
|
||||
# project working dir
|
||||
__run__/
|
||||
|
||||
# project IDE configuration
|
||||
.vscode/*
|
||||
|
||||
# python toolchain auto-generated
|
||||
**__pycache__
|
||||
poetry.lock
|
||||
|
@ -1,6 +1,13 @@
|
||||
import os
|
||||
|
||||
|
||||
class Coeur_Def :
|
||||
'''Morny Coeur python 程序以及当前的版本的元信息'''
|
||||
|
||||
VERSION = "0.7.2.1-py0.1"
|
||||
VERSION = "0.1+coeur0.7.2.1"
|
||||
CODE = "fuzhou"
|
||||
TIMETAG = "2209261500"
|
||||
|
||||
def is_file_logging () -> bool :
|
||||
return os.getenv ("MORNY_LOGGING_TO_FILE") == "true"
|
||||
|
@ -1,9 +1,19 @@
|
||||
from datetime import datetime
|
||||
import threading
|
||||
|
||||
from define import Coeur_Def
|
||||
from .log import *
|
||||
|
||||
if Coeur_Def.is_file_logging() :
|
||||
log_file_archive = open(f"./logs/{time.strftime('%Y-%m-%d-%H:%M:%S.log', time.localtime())}", "x")
|
||||
log_file = open("./log__latest.log", "a")
|
||||
|
||||
def output (message:Log) :
|
||||
print(format_message(message))
|
||||
echo = format_message(message)
|
||||
print(echo)
|
||||
if Coeur_Def.is_file_logging() :
|
||||
log_file.write(echo+"\n")
|
||||
log_file_archive.write(echo+"\n")
|
||||
|
||||
def format_message (log:Log) -> str :
|
||||
|
||||
|
16
pyproject.toml
Normal file
16
pyproject.toml
Normal file
@ -0,0 +1,16 @@
|
||||
[tool.poetry]
|
||||
name = "morny-coeur-python"
|
||||
version = "0.1+coeur0.7.2.1"
|
||||
description = "A Coeur-Morny-Cono rewrite by python3"
|
||||
authors = ["Eyre_S <sukazyo@outlook.com>"]
|
||||
readme = "README.md"
|
||||
packages = [{include = "morny_coeur_python"}]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.10"
|
||||
python-telegram-bot = "^13.14"
|
||||
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core"]
|
||||
build-backend = "poetry.core.masonry.api"
|
Loading…
Reference in New Issue
Block a user