Skip to content

Commit abd7ca2

Browse files
committed
add info logs
1 parent 4cb13c9 commit abd7ca2

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

lambdas/shared/src/common/clients.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,19 @@
22
import logging
33
from boto3 import client as boto3_client, resource as boto3_resource
44

5-
logging.basicConfig(level="INFO")
6-
logger = logging.getLogger()
7-
logger.setLevel("INFO")
5+
# Configure root logger with a numeric level and ensure any handlers accept INFO.
6+
logging.basicConfig(level=logging.INFO)
7+
root_logger = logging.getLogger()
8+
root_logger.setLevel(logging.INFO)
9+
for handler in root_logger.handlers:
10+
# make sure handler level is not higher than INFO
11+
try:
12+
handler.setLevel(logging.INFO)
13+
except Exception:
14+
pass
15+
16+
# Export the configured root logger for modules to use
17+
logger = root_logger
818

919
STREAM_NAME = os.getenv("SPLUNK_FIREHOSE_NAME", "firehose-name-not-defined")
1020
CONFIG_BUCKET_NAME = os.getenv("CONFIG_BUCKET_NAME", "variconfig-bucketable-not-defined")

0 commit comments

Comments
 (0)