Skip to content

Commit

Permalink
🔊 Improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Kajiih committed Dec 18, 2024
1 parent c6eb9ed commit f9389c9
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 78 deletions.
2 changes: 1 addition & 1 deletion dev/bundling/scripts/pyinstaller_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"settings.toml",
]

setup_logging(file_name="build")
setup_logging(prefix="build")


def build_executable(build_mode: Literal["onedir", "onefile"], windowed: bool) -> None:
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ classifiers = [ # https://pypi.org/classifiers/
dependencies = [
"bs4>=0.0.2",
"cyclopts>=2.9.9",
"frosch<=0.1.5", # 0.1.6

"frosch<=0.1.5", # 0.1.6
"kajihs-utils[loguru]>=0.2.0",
"loguru>=0.7.2",
"musicbrainzngs>=0.7.1",
Expand Down
2 changes: 1 addition & 1 deletion src/musicbrainz2notion/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
PROJECT_ROOT = Path(__file__).resolve().parent.parent.parent

__app_name__ = "musicbrainz2notion"
__version__ = "0.4.3"
__version__ = "0.4.4"
__author__ = "Kajih"
__author_email__ = "[email protected]"
__repo_url__ = "https://github.com/Kajiih/musicbrainz2notion"
Expand Down
9 changes: 4 additions & 5 deletions src/musicbrainz2notion/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
)
from musicbrainz2notion.musicbrainz_utils import EntityType, MBDataDict
from musicbrainz2notion.notion_utils import (
OBJECT_ID_LENGTH,
extract_id_from_url,
find_databases_with_properties,
format_checkbox,
Expand All @@ -65,9 +66,7 @@

frosch.hook() # enable frosch for easier debugging

ID_LENGTH = 32

setup_logging()
setup_logging(log_dir=PROJECT_ROOT / "logs")

loaded_settings = ts.load(
Settings,
Expand Down Expand Up @@ -131,15 +130,15 @@ def main(
main_page_id = prompt("Main page ID or link")
main_page_id = (
extract_id_from_url(url=main_page_id, link_1_or_2=1)
if len(main_page_id) > ID_LENGTH
if len(main_page_id) > OBJECT_ID_LENGTH
else main_page_id
)
while not is_valid_page_id(client=notion_client, page_id=main_page_id):
logger.warning("Invalid main page ID or url")
main_page_id = prompt("Main page ID or link")
main_page_id = (
extract_id_from_url(url=main_page_id, link_1_or_2=1)
if len(main_page_id) > ID_LENGTH
if len(main_page_id) > OBJECT_ID_LENGTH
else main_page_id
)
logger.success("Page ID: OK")
Expand Down
2 changes: 2 additions & 0 deletions src/musicbrainz2notion/notion_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
if TYPE_CHECKING:
from collections.abc import Iterable, Sequence


OBJECT_ID_LENGTH = 32
# === Types === #
type PageId = str
type DatabaseId = PageId
Expand Down
Loading

0 comments on commit f9389c9

Please sign in to comment.