-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogger.py
23 lines (19 loc) · 710 Bytes
/
logger.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
from aws_lambda_powertools import Logger
logger = Logger()
"""Log info messages
"""
def info(log_message):
#logger.structure_logs(append=True, tenant_id=tenant_id)
logger.info (log_message)
"""Log error messages
"""
def error(log_message):
#logger.structure_logs(append=True, tenant_id=tenant_id)
logger.error (log_message)
"""Log with tenant context. Extracts tenant context from the lambda events
"""
def log_with_tenant_context(event, log_message):
logger.structure_logs(append=True, tenant_id= event['requestContext']['authorizer']['tenantId'])
logger.info (log_message)