1
0
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:
A.C.Sukazyo Eyre 2022-09-27 22:44:40 +08:00
parent b9b06596b6
commit 87d35c9c41
Signed by: Eyre_S
GPG Key ID: C17CE40291207874
4 changed files with 44 additions and 3 deletions

10
.gitignore vendored
View File

@ -1,2 +1,10 @@
__run/
# project working dir
__run__/
# project IDE configuration
.vscode/*
# python toolchain auto-generated
**__pycache__
poetry.lock

View File

@ -1,6 +1,13 @@
class Coeur_Def :
import os
VERSION = "0.7.2.1-py0.1"
class Coeur_Def :
'''Morny Coeur python 程序以及当前的版本的元信息'''
VERSION = "0.1+coeur0.7.2.1"
CODE = "fuzhou"
TIMETAG = "2209261500"
def is_file_logging () -> bool :
return os.getenv ("MORNY_LOGGING_TO_FILE") == "true"

View File

@ -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
View 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"