Skip to content

Commit

Permalink
Standardise loggers in python lambda functions
Browse files Browse the repository at this point in the history
Resolves #644
  • Loading branch information
alexiswl committed Nov 3, 2024
1 parent ed92fcf commit ecd930d
Show file tree
Hide file tree
Showing 25 changed files with 134 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@
from mypy_boto3_secretsmanager import SecretsManagerClient

# Set logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
logging.basicConfig(
level=logging.INFO,
force=True,
format='%(asctime)s %(message)s'
)
logger = logging.getLogger()

# Globals
SUCCESS_STATES = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@
from typing import Dict, Union

# Set logger
logging.basicConfig(
level=logging.INFO,
force=True,
format='%(asctime)s %(message)s'
)
logger = logging.getLogger()
logger.setLevel(logging.INFO)


def pascal_case_to_snake_case(pascal_case_str: str) -> str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
from metadata_tools import get_all_libraries

# Logger
logging.basicConfig(
level=logging.INFO,
force=True,
format='%(asctime)s %(message)s'
)
logger = logging.getLogger()
logger.setLevel(logging.INFO)


def get_library_objs(library_id_list: List[str]) -> List[Dict]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,12 @@
ICAV2_BASE_URL = "https://ica.illumina.com/ica/rest"

# Set loggers
logging.basicConfig(
level=logging.INFO,
force=True,
format='%(asctime)s %(message)s'
)
logger = logging.getLogger()
logger.setLevel(logging.INFO)


def get_secrets_manager_client() -> 'SecretsManagerClient':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@
from wrapica.enums import DataType

# Set logger
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
logging.basicConfig(
level=logging.INFO,
force=True,
format='%(asctime)s %(message)s'
)
logger = logging.getLogger()

if typing.TYPE_CHECKING:
from mypy_boto3_secretsmanager.client import SecretsManagerClient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@
from mypy_boto3_ssm import SSMClient
from mypy_boto3_secretsmanager import SecretsManagerClient

logger = logging.getLogger(__name__)

logging.basicConfig(level=logging.INFO)
# Set logger
logging.basicConfig(
level=logging.INFO,
force=True,
format='%(asctime)s %(message)s'
)
logger = logging.getLogger()

ICAV2_BASE_URL = "https://ica.illumina.com/ica/rest"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@
ICAV2_BASE_URL = "https://ica.illumina.com/ica/rest"

# Set loggers
logging.basicConfig(
level=logging.INFO,
force=True,
format='%(asctime)s %(message)s'
)
logger = logging.getLogger()
logger.setLevel(logging.INFO)


def get_secrets_manager_client() -> 'SecretsManagerClient':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@
ICAV2_BASE_URL = "https://ica.illumina.com/ica/rest"

# Set loggers
logging.basicConfig(
level=logging.INFO,
force=True,
format='%(asctime)s %(message)s'
)
logger = logging.getLogger()
logger.setLevel(logging.INFO)


def get_secrets_manager_client() -> 'SecretsManagerClient':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@
ICAV2_BASE_URL = "https://ica.illumina.com/ica/rest"

# Set loggers
logging.basicConfig(
level=logging.INFO,
force=True,
format='%(asctime)s %(message)s'
)
logger = logging.getLogger()
logger.setLevel(logging.INFO)


def get_secrets_manager_client() -> 'SecretsManagerClient':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,12 @@
]

# Set basic logger
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
logging.basicConfig(
level=logging.INFO,
force=True,
format='%(asctime)s %(message)s'
)
logger = logging.getLogger()



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@
ICAV2_BASE_URL = "https://ica.illumina.com/ica/rest"

# Set loggers
logging.basicConfig(
level=logging.INFO,
force=True,
format='%(asctime)s %(message)s'
)
logger = logging.getLogger()
logger.setLevel(logging.INFO)


def get_secrets_manager_client() -> 'SecretsManagerClient':
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@
from pieriandx_pipeline_tools.utils.secretsmanager_helpers import set_pieriandx_env_vars

# Set logger
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
logging.basicConfig(
level=logging.INFO,
force=True,
format='%(asctime)s %(message)s'
)
logger = logging.getLogger()


