Print time
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import datetime
|
||||
from .project import *
|
||||
from .database import ChangeSet, write, try_read
|
||||
from .sections import *
|
||||
@@ -124,7 +125,14 @@ def _get_offset(inp: str) -> dict[str, list[int]]:
|
||||
return offset
|
||||
|
||||
|
||||
def print_time(desc: str) -> None:
|
||||
time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
print(f"{time}: {desc}")
|
||||
|
||||
|
||||
def parse_file(project: str, inp: str) -> None:
|
||||
print_time(f"start reading {inp}...")
|
||||
|
||||
offset = _get_offset(inp)
|
||||
|
||||
levels = _level_1 + _level_2 + _level_3 + _level_4
|
||||
@@ -144,6 +152,8 @@ def parse_file(project: str, inp: str) -> None:
|
||||
if s not in offset:
|
||||
continue
|
||||
|
||||
print_time(f"[{s}]")
|
||||
|
||||
is_s = _handler[s][0] == _S
|
||||
handler = _handler[s][1]
|
||||
|
||||
@@ -199,6 +209,8 @@ def parse_file(project: str, inp: str) -> None:
|
||||
if is_s:
|
||||
handler(project, sections[s])
|
||||
|
||||
print_time(f"end reading {inp}")
|
||||
|
||||
|
||||
def parse_inp(project: str, inp: str) -> None:
|
||||
parse_file(project, inp)
|
||||
|
||||
Reference in New Issue
Block a user