Added debug logging disabling possibilities
This commit is contained in:
+17
-13
@@ -127,11 +127,12 @@ class AppBase:
|
||||
def __init__(self, redis=None, logger=None, console_logger=None):#, docker_client=None):
|
||||
self.logger = logger if logger is not None else logging.getLogger("AppBaseLogger")
|
||||
|
||||
#self.log_capture_string = StringBuffer()
|
||||
#ch = logging.StreamHandler(self.log_capture_string)
|
||||
#formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||
#ch.setFormatter(formatter)
|
||||
#logger.addHandler(ch)
|
||||
if not os.getenv("SHUFFLE_LOGS_DISABLED") == "true":
|
||||
self.log_capture_string = StringBuffer()
|
||||
ch = logging.StreamHandler(self.log_capture_string)
|
||||
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||
ch.setFormatter(formatter)
|
||||
logger.addHandler(ch)
|
||||
|
||||
self.redis=redis
|
||||
self.console_logger = logger if logger is not None else logging.getLogger("AppBaseLogger")
|
||||
@@ -299,8 +300,9 @@ class AppBase:
|
||||
self.logger.info(f"[INFO] URL FOR RESULT (URL): {url}")
|
||||
|
||||
try:
|
||||
#log_contents = self.log_capture_string.getvalue()
|
||||
log_contents = "disabled"
|
||||
if not os.getenv("SHUFFLE_LOGS_DISABLED") == "true":
|
||||
log_contents = self.log_capture_string.getvalue()
|
||||
|
||||
#print("RESULTS: %s" % log_contents)
|
||||
self.logger.info(f"[WARNING] Got logs of length {len(log_contents)}")
|
||||
@@ -377,12 +379,14 @@ class AppBase:
|
||||
except urllib3.exceptions.ProtocolError as e:
|
||||
self.logger.info(f"[DEBUG] Expected ProtocolError happened: {e}")
|
||||
|
||||
#try:
|
||||
# self.log_capture_string.flush()
|
||||
# self.log_capture_string.close()
|
||||
#except Exception as e:
|
||||
# print(f"[WARNING] Failed to flush logs: {e}")
|
||||
# pass
|
||||
|
||||
if not os.getenv("SHUFFLE_LOGS_DISABLED") == "true":
|
||||
try:
|
||||
self.log_capture_string.flush()
|
||||
self.log_capture_string.close()
|
||||
except Exception as e:
|
||||
print(f"[WARNING] Failed to flush logs: {e}")
|
||||
pass
|
||||
|
||||
#async def cartesian_product(self, L):
|
||||
def cartesian_product(self, L):
|
||||
@@ -3201,7 +3205,7 @@ class AppBase:
|
||||
|
||||
# https://ptb.discord.com/channels/747075026288902237/882017498550112286/882043773138382890
|
||||
except (requests.exceptions.RequestException, TimeoutError) as e:
|
||||
self.logger.info(f"Failed to execute request: {e}")
|
||||
self.logger.info(f"Failed to execute request (requests): {e}")
|
||||
self.logger.exception(f"Failed to execute {e}-{action['id']}")
|
||||
self.action_result["status"] = "SUCCESS"
|
||||
try:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
### DEFAULT
|
||||
NAME=shuffle-app_sdk
|
||||
VERSION=0.9.63
|
||||
VERSION=0.9.64
|
||||
|
||||
docker rmi docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION --force
|
||||
docker build . -f Dockerfile -t frikky/shuffle:app_sdk -t frikky/$NAME:$VERSION -t docker.pkg.github.com/frikky/shuffle/$NAME:$VERSION -t ghcr.io/frikky/$NAME:$VERSION -t ghcr.io/frikky/$NAME:nightly
|
||||
|
||||
@@ -2,7 +2,7 @@ module main
|
||||
|
||||
go 1.16
|
||||
|
||||
replace github.com/shuffle/shuffle-shared => ../../../shuffle-shared
|
||||
//replace github.com/shuffle/shuffle-shared => ../../../shuffle-shared
|
||||
|
||||
//replace github.com/frikky/kin-openapi => ../../../../git/kin-openapi
|
||||
//replace github.com/frikky/go-elasticsearch => ../../../../git/go-elasticsearch
|
||||
@@ -24,7 +24,7 @@ require (
|
||||
github.com/h2non/filetype v1.1.3
|
||||
github.com/nirasan/go-oauth-pkce-code-verifier v0.0.0-20170819232839-0fbfe93532da // indirect
|
||||
github.com/satori/go.uuid v1.2.0
|
||||
github.com/shuffle/shuffle-shared v0.2.9
|
||||
github.com/shuffle/shuffle-shared v0.2.11
|
||||
go4.org v0.0.0-20201209231011-d4a079459e60 // indirect
|
||||
golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce
|
||||
google.golang.org/api v0.65.0
|
||||
|
||||
Reference in New Issue
Block a user