forked from DRMTalks/devine
Replace logging handler with ComfyRichHandler
This changes all logs via logging to be printed to the rich console instead. Specifically, using my custom ComfyRichHandler making the logs padded horizontally. In this change the time is no longer printed. The log level is still printed but it's now the full log name in bold.
This commit is contained in:
parent
8d626822cb
commit
f1864ad63c
|
@ -10,7 +10,7 @@ from urllib3.exceptions import InsecureRequestWarning
|
||||||
from devine.core import __version__
|
from devine.core import __version__
|
||||||
from devine.core.commands import Commands
|
from devine.core.commands import Commands
|
||||||
from devine.core.config import config
|
from devine.core.config import config
|
||||||
from devine.core.console import console
|
from devine.core.console import ComfyRichHandler, console
|
||||||
from devine.core.constants import context_settings
|
from devine.core.constants import context_settings
|
||||||
from devine.core.utilities import rotate_log_file
|
from devine.core.utilities import rotate_log_file
|
||||||
|
|
||||||
|
@ -24,7 +24,18 @@ LOGGING_PATH = None
|
||||||
help="Log path (or filename). Path can contain the following f-string args: {name} {time}.")
|
help="Log path (or filename). Path can contain the following f-string args: {name} {time}.")
|
||||||
def main(version: bool, debug: bool, log_path: Path) -> None:
|
def main(version: bool, debug: bool, log_path: Path) -> None:
|
||||||
"""Devine—Open-Source Movie, TV, and Music Downloading Solution."""
|
"""Devine—Open-Source Movie, TV, and Music Downloading Solution."""
|
||||||
logging.basicConfig(level=logging.DEBUG if debug else logging.INFO)
|
logging.basicConfig(
|
||||||
|
level=logging.DEBUG if debug else logging.INFO,
|
||||||
|
format="%(message)s",
|
||||||
|
handlers=[ComfyRichHandler(
|
||||||
|
show_time=False,
|
||||||
|
show_path=debug,
|
||||||
|
console=console,
|
||||||
|
rich_tracebacks=True,
|
||||||
|
tracebacks_suppress=[click],
|
||||||
|
log_renderer=console._log_render # noqa
|
||||||
|
)]
|
||||||
|
)
|
||||||
log = logging.getLogger()
|
log = logging.getLogger()
|
||||||
|
|
||||||
if log_path:
|
if log_path:
|
||||||
|
|
Loading…
Reference in New Issue