Skip to content

Commit f392f2a

Browse files
committed
test logs
1 parent c84bda9 commit f392f2a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

api/src/shared/common/logging_utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ def __init__(self, name: str):
2929
# '%(asctime)s %(levelname)s %(name)s %(message)s'
3030
# )
3131

32-
if is_local_env():
32+
if not is_local_env():
3333
handler = logging.StreamHandler()
3434
else:
3535
try:
3636
client = google.cloud.logging.Client()
37+
client.setup_logging()
38+
self.logger.info("GCP logging client initialized")
3739
handler = CloudLoggingHandler(client)
3840
except Exception as e:
3941
# fallback to stdout if cloud client fails
@@ -45,13 +47,14 @@ def __init__(self, name: str):
4547

4648
# Also configure SQLAlchemy to use this logger
4749
self.setup_sqlalchemy_logger(handler)
50+
self.logger.info("Logger initialized")
4851

4952
def setup_sqlalchemy_logger(self, handler):
5053
sqlalchemy_loggers = [
5154
"sqlalchemy.engine",
5255
# "sqlalchemy.pool",
5356
# "sqlalchemy.dialects.postgresql",
54-
"sqlalchemy.engine.Engine"
57+
"sqlalchemy.engine.Engine",
5558
]
5659
for logger_name in sqlalchemy_loggers:
5760
logger = logging.getLogger(logger_name)

0 commit comments

Comments
 (0)