mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-14 00:26:21 +00:00
Improves the logging mixin and allows it to be typed better
This commit is contained in:
@@ -328,7 +328,7 @@ class DocumentParser(LoggingMixin):
|
||||
try:
|
||||
text = filepath.read_text(encoding="utf-8")
|
||||
except UnicodeDecodeError as e:
|
||||
self.log("warning", f"Unicode error during text reading, continuing: {e}")
|
||||
self.log.warning(f"Unicode error during text reading, continuing: {e}")
|
||||
text = filepath.read_bytes().decode("utf-8", errors="replace")
|
||||
return text
|
||||
|
||||
@@ -354,5 +354,5 @@ class DocumentParser(LoggingMixin):
|
||||
return self.date
|
||||
|
||||
def cleanup(self):
|
||||
self.log("debug", f"Deleting directory {self.tempdir}")
|
||||
self.log.debug(f"Deleting directory {self.tempdir}")
|
||||
shutil.rmtree(self.tempdir)
|
||||
|
Reference in New Issue
Block a user