more verbose logger setup
Some checks failed
Run linting on the backend code / Build (pull_request) Has been cancelled
Run testing on the backend code / Build (pull_request) Has been cancelled
Build and deploy the backend to staging / Build and push image (pull_request) Successful in 2m32s
Build and deploy the backend to staging / Deploy to staging (pull_request) Successful in 16s
Some checks failed
Run linting on the backend code / Build (pull_request) Has been cancelled
Run testing on the backend code / Build (pull_request) Has been cancelled
Build and deploy the backend to staging / Build and push image (pull_request) Successful in 2m32s
Build and deploy the backend to staging / Deploy to staging (pull_request) Successful in 16s
This commit is contained in:
parent
d9061388dd
commit
c448e2dfb7
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"cmake.ignoreCMakeListsMissing": true
|
|
||||||
}
|
|
@ -1 +1 @@
|
|||||||
Subproject commit 4f0a0289fcf8a7755d7dc1a76b443fe1233685ae
|
Subproject commit 904f16bfc0624b6ab8569e0a70050aaa3bd64b3f
|
@ -21,11 +21,19 @@ debug = os.getenv('DEBUG', "false") == "true"
|
|||||||
if os.getenv('KUBERNETES_SERVICE_HOST', None) is not None:
|
if os.getenv('KUBERNETES_SERVICE_HOST', None) is not None:
|
||||||
# in that case we want to log to stdout and also to loki
|
# in that case we want to log to stdout and also to loki
|
||||||
from loki_logger_handler.loki_logger_handler import LokiLoggerHandler
|
from loki_logger_handler.loki_logger_handler import LokiLoggerHandler
|
||||||
|
loki_url = os.getenv('LOKI_URL')
|
||||||
|
if loki_url is None:
|
||||||
|
raise ValueError("LOKI_URL environment variable is not set")
|
||||||
|
|
||||||
loki_handler = LokiLoggerHandler(
|
loki_handler = LokiLoggerHandler(
|
||||||
url=os.getenv('LOKI_URL', 'http://loki:3100'),
|
url = loki_url,
|
||||||
labels={'app': 'anyway', 'env': 'production' if debug else 'staging'}
|
labels = {'app': 'anyway', 'environment': 'production' if debug else 'staging'}
|
||||||
)
|
)
|
||||||
|
print(f"Logging to Loki at {loki_url} with {loki_handler.labels} and {debug=}")
|
||||||
if debug:
|
if debug:
|
||||||
|
# we need to silence the debug logs made by the loki handler
|
||||||
|
logging.getLogger('urllib3.connectionpool').setLevel(logging.INFO)
|
||||||
|
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
level=logging.DEBUG,
|
level=logging.DEBUG,
|
||||||
handlers=[loki_handler, logging.StreamHandler()]
|
handlers=[loki_handler, logging.StreamHandler()]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user