main,database: add debug log stanzas
All checks were successful
ci/woodpecker/push/workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/workflow Pipeline was successful
closes: #7
This commit is contained in:
parent
d8101d7c55
commit
e5bb663ee8
2 changed files with 7 additions and 0 deletions
|
|
@ -1,5 +1,8 @@
|
|||
import os
|
||||
from sqlmodel import SQLModel, create_engine
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
sqlite_url = os.environ.get("DATABASE_URL", "sqlite:///database.db")
|
||||
|
|
@ -8,3 +11,4 @@ engine = create_engine(sqlite_url, echo=False)
|
|||
|
||||
def create_db_and_tables(engine):
|
||||
SQLModel.metadata.create_all(engine)
|
||||
logger.debug("Created tables, if not already present")
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ from textual.widgets import Button, DataTable, Footer, Header, Input, Static
|
|||
from .database import create_db_and_tables, engine
|
||||
from .models import add_to_database, load_initial_data, make_teilchen_input
|
||||
|
||||
# Make it so that log messages go to Textual; we should be able to then see
|
||||
# these in the console
|
||||
logging.basicConfig(
|
||||
level="NOTSET",
|
||||
handlers=[TextualHandler()],
|
||||
|
|
@ -64,6 +66,7 @@ class SearchBar(Static):
|
|||
async def parse_input(self, event: Input.Submitted) -> None:
|
||||
|
||||
if not (tc := await make_teilchen_input(event.value)):
|
||||
logger.debug("could not create TeilchenCreate from data: %s", event.value)
|
||||
return
|
||||
|
||||
event.input.value = ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue