Remove unused imports and refactor logging

This commit is contained in:
Luke Murphy 2020-10-30 22:59:40 +01:00
parent f03b038ee3
commit e30aae2794
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
5 changed files with 7 additions and 14 deletions

View File

@ -1,6 +1,3 @@
from logging import basicConfig, getLogger
from os import environ
from trio import open_nursery, sleep_forever from trio import open_nursery, sleep_forever
from trio_gtk import run from trio_gtk import run
@ -15,7 +12,3 @@ def main():
await sleep_forever() await sleep_forever()
run(_main) run(_main)
basicConfig(level=environ.get("LOGLEVEL", "INFO"))
log = getLogger("dropship")

View File

@ -1,10 +1,7 @@
from os.path import basename
from pathlib import Path
from gi import require_version from gi import require_version
from trio import CancelScope, open_process, run_process from trio import CancelScope, open_process, run_process
from dropship import log from dropship.logging import log
require_version("Gtk", "3.0") require_version("Gtk", "3.0")
require_version("Gdk", "3.0") require_version("Gdk", "3.0")

5
dropship/logging.py Normal file
View File

@ -0,0 +1,5 @@
from logging import basicConfig, getLogger
from os import environ
basicConfig(level=environ.get("LOGLEVEL", "INFO"))
log = getLogger("dropship")

View File

@ -1,5 +1,3 @@
from pathlib import Path
import gi import gi
gi.require_version("Gtk", "3.0") gi.require_version("Gtk", "3.0")

View File

@ -2,7 +2,7 @@ from subprocess import PIPE
from trio import TASK_STATUS_IGNORED, CancelScope, open_process, run_process from trio import TASK_STATUS_IGNORED, CancelScope, open_process, run_process
from dropship import log from dropship.logging import log
async def wormhole_send(fpath, parent, task_status=TASK_STATUS_IGNORED): async def wormhole_send(fpath, parent, task_status=TASK_STATUS_IGNORED):