Skip to content

Commit 1584246

Browse files
committed
configure log levels
1 parent 3bab5e5 commit 1584246

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

functions/notify_slack.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,9 @@ def lambda_handler(event: Dict[str, Any], context: Dict[str, Any]) -> str:
453453
:param context: lambda expected context object
454454
:returns: none
455455
"""
456+
log_level = os.environ.get("LOG_LEVEL", "INFO").upper()
457+
logging.basicConfig(level=getattr(logging, log_level, logging.INFO))
458+
456459
if os.environ.get("LOG_EVENTS", "False") == "True":
457460
logging.info(f"Event logging enabled: `{json.dumps(event)}`")
458461

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ variable "log_events" {
168168
default = false
169169
}
170170

171+
variable "log_level" {
172+
description = "The log level for the Lambda function"
173+
type = string
174+
default = "WARN"
175+
}
176+
171177
variable "reserved_concurrent_executions" {
172178
description = "The amount of reserved concurrent executions for this lambda function. A value of 0 disables lambda from being triggered and -1 removes any concurrency limitations"
173179
type = number

0 commit comments

Comments
 (0)