feat: replace loguru with logging
This commit is contained in:
parent
cced09f1ac
commit
c6940db289
34 changed files with 138 additions and 245 deletions
|
@ -1,15 +1,16 @@
|
|||
import logging
|
||||
from pathlib import Path
|
||||
from subprocess import CalledProcessError, check_output, run
|
||||
from time import sleep
|
||||
from typing import Any, Literal, Optional, Tuple
|
||||
|
||||
from loguru import logger
|
||||
|
||||
from ..models import MessageFormatKind
|
||||
from ..utils import quote
|
||||
from ..version import parse_liquidsoap_version
|
||||
from ._connection import LiquidsoapConnection
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class LiquidsoapClientError(Exception):
|
||||
"""
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import logging
|
||||
from pathlib import Path
|
||||
from socket import AF_UNIX, SOCK_STREAM, create_connection, socket
|
||||
from threading import Lock
|
||||
from typing import Optional
|
||||
|
||||
from loguru import logger
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class InvalidConnection(Exception):
|
||||
|
@ -61,7 +62,7 @@ class LiquidsoapConnection:
|
|||
self.close()
|
||||
|
||||
def connect(self):
|
||||
logger.trace("trying to acquire lock")
|
||||
logger.debug("trying to acquire lock")
|
||||
# pylint: disable=consider-using-with
|
||||
self._lock.acquire()
|
||||
logger.debug(f"connecting to {self.address()}")
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import logging
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
@ -6,14 +7,15 @@ import click
|
|||
from libretime_api_client.v2 import ApiClient
|
||||
from libretime_shared.cli import cli_config_options, cli_logging_options
|
||||
from libretime_shared.config import DEFAULT_ENV_PREFIX
|
||||
from libretime_shared.logging import level_from_name, setup_logger
|
||||
from loguru import logger
|
||||
from libretime_shared.logging import setup_logger
|
||||
|
||||
from ..config import Config
|
||||
from .entrypoint import generate_entrypoint
|
||||
from .models import Info, StreamPreferences
|
||||
from .version import get_liquidsoap_version
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
here = Path(__file__).parent
|
||||
|
||||
|
||||
|
@ -24,7 +26,7 @@ def cli(log_level: str, log_filepath: Optional[Path], config_filepath: Optional[
|
|||
"""
|
||||
Run liquidsoap.
|
||||
"""
|
||||
logger_level, _ = setup_logger(level_from_name(log_level), log_filepath)
|
||||
setup_logger(log_level, log_filepath)
|
||||
config = Config(config_filepath)
|
||||
|
||||
api_client = ApiClient(
|
||||
|
@ -53,7 +55,7 @@ def cli(log_level: str, log_filepath: Optional[Path], config_filepath: Optional[
|
|||
"--verbose",
|
||||
str(entrypoint_filepath),
|
||||
]
|
||||
if logger_level.is_debug():
|
||||
if log_level == "debug":
|
||||
exec_args.append("--debug")
|
||||
|
||||
logger.debug(f"liquidsoap {version} using script: {entrypoint_filepath}")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue