add debug

This commit is contained in:
Antonio J. Delgado 2025-02-05 11:26:13 +02:00
parent 6daa19c5e9
commit 1bfefc256a

View file

@ -170,6 +170,11 @@ class ImapFilter:
file_path = Path(self.config['sieve_scripts_path'])
owner = file_path.owner()
group = file_path.group()
self._log.debug(
"Detected owner '%s' and group '%s'",
owner,
group
)
with open(self.config['sieve_scripts_path'], 'r', encoding='UTF-8') as sieve_script:
content = sieve_script.read()
else:
@ -181,7 +186,7 @@ class ImapFilter:
content += 'require ["fileinto"];'
for mfilter in filters:
self._log.debug(
'Adding filter %s to sieve script',
'Adding filter '%s' to sieve script',
mfilter['name']
)
if 'field' in mfilter:
@ -213,6 +218,11 @@ class ImapFilter:
search
)
content += f"{replacement}\n"
self._log.debug(
"Writting sieve script '%s' with %s bytes",
self.config['sieve_scripts_path'],
len(content)
)
with open(self.config['sieve_scripts_path'], 'w', encoding='UTF-8') as sieve_script:
sieve_script.write(content)
if os.geteuid() == 0: