nais / teams-backend

NAIS teams is a API server for team creation and propagation to external systems.
MIT License
3 stars 0 forks source link

Refactor auditlogger to ease testing #141

Closed christeredvartsen closed 1 year ago

christeredvartsen commented 1 year ago

Resolves #130

Move the database connection back into the auditlogger instance instead of passing it in every time we want to log a message. This means that the Logf should not be used inside a database transaction, as stated in the "docstring" for the function. The Logf function currently generates a system log entry, so calling that inside a database transaction that might be rolled back is a bad idea anyways.