Skip to content

Commit

Permalink
Update logger initialization to use module-specific loggers #140
Browse files Browse the repository at this point in the history
Changed "logger = logging.getLogger()" line of code to "logger = logging.getLogger(__name__)" in all files

Removed the TODO Comments - "# TODO: At least add __name__ as the name for the logger" in all files
#140
  • Loading branch information
AkashS0510 authored and samriddhi99 committed Jul 29, 2024
1 parent cf6416f commit dc658cf
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/tirith/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

from .core import start_policy_evaluation

# TODO: Use at least __name__ for the logger name
logger = logging.getLogger()

logger = logging.getLogger(__name__)


def eprint(*args, **kwargs):
Expand Down
4 changes: 2 additions & 2 deletions src/tirith/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from .evaluators import EVALUATORS_DICT


# TODO: Use __name__ for the logger name instead of using the root logger
logger = logging.getLogger()

logger = logging.getLogger(__name__)


def get_evaluator_inputs_from_provider_inputs(provider_inputs, provider_module, input_data):
Expand Down
3 changes: 1 addition & 2 deletions src/tirith/core/evaluators/contained_in.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
from .base_evaluator import BaseEvaluator
from tirith.utils import sort_collections

# TODO: At least add __name__ as the name for the logger
logger = logging.getLogger()
logger = logging.getLogger(__name__)

# Checks if :attr: `evaluator_input` is contained in :attr:`evaluator_data`.

Expand Down
4 changes: 2 additions & 2 deletions src/tirith/core/evaluators/contains.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from .base_evaluator import BaseEvaluator
from tirith.utils import sort_collections

# TODO: At least add __name__ as the name for the logger
logger = logging.getLogger()

logger = logging.getLogger(__name__)

# Checks if :attr: `evaluator_input` is contained in :attr:`evaluator_data`.

Expand Down
3 changes: 1 addition & 2 deletions src/tirith/core/evaluators/equals.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
from .base_evaluator import BaseEvaluator
from tirith.utils import sort_collections

# TODO: Use __name__ for the logger name instead of using the root logger
logger = logging.getLogger()
logger = logging.getLogger(__name__)

# Checks if :attr:`value` is equal to :attr:`other`. Automatically casts values to the same type if possible.

Expand Down
4 changes: 2 additions & 2 deletions src/tirith/core/evaluators/not_contained_in.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from .base_evaluator import BaseEvaluator
from tirith.utils import sort_collections

# TODO: At least add __name__ as the name for the logger
logger = logging.getLogger()

logger = logging.getLogger(__name__)

# Checks if :attr: `evaluator_input` is not contained in :attr:`evaluator_data`.

Expand Down
4 changes: 2 additions & 2 deletions src/tirith/core/evaluators/not_contains.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from .base_evaluator import BaseEvaluator
from tirith.utils import sort_collections

# TODO: At least add __name__ as the name for the logger
logger = logging.getLogger()

logger = logging.getLogger(__name__)

# Checks if :attr: `evaluator_input` does not contain :attr:`evaluator_data`.

Expand Down
3 changes: 1 addition & 2 deletions src/tirith/core/evaluators/not_equals.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
from .base_evaluator import BaseEvaluator
from tirith.utils import sort_collections

# TODO: Use __name__ for the logger name instead of using the root logger
logger = logging.getLogger()
logger = logging.getLogger(__name__)

# Checks if :attr:`value` is not equal to :attr:`other`. Automatically casts values to the same type if possible.

Expand Down
3 changes: 1 addition & 2 deletions src/tirith/providers/infracost/handler.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import logging

# TODO: Add at least __name__ as the name of the logger
logger = logging.getLogger()
logger = logging.getLogger(__name__)


def __get_all_costs(operation_type, input_data):
Expand Down
4 changes: 2 additions & 2 deletions src/tirith/providers/sg_workflow/handler.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging

# TODO: Add at least __name__ as the name of the logger
logger = logging.getLogger()

logger = logging.getLogger(__name__)


def __getValue(key, data):
Expand Down
2 changes: 1 addition & 1 deletion src/tirith/providers/terraform_plan/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def _get_exp_attribute(split_expressions, input_data):
final_data.append(val)
return final_data


def provide(provider_inputs, input_data):
# """Provides the value of the attribute from the input_data"""
outputs = []
Expand Down
2 changes: 1 addition & 1 deletion src/tirith/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging

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


def sort_collections(inputs):
Expand Down

0 comments on commit dc658cf

Please sign in to comment.