Yesterday I opened Gerrit change 112699 [0] with a proof of concept
implementation for the Structured logging RFC [1] that leverages PSR-3
and Monolog. I'm sure it's not ready to merge yet but hopefully it
will get some attention from interested parties to move this
discussion forward.
From the commit message:
This proof of concept implementation of the structured logging RFC
introduces a PSR-3 based logging class. The MWLogger class is actually
a thin wrapper around any PSR-3 LoggerInterface implementation. Named
MWLogger instances can be obtained from the MWLogger::getInstance()
static method. MWLogger expects a class implementing the MWLoggerSpi
interface to act as a factory for new MWLogger instances. A concrete
MWLoggerSpi implementation using the Monolog library is also provided.
There are a couple things in this change that I expect deserve
discussion. The biggest is the way that I am proposing to use Composer
to manage importing Monolog and the Psr\Log libraries into
mediawiki-core. This crosses into the territory of the Third-party
components RFC [2]. This topic has come up on gerrit already. I gave
this response there:
Jeroen wrote:
Not really nice to just copy the monolog sources
into MW...
I would agree that it's not the cleanest or prettiest way to get significant
third-party code incorporated into MediaWiki, but this is part of the
conversation that I was hoping this patch could move forward.
Do you have a suggestion for a better way to incorporate external packages
that will allow deployment to WMF cluster and easy packaging for the tarball
releases? I'm using a Composer file to manage the lib directory so that we
can upgrade to newer versions with a minimum amount of fuss. The full
"vendor" structure from the Composer is maintained so that license files, etc
are preserved. I see this method as being similar to the way that we include
jQuery and other javascript libraries.
[0]:
https://gerrit.wikimedia.org/r/#/c/112699/
[1]:
https://www.mediawiki.org/wiki/Requests_for_comment/Structured_logging
[2]:
https://www.mediawiki.org/wiki/Requests_for_comment/Third-party_components
--
Bryan Davis Wikimedia Foundation <bd808(a)wikimedia.org>
[[m:User:BDavis_(WMF)]] Sr Software Engineer Boise, ID USA
irc: bd808 v:415.839.6885 x6855