Added os env conrolled logging

This commit is contained in:
Lyncoln
2026-10-28 11:14:15 -04:00
parent cb3a2d90b0
commit 9d4e9d38ad
5 changed files with 30 additions and 10 deletions
+4
View File
@@ -1,6 +1,10 @@
import os
from core.runtime.applyconditions import applyConditions
def buildFirewall(listener, outputs):
firewall_log = os.environ.get("LOGS_FIREWALL", "false").lower() == "true"
status_code = 200
outputs["firewall_allowed"] = []
for item in outputs[listener.recursive["source"]]:
+6 -1
View File
@@ -1,4 +1,8 @@
import os
def resolveItem(action, item):
resolver_log = os.environ.get("LOGS_RESOLVER", "false").lower() == "true"
resolved = {}
if hasattr(action, "resolve"):
for label, keys in action.resolve["get"].items():
@@ -8,7 +12,8 @@ def resolveItem(action, item):
target = target[key]
except (KeyError, IndexError) as error:
print(f"Resolver target key/index {error} not found during {action.name}")
if resolver_log:
print(f"Resolver target key/index {error} not found during {action.name}")
target = None
resolved[label] = target
+8 -2
View File
@@ -2,6 +2,8 @@ import json
import os
def buildSave(action, outputs):
savedata_log = os.environ.get("LOGS_SAVE_DATA_ACCESS", "false").lower() == "true"
import tempfile
if hasattr(action, "savedata"):
@@ -36,10 +38,13 @@ def buildSave(action, outputs):
except FileNotFoundError:
pass
#print(f"Data saved by {action.name} to {action.savepath}")
if savedata_log:
print(f"Data saved by {action.name} to {action.savepath}")
return outputs
def loadSave(action, outputs):
savedata_log = os.environ.get("LOGS_SAVE_DATA_ACCESS", "false").lower() == "true"
if hasattr(action, "loaddata"):
with open(f"{action.savepath}", "r") as save_file:
load_data = json.load(save_file)
@@ -47,7 +52,8 @@ def loadSave(action, outputs):
for load_name in action.loaddata:
outputs[load_name] = load_data[load_name]
#print(f"Data loaded by {action.name} from {action.savepath}")
if savedata_log:
print(f"Data loaded by {action.name} from {action.savepath}")
return outputs
def saveRow(action, outputs, resolved):
+4 -1
View File
@@ -1,6 +1,9 @@
import os
def buildSelect(action, outputs):
#***THIS IS THE CANONICAL BUILD***
select_log = False
select_log = savedata_log = os.environ.get("LOGS_SELECT", "false").lower() == "true"
select_data = []