create structlog logger (which inherits root logger so also streams to standard out)
the _log() method formats the inputs to a dict and passes it to the structlog logger.
the log passed through the JsonRenderer processor (which basically dumps it as json to standard out).
Confirmed to work in the terminal and when ran on aws glue.
Note - structured logs look a little odd in the terminal, but services like glue and kibana will add indentation so you end up with a nice readable thing.
I did run make fmt so there's a few format tweaks included, just ignore.
How to review
sanity check
run the tests
make sure the readme makes sense
try it out
from dpytools.logging.logger import DpLogger
logger = DpLogger("my-cool-namespace")
logger.info("some message", data={"foo":"bar"})
Who can review
Describe who worked on the changes, so that other people can review.
What
Added a structured logger that subscribes to dp logging standards.
Rough logic is:
_log()
method formats the inputs to a dict and passes it to the structlog logger.Confirmed to work in the terminal and when ran on aws glue.
Note - structured logs look a little odd in the terminal, but services like glue and kibana will add indentation so you end up with a nice readable thing.
I did run
make fmt
so there's a few format tweaks included, just ignore.How to review
Who can review
Describe who worked on the changes, so that other people can review.