mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-11 17:17:26 +01:00
better sanity checker that logs messages in the log files and does not fail on warnings.
This commit is contained in:
parent
df6c59bc4f
commit
98b147b622
7 changed files with 212 additions and 122 deletions
|
|
@ -1,8 +1,5 @@
|
|||
import logging
|
||||
from django.core.management.base import BaseCommand
|
||||
from documents.sanity_checker import check_sanity, SanityError, SanityWarning
|
||||
|
||||
logger = logging.getLogger("paperless.management.sanity_checker")
|
||||
from documents.sanity_checker import check_sanity
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
|
@ -15,13 +12,4 @@ class Command(BaseCommand):
|
|||
|
||||
messages = check_sanity(progress=True)
|
||||
|
||||
if len(messages) == 0:
|
||||
logger.info("No issues found.")
|
||||
else:
|
||||
for msg in messages:
|
||||
if type(msg) == SanityError:
|
||||
logger.error(str(msg))
|
||||
elif type(msg) == SanityWarning:
|
||||
logger.warning(str(msg))
|
||||
else:
|
||||
logger.info((str(msg)))
|
||||
messages.log_messages()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue