rewritten after codex recommendations

This commit is contained in:
2026-07-18 20:27:19 +02:00
parent f9dc885937
commit 399f539b4f
22 changed files with 1448 additions and 996 deletions
+22 -15
View File
@@ -1,20 +1,27 @@
from sys import stderr
from Config import *
"""Compatibility logging facade."""
import logging
from logging.handlers import RotatingFileHandler
from Config import DEBUG, INFO, LOGFILE
_logger = logging.getLogger("flowers")
if not _logger.handlers and (DEBUG or INFO):
try:
handler = RotatingFileHandler(LOGFILE, maxBytes=1_000_000, backupCount=2)
handler.setFormatter(logging.Formatter("%(asctime)s flowers %(levelname)s %(message)s"))
_logger.addHandler(handler)
_logger.setLevel(logging.DEBUG if DEBUG else logging.INFO)
except OSError:
_logger.addHandler(logging.NullHandler())
class Log:
@staticmethod
def info(someString):
if INFO:
f = open(LOGFILE, "a")
f.write( "flower: %s \n" % someString )
f.close()
if DEBUG:
print(someString)
def info(message) -> None:
_logger.info("%s", message)
@staticmethod
def debug(someString):
if DEBUG:
f = open(LOGFILE, "a")
f.write( "flower: %s \n" % someString )
f.close()
def debug(message) -> None:
_logger.debug("%s", message)