当前位置: 首页>>代码示例>>PHP>>正文


PHP MWDebug::debugMsg方法代码示例

本文整理汇总了PHP中MWDebug::debugMsg方法的典型用法代码示例。如果您正苦于以下问题:PHP MWDebug::debugMsg方法的具体用法?PHP MWDebug::debugMsg怎么用?PHP MWDebug::debugMsg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MWDebug的用法示例。


在下文中一共展示了MWDebug::debugMsg方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wfDebug

/**
 * Sends a line to the debug log if enabled or, optionally, to a comment in output.
 * In normal operation this is a NOP.
 *
 * Controlling globals:
 * $wgDebugLogFile - points to the log file
 * $wgProfileOnly - if set, normal debug messages will not be recorded.
 * $wgDebugRawPage - if false, 'action=raw' hits will not result in debug output.
 * $wgDebugComments - if on, some debug items may appear in comments in the HTML output.
 *
 * @param $text String
 * @param $logonly Bool: set true to avoid appearing in HTML when $wgDebugComments is set
 */
function wfDebug($text, $logonly = false)
{
    global $wgDebugLogFile, $wgProfileOnly, $wgDebugRawPage, $wgDebugLogPrefix;
    if (!$wgDebugRawPage && wfIsDebugRawPage()) {
        return;
    }
    $timer = wfDebugTimer();
    if ($timer !== '') {
        $text = preg_replace('/[^\\n]/', $timer . '\\0', $text, 1);
    }
    if (!$logonly) {
        MWDebug::debugMsg($text);
    }
    if (wfRunHooks('Debug', array($text, null))) {
        if ($wgDebugLogFile != '' && !$wgProfileOnly) {
            # Strip unprintables; they can switch terminal modes when binary data
            # gets dumped, which is pretty annoying.
            $text = preg_replace('![\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f]!', ' ', $text);
            $text = $wgDebugLogPrefix . $text;
            wfErrorLog($text, $wgDebugLogFile);
        }
    }
}
开发者ID:nischayn22,项目名称:mediawiki-core,代码行数:36,代码来源:GlobalFunctions.php

示例2: wfDebugLog

/**
 * Send a line to a supplementary debug log file, if configured, or main debug log if not.
 * To configure a supplementary log file, set $wgDebugLogGroups[$logGroup] to a string
 * filename or an associative array mapping 'destination' to the desired filename. The
 * associative array may also contain a 'sample' key with an integer value, specifying
 * a sampling factor.
 *
 * @since 1.23 support for sampling log messages via $wgDebugLogGroups.
 *
 * @param string $logGroup
 * @param string $text
 * @param string|bool $dest Destination of the message:
 *     - 'all': both to the log and HTML (debug toolbar or HTML comments)
 *     - 'log': only to the log and not in HTML
 *     - 'private': only to the specifc log if set in $wgDebugLogGroups and
 *       discarded otherwise
 *   For backward compatibility, it can also take a boolean:
 *     - true: same as 'all'
 *     - false: same as 'private'
 */
function wfDebugLog($logGroup, $text, $dest = 'all')
{
    global $wgDebugLogGroups;
    $text = trim($text) . "\n";
    // Turn $dest into a string if it's a boolean (for b/c)
    if ($dest === true) {
        $dest = 'all';
    } elseif ($dest === false) {
        $dest = 'private';
    }
    if (!isset($wgDebugLogGroups[$logGroup])) {
        if ($dest !== 'private') {
            wfDebug("[{$logGroup}] {$text}", $dest);
        }
        return;
    }
    if ($dest === 'all') {
        MWDebug::debugMsg("[{$logGroup}] {$text}");
    }
    $logConfig = $wgDebugLogGroups[$logGroup];
    if ($logConfig === false) {
        return;
    }
    if (is_array($logConfig)) {
        if (isset($logConfig['sample']) && mt_rand(1, $logConfig['sample']) !== 1) {
            return;
        }
        $destination = $logConfig['destination'];
    } else {
        $destination = strval($logConfig);
    }
    $time = wfTimestamp(TS_DB);
    $wiki = wfWikiID();
    $host = wfHostname();
    wfErrorLog("{$time} {$host} {$wiki}: {$text}", $destination);
}
开发者ID:whysasse,项目名称:kmwiki,代码行数:56,代码来源:GlobalFunctions.php

示例3: wfDebug

/**
 * Sends a line to the debug log if enabled or, optionally, to a comment in output.
 * In normal operation this is a NOP.
 *
 * Controlling globals:
 * $wgDebugLogFile - points to the log file
 * $wgProfileOnly - if set, normal debug messages will not be recorded.
 * $wgDebugRawPage - if false, 'action=raw' hits will not result in debug output.
 * $wgDebugComments - if on, some debug items may appear in comments in the HTML output.
 *
 * @param $text String
 * @param $logonly Bool: set true to avoid appearing in HTML when $wgDebugComments is set
 */
function wfDebug($text, $logonly = false)
{
    global $wgOut, $wgDebugLogFile, $wgDebugComments, $wgProfileOnly, $wgDebugRawPage;
    global $wgDebugLogPrefix, $wgShowDebug;
    static $cache = array();
    // Cache of unoutputted messages
    $text = wfDebugTimer() . $text;
    if (!$wgDebugRawPage && wfIsDebugRawPage()) {
        return;
    }
    if (($wgDebugComments || $wgShowDebug) && !$logonly) {
        $cache[] = $text;
        if (isset($wgOut) && is_object($wgOut)) {
            // add the message and any cached messages to the output
            array_map(array($wgOut, 'debug'), $cache);
            $cache = array();
        }
    }
    if (wfRunHooks('Debug', array($text, null))) {
        if ($wgDebugLogFile != '' && !$wgProfileOnly) {
            # Strip unprintables; they can switch terminal modes when binary data
            # gets dumped, which is pretty annoying.
            $text = preg_replace('![\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f]!', ' ', $text);
            $text = $wgDebugLogPrefix . $text;
            wfErrorLog($text, $wgDebugLogFile);
        }
    }
    MWDebug::debugMsg($text);
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:42,代码来源:GlobalFunctions.php


注:本文中的MWDebug::debugMsg方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。