ONSdigital / dp-python-tools

Simple reusable python resources for digital publishing.
MIT License
1 stars 0 forks source link

dp logger #35

Closed mikeAdamss closed 7 months ago

mikeAdamss commented 7 months ago

What

Added a structured logger that subscribes to dp logging standards.

Rough logic is:

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

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.