Lazily inject the database connection into DbLog

Created on 15 April 2024, 7 months ago

Problem/Motivation

DbLog requires a database connection, but initializing a logger often doesn't mean you are actually going to log anything.

In 📌 Replace calls to ::expectWarning*() in Drupal\Tests\user\Kernel\Views\HandlerFilterRolesTest Fixed and similar issues we have discussed lazily injecting loggers, but end users of loggers should not really be concerned about this; a better option would be to only instantiate the database connection when we have something to log.

Steps to reproduce

Proposed resolution

Inject Connection via a service closure into DbLog.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Active

Version

11.0 🔥

Component
Database Logging 

Last updated about 2 months ago

Created by

🇬🇧United Kingdom longwave UK

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024