Open dirkgomez opened 3 years ago
I've replaced straight prints with the Python logging module in my repository: https://github.com/dirkgomez/bucket-antivirus-function/blob/master/, e. g. like this:
+logging.getLogger().setLevel(level=os.getenv("LOG_LEVEL", logging.INFO)) def update_defs_from_s3(s3_client, bucket, prefix): create_dir(AV_DEFINITION_PATH) @@ -60,13 +52,13 @@ def update_defs_from_s3(s3_client, bucket, prefix): s3_time = time_from_s3(s3_client, bucket, s3_path) if s3_best_time is not None and s3_time < s3_best_time: - print("Not downloading older file in series: %s" % filename) + logging.info("Not downloading older file in series: %s" % filename) continue else: s3_best_time = s3_time
Advantages: it's configurable from within the source code what is getting logging and also from an environment variable passed into the lambda.
Would you accept a PR?
@dirkgomez could you submit a PR for this?
I've replaced straight prints with the Python logging module in my repository: https://github.com/dirkgomez/bucket-antivirus-function/blob/master/, e. g. like this:
Advantages: it's configurable from within the source code what is getting logging and also from an environment variable passed into the lambda.
Would you accept a PR?