more AI optimizations, reworked logger
This commit is contained in:
@@ -1,27 +1,17 @@
|
||||
import os
|
||||
from datetime import datetime
|
||||
from os.path import basename
|
||||
|
||||
from docx import Document
|
||||
from docx.enum.text import WD_PARAGRAPH_ALIGNMENT
|
||||
from docx.shared import Pt, RGBColor, Cm
|
||||
from docx.oxml import OxmlElement
|
||||
from docx.oxml.ns import qn
|
||||
import os
|
||||
from os.path import basename
|
||||
from loguru import logger as log
|
||||
import sys
|
||||
from src import settings
|
||||
from docx.shared import Cm, Pt, RGBColor
|
||||
|
||||
from src import settings
|
||||
from src.shared.logging import log
|
||||
|
||||
logger = log
|
||||
logger.remove()
|
||||
logger.add("logs/application.log", rotation="1 week", retention="1 month", enqueue=True)
|
||||
log.add(
|
||||
f"logs/{datetime.now().strftime('%Y-%m-%d')}.log",
|
||||
rotation="1 day",
|
||||
compression="zip",
|
||||
)
|
||||
|
||||
# logger.add(sys.stderr, format="{time} {level} {message}", level="INFO")
|
||||
logger.add(sys.stdout)
|
||||
|
||||
font = "Cascadia Mono"
|
||||
|
||||
@@ -29,8 +19,8 @@ font = "Cascadia Mono"
|
||||
def print_document(file: str):
|
||||
# send document to printer as attachment of email
|
||||
import smtplib
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.application import MIMEApplication
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.text import MIMEText
|
||||
|
||||
smtp = settings.mail.smtp_server
|
||||
@@ -108,7 +98,7 @@ class SemesterDocument:
|
||||
self.filename = filename
|
||||
if full:
|
||||
log.info("Full document generation")
|
||||
self.cleanup
|
||||
self.cleanup()
|
||||
log.info("Cleanup done")
|
||||
self.make_document()
|
||||
log.info("Document created")
|
||||
@@ -378,4 +368,4 @@ if __name__ == "__main__":
|
||||
"Karoß (Gymnastik - Sich Bewegen mit und ohne Handgeräte)",
|
||||
"Sahrai (Kindheit und Gesellschaft)",
|
||||
]
|
||||
doc = SemapSchilder(entries)
|
||||
doc = SemapSchilder(entries)
|
||||
|
||||
Reference in New Issue
Block a user