diff --git a/irclog.py b/irclog.py index 312c93d..8913956 100644 --- a/irclog.py +++ b/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.