Skip to content

Commit

Permalink
Merge pull request #3000: Refactor logging
Browse files Browse the repository at this point in the history
Refactor logging
  • Loading branch information
ssbarnea authored Dec 3, 2020
2 parents 9017c61 + c200b9e commit d457481
Show file tree
Hide file tree
Showing 44 changed files with 173 additions and 128 deletions.
4 changes: 2 additions & 2 deletions src/molecule/api.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
"""Molecule API Module."""

import logging
import traceback
from collections import UserList

import pluggy

from molecule import logger
from molecule.driver.base import Driver # noqa
from molecule.util import lru_cache
from molecule.verifier.base import Verifier # noqa

LOG = logger.get_logger(__name__)
LOG = logging.getLogger(__name__)


class UserListMap(UserList):
Expand Down
3 changes: 2 additions & 1 deletion src/molecule/command/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import abc
import collections
import glob
import logging
import os
import shutil
from typing import Any, Callable
Expand All @@ -33,7 +34,7 @@
from molecule import config, logger, text, util
from molecule.console import should_do_markup

LOG = logger.get_logger(__name__)
LOG = logging.getLogger(__name__)
MOLECULE_GLOB = os.environ.get("MOLECULE_GLOB", "molecule/*/molecule.yml")
MOLECULE_DEFAULT_SCENARIO_NAME = "default"

Expand Down
5 changes: 3 additions & 2 deletions src/molecule/command/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
# DEALINGS IN THE SOFTWARE.
"""Check Command Module."""

import logging
import os

import click

from molecule import logger, util
from molecule import util
from molecule.command import base

LOG = logger.get_logger(__name__)
LOG = logging.getLogger(__name__)
MOLECULE_PARALLEL = os.environ.get("MOLECULE_PARALLEL", False)


Expand Down
5 changes: 3 additions & 2 deletions src/molecule/command/cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
# DEALINGS IN THE SOFTWARE.
"""Cleanup Command Module."""

import logging

import click

from molecule import logger
from molecule.command import base

LOG = logger.get_logger(__name__)
LOG = logging.getLogger(__name__)


class Cleanup(base.Base):
Expand Down
5 changes: 3 additions & 2 deletions src/molecule/command/converge.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
# DEALINGS IN THE SOFTWARE.
"""Converge Command Module."""

import logging

import click

from molecule import logger
from molecule.command import base

LOG = logger.get_logger(__name__)
LOG = logging.getLogger(__name__)


class Converge(base.Base):
Expand Down
5 changes: 3 additions & 2 deletions src/molecule/command/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
# DEALINGS IN THE SOFTWARE.
"""Create Command Module."""

import logging

import click

from molecule import logger
from molecule.api import drivers
from molecule.command import base
from molecule.config import DEFAULT_DRIVER

LOG = logger.get_logger(__name__)
LOG = logging.getLogger(__name__)


class Create(base.Base):
Expand Down
5 changes: 3 additions & 2 deletions src/molecule/command/dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
# DEALINGS IN THE SOFTWARE.
"""Dependency Command Module."""

import logging

import click

from molecule import logger
from molecule.command import base

LOG = logger.get_logger(__name__)
LOG = logging.getLogger(__name__)


class Dependency(base.Base):
Expand Down
5 changes: 3 additions & 2 deletions src/molecule/command/destroy.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@
# DEALINGS IN THE SOFTWARE.
"""Destroy Command Module."""

import logging
import os

import click

from molecule import logger, util
from molecule import util
from molecule.api import drivers
from molecule.command import base
from molecule.config import DEFAULT_DRIVER

LOG = logger.get_logger(__name__)
LOG = logging.getLogger(__name__)
MOLECULE_PARALLEL = os.environ.get("MOLECULE_PARALLEL", False)


Expand Down
6 changes: 4 additions & 2 deletions src/molecule/command/drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@

from __future__ import print_function

import logging

import click
from rich import box
from rich.table import Table

from molecule import api, logger
from molecule import api
from molecule.command import base
from molecule.console import console

LOG = logger.get_logger(__name__)
LOG = logging.getLogger(__name__)


@base.click_command_ex()
Expand Down
5 changes: 3 additions & 2 deletions src/molecule/command/idempotence.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@
# DEALINGS IN THE SOFTWARE.
"""Idempotence Command Module."""

import logging
import re

import click

from molecule import logger, util
from molecule import util
from molecule.command import base
from molecule.text import strip_ansi_escape

LOG = logger.get_logger(__name__)
LOG = logging.getLogger(__name__)


class Idempotence(base.Base):
Expand Down
5 changes: 3 additions & 2 deletions src/molecule/command/init/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
"""Base class used by init command."""

import abc
import logging
import os

import cookiecutter
import cookiecutter.main

