general: enhancle logging for various modules
This commit is contained in:
parent
ea195e3d17
commit
f28f68b14b
5 changed files with 36 additions and 23 deletions
|
@ -75,14 +75,16 @@ class Message(_BaseMessage):
|
|||
|
||||
Entity = Union[Sender, Thread, _Message]
|
||||
def _entities() -> Iterator[Res[Entity]]:
|
||||
dbs = inputs()
|
||||
for i, f in enumerate(dbs):
|
||||
logger.debug(f'processing {f} {i}/{len(dbs)}')
|
||||
with sqlite_connection(f, immutable=True, row_factory='row') as db:
|
||||
paths = inputs()
|
||||
total = len(paths)
|
||||
width = len(str(total))
|
||||
for idx, path in enumerate(paths):
|
||||
logger.info(f'processing [{idx:>{width}}/{total:>{width}}] {path}')
|
||||
with sqlite_connection(path, immutable=True, row_factory='row') as db:
|
||||
try:
|
||||
yield from _process_db(db)
|
||||
except Exception as e:
|
||||
yield echain(RuntimeError(f'While processing {f}'), cause=e)
|
||||
yield echain(RuntimeError(f'While processing {path}'), cause=e)
|
||||
|
||||
|
||||
def _normalise_user_id(ukey: str) -> str:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue