Skip to content

Implement logger #4

@mikeAdamss

Description

@mikeAdamss

What is this

We want a python logging library that is compliant with digital publishing logging standards.

The good news is we've done a lot of this here: https://github.com/GSS-Cogs/idpd-api-poc/blob/main/src/custom_logging.py , so this task is primarily about porting it over.

What to do

  • Copy the code over to here.
  • Check that the logs to get formatted to the DP standard, from memory I think its close, but not quite. this does take some figuring out, take your time working through this, id much prefer closer to right than fast.
  • Pay special attention to the Output Formatting section. The behaviour we want is:
    - outputted as per that page (json lines etc) as the default.
    - if that ends up quite hard to work with locally, then add an env var of HUMAN_FRIENDLY_LOGGING that'll toggle us back to pretty logs. The key point is the machine friendly logs described in the readme needs to be the default unless specified otherwise.
  • We don't want a default namespace this time, if someone doesn't provide one then blow up and kill the app.

If possible add some tests, it's quite tricky with things like logging but any sort of confirmation its doing what we expect it to be doing would be nice.

Acceptance Criteria

  • logger installable from the repo.
  • logger creates logs in a format compliant with dp logging standards.
  • some amount of test coverage.
  • good to have try and report back on whether we can use it in dp-api-poc, dont worry about implementing that for this, we just want to know if it seems viable for a future task, so give it a try and find out.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions