瀏覽代碼

Add more debug logging on Storage file handling

master
JustAnotherArchivist 3 年之前
父節點
當前提交
60aa9bb0f3
共有 1 個檔案被更改,包括 5 行新增1 行删除
  1. +5
    -1
      irclog.py

+ 5
- 1
irclog.py 查看文件

@@ -640,6 +640,7 @@ class Storage:

for channel in channelsRemoved:
if channel in self.files:
self.logger.debug(f'Closing file for {channel!r}')
self.files[channel][1].close()
del self.files[channel]

@@ -648,11 +649,14 @@ class Storage:
if channel in self.files and fn == self.files[channel][0]:
return
if channel in self.files:
self.logger.debug(f'Closing file for {channel!r}')
self.files[channel][1].close()
dn = self.paths[channel] if channel is not None else 'general'
mode = 'a' if channel is not None else 'ab'
fpath = os.path.join(self.config['storage']['path'], dn, fn)
self.logger.debug(f'Opening file {fpath!r} for {channel!r} with mode {mode!r}')
os.makedirs(os.path.join(self.config['storage']['path'], dn), exist_ok = True)
self.files[channel] = (fn, open(os.path.join(self.config['storage']['path'], dn, fn), mode))
self.files[channel] = (fn, open(fpath, mode))

async def run(self, loop, sigintEvent):
self.update_config(self.config) # Ensure that files are open etc.


Loading…
取消
儲存