Only send DB query profiling to MWDebug::query
This should avoid massive dberror log spam in jenkins. Change-Id: Ifa60843e78b99921768e7a62109c505ff9330e41
This commit is contained in:
parent
144b1e9107
commit
e861191b2c
1 changed files with 8 additions and 5 deletions
|
|
@ -94,6 +94,13 @@ class LegacyLogger extends AbstractLogger {
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
public function log( $level, $message, array $context = [] ) {
|
public function log( $level, $message, array $context = [] ) {
|
||||||
|
if ( $this->channel === 'DBQuery' && isset( $context['method'] )
|
||||||
|
&& isset( $context['master'] ) && isset( $context['runtime'] )
|
||||||
|
) {
|
||||||
|
MWDebug::query( $message, $context['method'], $context['master'], $context['runtime'] );
|
||||||
|
return; // only send profiling data to MWDebug profiling
|
||||||
|
}
|
||||||
|
|
||||||
if ( isset( self::$dbChannels[$this->channel] )
|
if ( isset( self::$dbChannels[$this->channel] )
|
||||||
&& isset( self::$levelMapping[$level] )
|
&& isset( self::$levelMapping[$level] )
|
||||||
&& self::$levelMapping[$level] >= LogLevel::ERROR
|
&& self::$levelMapping[$level] >= LogLevel::ERROR
|
||||||
|
|
@ -109,11 +116,7 @@ class LegacyLogger extends AbstractLogger {
|
||||||
$destination = self::destination( $effectiveChannel, $message, $context );
|
$destination = self::destination( $effectiveChannel, $message, $context );
|
||||||
self::emit( $text, $destination );
|
self::emit( $text, $destination );
|
||||||
}
|
}
|
||||||
if ( $this->channel === 'DBQuery' && isset( $context['method'] )
|
if ( !isset( $context['private'] ) || !$context['private'] ) {
|
||||||
&& isset( $context['master'] ) && isset( $context['runtime'] )
|
|
||||||
) {
|
|
||||||
MWDebug::query( $message, $context['method'], $context['master'], $context['runtime'] );
|
|
||||||
} elseif ( !isset( $context['private'] ) || !$context['private'] ) {
|
|
||||||
// Add to debug toolbar if not marked as "private"
|
// Add to debug toolbar if not marked as "private"
|
||||||
MWDebug::debugMsg( $message, [ 'channel' => $this->channel ] + $context );
|
MWDebug::debugMsg( $message, [ 'channel' => $this->channel ] + $context );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue