删除冗余引用
This commit is contained in:
parent
4f2c8cf4da
commit
b47ffc705e
7
main.py
7
main.py
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import pygame as pg
|
|
||||||
import logging
|
import logging
|
||||||
import traceback
|
import traceback
|
||||||
import os
|
import os
|
||||||
@ -8,12 +7,12 @@ from source import tool
|
|||||||
from source import constants as c
|
from source import constants as c
|
||||||
from source.state import mainmenu, screen, level
|
from source.state import mainmenu, screen, level
|
||||||
|
|
||||||
if __name__=='__main__':
|
if __name__=="__main__":
|
||||||
# 日志设置
|
# 日志设置
|
||||||
if not os.path.exists(os.path.dirname(c.USERLOG_PATH)):
|
if not os.path.exists(os.path.dirname(c.USERLOG_PATH)):
|
||||||
os.makedirs(os.path.dirname(c.USERLOG_PATH))
|
os.makedirs(os.path.dirname(c.USERLOG_PATH))
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
formatter = logging.Formatter('%(asctime)s: %(message)s')
|
formatter = logging.Formatter("%(asctime)s: %(message)s")
|
||||||
file_handler = RotatingFileHandler(c.USERLOG_PATH, "a", 1024*1024, 0, "utf-8")
|
file_handler = RotatingFileHandler(c.USERLOG_PATH, "a", 1024*1024, 0, "utf-8")
|
||||||
file_handler.setFormatter(formatter)
|
file_handler.setFormatter(formatter)
|
||||||
stream_handler = logging.StreamHandler()
|
stream_handler = logging.StreamHandler()
|
||||||
@ -33,4 +32,4 @@ if __name__=='__main__':
|
|||||||
game.run()
|
game.run()
|
||||||
except:
|
except:
|
||||||
print() # 将日志输出与上文内容分隔开,增加可读性
|
print() # 将日志输出与上文内容分隔开,增加可读性
|
||||||
logger.error(f'\n{traceback.format_exc()}')
|
logger.error(f"\n{traceback.format_exc()}")
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
import random
|
import random
|
||||||
import pygame as pg
|
|
||||||
from .. import tool
|
|
||||||
from .. import constants as c
|
from .. import constants as c
|
||||||
|
|
||||||
class Map():
|
class Map():
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import pygame as pg
|
|||||||
import os
|
import os
|
||||||
from .. import tool
|
from .. import tool
|
||||||
from .. import constants as c
|
from .. import constants as c
|
||||||
from . import level
|
|
||||||
|
|
||||||
class Menu(tool.State):
|
class Menu(tool.State):
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user