Browse Source

Add more debug logging on Storage file handling

master
JustAnotherArchivist 3 years ago
parent
commit
60aa9bb0f3
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      irclog.py

+ 5
- 1
irclog.py View File

@@ -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…
Cancel
Save