Skip to content

Commit

Permalink
Cleaning up dup code
Browse files Browse the repository at this point in the history
  • Loading branch information
IanWoodard committed Nov 11, 2024
1 parent 129a645 commit 8f584c1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
6 changes: 0 additions & 6 deletions devservices/commands/start.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
from __future__ import annotations

import logging
from argparse import _SubParsersAction
from argparse import ArgumentParser
from argparse import Namespace

from devservices.constants import LOGGER_NAME
from devservices.exceptions import DependencyError
from devservices.exceptions import DockerComposeError
from devservices.utils.console import Console
Expand Down Expand Up @@ -45,10 +43,6 @@ def start(args: Namespace) -> None:
mode_to_start = "default"
mode_dependencies = modes[mode_to_start]

if args.debug:
logger = logging.getLogger(LOGGER_NAME)
logger.setLevel(logging.DEBUG)

with Status(
lambda: console.warning(f"Starting {service.name}"),
lambda: console.success(f"{service.name} started"),
Expand Down
6 changes: 0 additions & 6 deletions devservices/commands/stop.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
from __future__ import annotations

import logging
from argparse import _SubParsersAction
from argparse import ArgumentParser
from argparse import Namespace

from devservices.constants import LOGGER_NAME
from devservices.exceptions import DependencyError
from devservices.exceptions import DockerComposeError
from devservices.utils.console import Console
Expand Down Expand Up @@ -46,10 +44,6 @@ def stop(args: Namespace) -> None:
mode_to_stop = "default"
mode_dependencies = modes[mode_to_stop]

if args.debug:
logger = logging.getLogger(LOGGER_NAME)
logger.setLevel(logging.DEBUG)

state = State()
started_services = state.get_started_services()
if service.name not in started_services:
Expand Down
6 changes: 6 additions & 0 deletions devservices/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from devservices.commands import stop
from devservices.commands import update
from devservices.commands.check_for_update import check_for_update
from devservices.constants import LOGGER_NAME
from devservices.exceptions import DockerComposeInstallationError
from devservices.exceptions import DockerDaemonNotRunningError
from devservices.utils.console import Console
Expand Down Expand Up @@ -79,6 +80,11 @@ def main() -> None:

args = parser.parse_args()

# If the command has a debug flag, set the logger to debug
if args.debug:
logger = logging.getLogger(LOGGER_NAME)
logger.setLevel(logging.DEBUG)

if args.command:
# Call the appropriate function based on the command
with sentry_sdk.start_transaction(op="command", name=args.command):
Expand Down

0 comments on commit 8f584c1

Please sign in to comment.