From 7a48b533c66f9eec065c1dbcd9745ce7cbb43642 Mon Sep 17 00:00:00 2001 From: KenF Date: Fri, 23 Jan 2026 10:41:02 +0800 Subject: [PATCH] chore: added logging and later on disabled them --- projectlib/__pycache__/aws.cpython-314.pyc | Bin 1831 -> 1831 bytes projectlib/aws.py | 9 ++++++--- run-inventory-scripts.sh | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/projectlib/__pycache__/aws.cpython-314.pyc b/projectlib/__pycache__/aws.cpython-314.pyc index 601f2e7f11ee871f5421fc2786e9ae5b27c846b5..68bb56b41658cddcbc55a9f0783f58ccfe96a737 100644 GIT binary patch delta 147 zcmZ3^x15hpn~#@^0SLLzhRT;{5{`ge8)KGjRSDi8P-zq10FUw9_}Wi95C1v0Pms{HvRFu97Y iLzRVvk>xWV10(Nk1|Z`6z{bEY)xiCo1!h4J$Qb|?AtopQ diff --git a/projectlib/aws.py b/projectlib/aws.py index 76f6c08..5cd6a52 100644 --- a/projectlib/aws.py +++ b/projectlib/aws.py @@ -1,4 +1,3 @@ -#!/usr/bin/python3 r""" Documentation @@ -9,8 +8,10 @@ License: This program is released under the MIT License import boto3 import pickle import os - - +# import logging +# +# logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') +# logger = logging.getLogger(__name__) PICKLE_FILE = 'cache.pkl' def getRegions(all_regions=False) -> list[str]: @@ -26,9 +27,11 @@ def getRegions(all_regions=False) -> list[str]: with open(PICKLE_FILE, 'rb') as f: cache = pickle.load(f) if cache_key in cache: + # logger.info("Return aws regions from cache...") return cache[cache_key] # Fetch from AWS and cache it + # logger.info("Getting AWS regions and cache them...") ec2 = boto3.client('ec2', region_name='us-east-1') response = ec2.describe_regions(AllRegions=all_regions) regions = [region['RegionName'] for region in response['Regions']] diff --git a/run-inventory-scripts.sh b/run-inventory-scripts.sh index e327200..c8c112e 100755 --- a/run-inventory-scripts.sh +++ b/run-inventory-scripts.sh @@ -8,7 +8,7 @@ rm -f aws-inventory.xlsx cache.pkl # Execute individual inventory scripts for i in aws*.py; do - echo "# $i" + echo "Running $i..." ./"$i" | mlr --c2t cat | column -t wait $! done