from molecule import logger, util
from molecule import util

LOG = logger.get_logger(__name__)
LOG = logging.getLogger(__name__)


class Base(object):
Expand Down
5 changes: 3 additions & 2 deletions src/molecule/command/init/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
# DEALINGS IN THE SOFTWARE.
"""Base class used by init command."""

from molecule import logger
import logging

from molecule.command import base
from molecule.command.init import role, scenario

LOG = logger.get_logger(__name__)
LOG = logging.getLogger(__name__)


@base.click_group_ex() # type: ignore
Expand Down
5 changes: 3 additions & 2 deletions src/molecule/command/init/role.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@
# DEALINGS IN THE SOFTWARE.
"""Base class used by init role command."""

import logging
import os

import click

from molecule import api, logger, util
from molecule import api, util
from molecule.command import base as command_base
from molecule.command.init import base
from molecule.config import DEFAULT_DRIVER

LOG = logger.get_logger(__name__)
LOG = logging.getLogger(__name__)


class Role(base.Base):
Expand Down
5 changes: 3 additions & 2 deletions src/molecule/command/init/scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@
# DEALINGS IN THE SOFTWARE.
"""Base class used by init scenario command."""

import logging
import os
from typing import Dict

import click

from molecule import api, config, logger, util
from molecule import api, config, util
from molecule.command import base as command_base
from molecule.command.init import base
from molecule.config import DEFAULT_DRIVER

LOG = logger.get_logger(__name__)
LOG = logging.getLogger(__name__)


class Scenario(base.Base):
Expand Down
5 changes: 3 additions & 2 deletions src/molecule/command/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
# DEALINGS IN THE SOFTWARE.
"""Lint Command Module."""

import logging
import os

import click

from molecule import logger, util
from molecule import util
from molecule.command import base

LOG = logger.get_logger(__name__)
LOG = logging.getLogger(__name__)


class Lint(base.Base):
Expand Down
6 changes: 4 additions & 2 deletions src/molecule/command/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,19 @@

from __future__ import print_function

import logging

import click
from rich import box
from rich.syntax import Syntax
from rich.table import Table

from molecule import logger, scenarios, text, util
from molecule import scenarios, text, util
from molecule.command import base
from molecule.console import console
from molecule.status import Status

LOG = logger.get_logger(__name__)
LOG = logging.getLogger(__name__)


class List(base.Base):
Expand Down
5 changes: 3 additions & 2 deletions src/molecule/command/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@
# DEALINGS IN THE SOFTWARE.
"""Login Command Module."""

import logging
import os
from subprocess import run

import click

from molecule import logger, scenarios, util
from molecule import scenarios, util
from molecule.command import base

LOG = logger.get_logger(__name__)
LOG = logging.getLogger(__name__)


class Login(base.Base):
Expand Down
6 changes: 4 additions & 2 deletions src/molecule/command/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
# DEALINGS IN THE SOFTWARE.
"""Matrix Command Module."""

import logging

import click

from molecule import logger, scenarios
from molecule import scenarios
from molecule.command import base

LOG = logger.get_logger(__name__)
LOG = logging.getLogger(__name__)


class Matrix(base.Base):
Expand Down
5 changes: 3 additions & 2 deletions src/molecule/command/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
# DEALINGS IN THE SOFTWARE.
"""Prepare Command Module."""

import logging

import click

from molecule import logger
from molecule.api import drivers
from molecule.command import base
from molecule.config import DEFAULT_DRIVER

LOG = logger.get_logger(__name__)
LOG = logging.getLogger(__name__)


class Prepare(base.Base):
Expand Down
5 changes: 3 additions & 2 deletions src/molecule/command/reset.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
# DEALINGS IN THE SOFTWARE.
"""Lint Command Module."""

import logging

import click

from molecule import logger
from molecule.api import drivers
from molecule.command import base

LOG = logger.get_logger(__name__)
LOG = logging.getLogger(__name__)


@base.click_command_ex()
Expand Down
5 changes: 3 additions & 2 deletions src/molecule/command/side_effect.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
# DEALINGS IN THE SOFTWARE.
"""Side-effect Command Module."""

import logging

import click

from molecule import logger
from molecule.command import base

LOG = logger.get_logger(__name__)
LOG = logging.getLogger(__name__)


class SideEffect(base.Base):
Expand Down
5 changes: 3 additions & 2 deletions src/molecule/command/syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
# DEALINGS IN THE SOFTWARE.
"""Syntax Command Module."""

import logging

import click

from molecule import logger
from molecule.command import base

LOG = logger.get_logger(__name__)
LOG = logging.getLogger(__name__)


class Syntax(base.Base):
Expand Down
Loading

0 comments on commit d457481

Please sign in to comment.