JOB_STATUS_BOOL = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,12 @@
ICAV2_BASE_URL = "https://ica.illumina.com/ica/rest"

# Set loggers
logging.basicConfig(
level=logging.INFO,
force=True,
format='%(asctime)s %(message)s'
)
logger = logging.getLogger()
logger.setLevel(logging.INFO)


def get_secrets_manager_client() -> 'SecretsManagerClient':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,12 @@
"""

# Set loggers
logging.basicConfig(
level=logging.INFO,
force=True,
format='%(asctime)s %(message)s'
)
logger = logging.getLogger()
logger.setLevel(logging.INFO)


def get_secrets_manager_client() -> 'SecretsManagerClient':
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,12 @@
"""

# Set loggers
logging.basicConfig(
level=logging.INFO,
force=True,
format='%(asctime)s %(message)s'
)
logger = logging.getLogger()
logger.setLevel(logging.INFO)


def get_secrets_manager_client() -> 'SecretsManagerClient':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
from typing import Optional
import logging

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
logging.basicConfig(
level=logging.INFO,
force=True,
format='%(asctime)s %(message)s'
)
logger = logging.getLogger()

# Globals
HEADER = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,12 @@
ICAV2_BASE_URL = "https://ica.illumina.com/ica/rest"

# Set logger
logging.basicConfig(
level=logging.INFO,
force=True,
format='%(asctime)s %(message)s'
)
logger = logging.getLogger()
logger.setLevel(logging.INFO)


def get_secrets_manager_client() -> 'SecretsManagerClient':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@
from typing import Dict

# Set log level
logging.basicConfig(
level=logging.INFO,
force=True,
format='%(asctime)s %(message)s'
)
logger = logging.getLogger()
logger.setLevel(logging.INFO)


def handler(event, context) -> Dict[str, Dict[str, str]]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@
from mypy_boto3_lambda import LambdaClient

# Set logger
logging.basicConfig(level=logging.INFO)
logging.basicConfig(
level=logging.INFO,
force=True,
format='%(asctime)s %(message)s'
)
logger = logging.getLogger()
logger.setLevel(level=logging.INFO)

# Globals
AUS_TIMEZONE = pytz.timezone("Australia/Melbourne")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@


# Set logger
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
logging.basicConfig(
level=logging.INFO,
force=True,
format='%(asctime)s %(message)s'
)
logger = logging.getLogger()

# Globals
AUS_TIMEZONE = pytz.timezone("Australia/Melbourne")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@
import logging

# Set logger
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
logging.basicConfig(
level=logging.INFO,
force=True,
format='%(asctime)s %(message)s'
)
logger = logging.getLogger()

# Globals
AUS_TIMEZONE = pytz.timezone("Australia/Melbourne")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@
}

# Set loggers
logging.basicConfig(
level=logging.INFO,
force=True,
format='%(asctime)s %(message)s'
)
logger = logging.getLogger()
logger.setLevel(logging.INFO)


def get_secrets_manager_client() -> 'SecretsManagerClient':
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@
ICAV2_BASE_URL = "https://ica.illumina.com/ica/rest"

# Set logger
logging.basicConfig(
level=logging.INFO,
force=True,
format='%(asctime)s %(message)s'
)
logger = logging.getLogger()
logger.setLevel(logging.INFO)


def get_secrets_manager_client() -> 'SecretsManagerClient':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@
ICAV2_BASE_URL = "https://ica.illumina.com/ica/rest"

# Set logger
logging.basicConfig(
level=logging.INFO,
force=True,
format='%(asctime)s %(message)s'
)
logger = logging.getLogger()
logger.setLevel(logging.INFO)


def get_secrets_manager_client() -> 'SecretsManagerClient':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@


# Set logger
logging.basicConfig(
level=logging.INFO,
force=True,
format='%(asctime)s %(message)s'
)
logger = logging.getLogger()
logger.setLevel(logging.INFO)


def get_secrets_manager_client() -> 'SecretsManagerClient':
Expand Down

0 comments on commit ecd930d

Please sign in to comment.