Drupal is a registered trademark of Dries Buytaert

log_middleware

2 sites Security covered
View on drupal.org

This module provides a customized LoggerChannel implementation with support for middleware. The logger channel and the logger channel factory extend the drupal core equivalents and just add support for middleware. Nothing else is altered in the logger channel implementation.

The module just provides support for middleware and does not provide middleware itself.

Without modules providing middleware the logger functions exactly the same as the drupal core one.

Adding Middleware

Each service tagged with log_middleware will automatically be attached to the logger channel and is applied before processing the log message.

A middleware can alter the log level, message and context. Additionally a middleware can discard a message entirely.

The service tag supports the following arguments:

  • priority: a numeric value indicating the order of which the middleware is run. The higher the number the earlier the middleware is applied. Negative values are allowed.
  • channels: an array with the logger channel names this middleware should be applied to. If empty, the middleware is applied to all channels.

All arguments are optional.

Example middleware implementations can be found in the ./tests/modules/log_test_middleware module.

Activity

Total releases
2
First release
Jan 2025
Latest release
1 year ago
Release cadence
0 days
Stability
50% stable

Releases

Version Type Release date
2.0.0 Stable Jan 20, 2025
2.x-dev Dev Jan 20, 2025