mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-11-20 20:46:53 +00:00
Improves the logging mixin and allows it to be typed better
This commit is contained in:
1 parent
37959fe31c
commit
452c79f9a1
9 files changed
+99
-128
No files matched your search
@@ -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