Exemplo n.º 1
0
 /**
  * @covers LegacyLogger::interpolate
  * @dataProvider provideInterpolate
  */
 public function testInterpolate($message, $context, $expect)
 {
     $this->assertEquals($expect, LegacyLogger::interpolate($message, $context));
 }
Exemplo n.º 2
0
 /**
  * This is a method to pass messages from wfDebug to the pretty debugger.
  * Do NOT use this method, use MWDebug::log or wfDebug()
  *
  * @since 1.19
  * @param string $str
  * @param array $context
  */
 public static function debugMsg($str, $context = [])
 {
     global $wgDebugComments, $wgShowDebug;
     if (self::$enabled || $wgDebugComments || $wgShowDebug) {
         if ($context) {
             $prefix = '';
             if (isset($context['prefix'])) {
                 $prefix = $context['prefix'];
             } elseif (isset($context['channel']) && $context['channel'] !== 'wfDebug') {
                 $prefix = "[{$context['channel']}] ";
             }
             if (isset($context['seconds_elapsed']) && isset($context['memory_used'])) {
                 $prefix .= "{$context['seconds_elapsed']} {$context['memory_used']}  ";
             }
             $str = LegacyLogger::interpolate($str, $context);
             $str = $prefix . $str;
         }
         self::$debug[] = rtrim(UtfNormal\Validator::cleanUp($str));
     }
 }