Closed seaerchin closed 7 months ago
auth spec is somehow failing but this doesn't touch it
@seaerchin the auth spec fixed alr, can rebase from develop
@seaerchin will adding of context attributes in our log statements be done in future PRs?
@seaerchin will adding of context attributes in our log statements be done in future PRs?
this is already done at present unless you mean per module attributes. if that's the case, we can use pino child loggers on a per module basis
Right, I didn't think we'd merge that as-is but it's fine, it should work and we can iterate to make things better:
Known issue so far:
Also for reference, the condition selection of loggers from env vars is a bit iffy, Armoury has recently adopted a different system which is simpler and more reliable and we can consider adopting. Reference PR here.
Known issue so far:
- Logging from axios instance are not connected to APM traces. That needs to be understood and remedied
re: axios logging not connected - my hunch is that it's not being connected because we start a new trace. due to the call of tracer.use
, we create a new trace and the logs are not connected to the original trace - we should be able to verify this post rollout tomorrow.
Also for reference, the condition selection of loggers from env vars is a bit iffy, Armoury has recently adopted a different system which is simpler and more reliable and we can consider adopting. Reference PR here.
actually this seems smarter hahahahahahah will change
Problem
this pr adds a structured logging library (
pino
) to our codebase. it also supersedeswinston
(which hasn't been working anyway).Closes [ISOM-772]
Solution
pino
andpino-pretty
(will be described below)consoleLogger
implementation with a call topino
with transport aspino-pretty
.pino
pipes logs by default tostdout
. this means that on local, the logs get transformed bypino-pretty
before going tostdout
, so it'll be seen as unstructured text instead of json.stdout
- this gets picked up by aws and forwarded to the correct log group. this is actually how logging works now - ourwinston
logger has been missing atransport
and broken since forever. this was also chosen over usingpino-cloudwatch
because the latter is legacy.see examples of the logger at work https://ogp.datadoghq.com/logs?query=service:isomer-infra%20env:%22staging%22%20sourc[…]=stream&from_ts=1710241200000&to_ts=1710244740000&live=false