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


PHP modX::setLogLevel方法代码示例

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


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

示例1: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     require_once dirname(__FILE__) . '/build.config.php';
     require_once dirname(__FILE__) . '/uthelpers.class.php';
     require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
     $modx = new modX();
     $modx->initialize('mgr');
     $modx->getService('error', 'error.modError', '', '');
     $this->utHelpers = new UtHelpers();
     $this->mc = new MyComponentProject($modx);
     $this->mc->init(array(), 'unittest');
     $this->mc->createCategories();
     $this->mc->createBasics();
     $this->modx =& $this->mc->modx;
     if ($this->mc->props['categories']['UnitTest']['category'] != 'UnitTest') {
         die('wrong config');
     }
     if (strstr($this->mc->targetRoot, 'unittest')) {
         // $this->utHelpers->rrmdir($this->mc->targetRoot);
     } else {
         die('Wrong Target Root!');
     }
     $modx->setLogLevel(modX::LOG_LEVEL_INFO);
     $modx->setLogTarget('ECHO');
 }
开发者ID:mooror,项目名称:MyComponent,代码行数:29,代码来源:exporttest.php

示例2: resetLogging

 /**
  * Reset the current logging.
  *
  * @access public
  */
 public function resetLogging() {
     if ($this->_loggingRegister && $this->_prevLogTarget && $this->_prevLogLevel) {
         $this->modx->setLogTarget($this->_prevLogTarget);
         $this->modx->setLogLevel($this->_prevLogLevel);
         $this->_loggingRegister = null;
     }
 }
开发者ID:raf3600,项目名称:revolution,代码行数:12,代码来源:modregistry.class.php

示例3: loadModxInstance

 public static function loadModxInstance()
 {
     require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
     $modx = new modX();
     $modx->initialize('mgr');
     echo XPDO_CLI_MODE ? '' : '<pre>';
     $modx->setLogLevel(modX::LOG_LEVEL_INFO);
     $modx->setLogTarget('ECHO');
     $modx->loadClass('transport.modPackageBuilder', '', false, true);
     return $modx;
 }
开发者ID:kondakovdm,项目名称:fastuploadtv,代码行数:11,代码来源:build.tools.php

示例4: endDebug

 /**
  * End the debug trail
  */
 public function endDebug()
 {
     if ($this->modx->getOption('debug', $this->config, false)) {
         $mtime = microtime();
         $mtime = explode(" ", $mtime);
         $mtime = $mtime[1] + $mtime[0];
         $tend = $mtime;
         $totalTime = $tend - $this->debugTimeStart;
         $totalTime = sprintf("%2.4f s", $totalTime);
         $this->modx->log(modX::LOG_LEVEL_DEBUG, "\n<br />Execution time: {$totalTime}\n<br />");
         $this->modx->setLogLevel($this->oldLogLevel);
         $this->modx->setLogTarget($this->oldLogTarget);
     }
 }
开发者ID:Webbiker,项目名称:Klompenschuurtje,代码行数:17,代码来源:phpthumbof.class.php

示例5: _getConnection

 /**
  * Grab a persistent instance of the xPDO class to share connection data
  * across multiple tests and test suites.
  * 
  * @param array $options An array of configuration parameters.
  * @return xPDO An xPDO object instance.
  */
 public static function _getConnection($options = array())
 {
     $modx = FiTestHarness::$modx;
     if (is_object($modx)) {
         if (!$modx->request) {
             $modx->getRequest();
         }
         if (!$modx->error) {
             $modx->request->loadErrorHandler();
         }
         $modx->error->reset();
         FiTestHarness::$modx = $modx;
         return FiTestHarness::$modx;
     }
     /* include config.core.php */
     $properties = array();
     $config = array();
     include strtr(realpath(dirname(__FILE__)) . '/config.inc.php', '\\', '/');
     require_once $config['modx_base_path'] . 'config.core.php';
     require_once MODX_CORE_PATH . 'config/' . MODX_CONFIG_KEY . '.inc.php';
     require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
     include_once strtr(realpath(dirname(__FILE__)) . '/properties.inc.php', '\\', '/');
     if (!defined('MODX_REQP')) {
         define('MODX_REQP', false);
     }
     $modx = new modX(null, $properties);
     $ctx = !empty($options['ctx']) ? $options['ctx'] : 'web';
     $modx->initialize($ctx);
     $debug = !empty($options['debug']);
     $modx->setDebug($debug);
     if (!empty($properties['logTarget'])) {
         $modx->setLogTarget($properties['logTarget']);
     }
     if (!empty($properties['logLevel'])) {
         $modx->setLogLevel($properties['logLevel']);
     }
     $modx->user = $modx->newObject('modUser');
     $modx->user->set('id', $modx->getOption('modx.test.user.id', null, 1));
     $modx->user->set('username', $modx->getOption('modx.test.user.username', null, 'test'));
     $modx->getRequest();
     $modx->getParser();
     $modx->request->loadErrorHandler();
     @error_reporting(E_ALL);
     @ini_set('display_errors', true);
     FiTestHarness::$modx = $modx;
     return $modx;
 }
开发者ID:raadhuis,项目名称:modx-basic,代码行数:54,代码来源:FiTestHarness.php

示例6: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before each test is executed.
  */
 protected function setUp()
 {
     // echo "\n---------------- SETUP --------------------";
     require_once dirname(__FILE__) . '/build.config.php';
     require_once dirname(__FILE__) . '/uthelpers.class.php';
     require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
     $this->utHelpers = new UtHelpers();
     $modx = new modX();
     $modx->initialize('mgr');
     $modx->getService('error', 'error.modError', '', '');
     $modx->getService('lexicon', 'modLexicon');
     $modx->getRequest();
     $homeId = $modx->getOption('site_start');
     $homeResource = $modx->getObject('modResource', $homeId);
     if ($homeResource instanceof modResource) {
         $modx->resource = $homeResource;
     } else {
         echo "\nNo Resource\n";
     }
     $modx->setLogLevel(modX::LOG_LEVEL_ERROR);
     $modx->setLogTarget('ECHO');
     require_once MODX_ASSETS_PATH . 'mycomponents/mycomponent/core/components/mycomponent/model/mycomponent/mycomponentproject.class.php';
     /* @var $categoryObj modCategory */
     $this->mc = new MyComponentProject($modx);
     $this->mc->init(array(), 'unittest');
     $this->modx =& $modx;
     $this->category = key($this->mc->props['categories']);
     $this->packageNameLower = $this->mc->packageNameLower;
     if ($this->category != 'UnitTest') {
         session_write_close();
         die('wrong config - NEVER run unit test on a real project!');
     }
     $category = $this->modx->getCollection('modCategory', array('category' => 'UnitTest'));
     foreach ($category as $categoryObj) {
         $categoryObj->remove();
     }
     $namespace = $this->modx->getObject('modNamespace', array('name' => 'unittest'));
     if ($namespace) {
         $namespace->remove();
     }
     $this->utHelpers->rrmdir($this->mc->targetRoot);
     $this->utHelpers->removeElements($this->modx, $this->mc);
     $this->utHelpers->removeResources($this->modx, $this->mc);
     //$this->mc->createCategory();
     //$this->mc->createNamespace();
 }
开发者ID:mooror,项目名称:MyComponent,代码行数:50,代码来源:bootstraptest.php

示例7: initDebug

 /**
  * Load debugging settings
  */
 public function initDebug()
 {
     if ($this->modx->getOption('debug', $this->config, false)) {
         error_reporting(E_ALL);
         ini_set('display_errors', true);
         $this->modx->setLogTarget('HTML');
         $this->modx->setLogLevel(modX::LOG_LEVEL_ERROR);
         $debugUser = $this->config['debugUser'] == '' ? $this->modx->user->get('username') : 'anonymous';
         $user = $this->modx->getObject('modUser', array('username' => $debugUser));
         if ($user == null) {
             $this->modx->user->set('id', $this->modx->getOption('debugUserId', $this->config, 1));
             $this->modx->user->set('username', $debugUser);
         } else {
             $this->modx->user = $user;
         }
     }
 }
开发者ID:raadhuis,项目名称:modx-basic,代码行数:20,代码来源:quip.class.php

示例8: dirname

<?php

if (!defined('MODX_BASE_PATH')) {
    require 'build.config.php';
}
/* define sources */
$root = dirname(dirname(__FILE__)) . '/';
$sources = array('root' => $root, 'build' => $root . '_build/', 'source_core' => $root . 'core/components/' . PKG_NAME_LOWER, 'model' => $root . 'core/components/' . PKG_NAME_LOWER . '/model/', 'schema' => $root . 'core/components/' . PKG_NAME_LOWER . '/model/schema/', 'xml' => $root . 'core/components/' . PKG_NAME_LOWER . '/model/schema/' . PKG_NAME_LOWER . '.mysql.schema.xml');
unset($root);
require MODX_CORE_PATH . 'model/modx/modx.class.php';
require $sources['build'] . '/includes/functions.php';
$modx = new modX();
$modx->initialize('mgr');
$modx->getService('error', 'error.modError');
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
$modx->setLogTarget('ECHO');
$modx->loadClass('transport.modPackageBuilder', '', false, true);
if (!XPDO_CLI_MODE) {
    echo '<pre>';
}
/** @var xPDOManager $manager */
$manager = $modx->getManager();
/** @var xPDOGenerator $generator */
$generator = $manager->getGenerator();
// Remove old model
rrmdir($sources['model'] . PKG_NAME_LOWER . '/mysql');
// Generate a new one
$generator->parseSchema($sources['xml'], $sources['model']);
$modx->log(modX::LOG_LEVEL_INFO, 'Model generated.');
if (!XPDO_CLI_MODE) {
    echo '</pre>';
开发者ID:bendasvadim,项目名称:VoteForms,代码行数:31,代码来源:build.model.php

示例9: dirname

$tstart = $mtime;
set_time_limit(0);
define('MODX_BASE_URL', 'http://localhost/addons/');
define('MODX_MANAGER_URL', 'http://localhost/addons/manager/');
define('MODX_ASSETS_URL', 'http://localhost/addons/assets/');
define('MODX_CONNECTORS_URL', 'http://localhost/addons/connectors/');
/* define sources */
$root = dirname(dirname(__FILE__)) . '/';
$sources = array('root' => $root, 'build' => $root . '_build/', 'source_core' => $root . 'core/components/newspublisher', 'source_assets' => $root . 'assets/components/newspublisher', 'data' => $root . '_build/data/', 'docs' => $root . 'core/components/newspublisher/docs/', 'resolvers' => $root . '_build/resolvers/');
unset($root);
/* instantiate MODx */
require_once $sources['build'] . 'build.config.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('mgr');
$modx->setLogLevel(xPDO::LOG_LEVEL_INFO);
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
/* set package info */
define('PKG_NAME', 'newspublisher');
define('PKG_VERSION', '2.1.0');
define('PKG_RELEASE', 'pl');
/* load builder */
$modx->loadClass('transport.modPackageBuilder', '', false, true);
$builder = new modPackageBuilder($modx);
$builder->createPackage(PKG_NAME, PKG_VERSION, PKG_RELEASE);
$builder->registerNamespace('newspublisher', false, true, '{core_path}components/newspublisher/');
/* create snippet objects */
/* create category */
/* @var $category modCategory */
$category = $modx->newObject('modCategory');
$category->set('id', 1);
开发者ID:kctech,项目名称:newspublisher,代码行数:31,代码来源:build.transport.php

示例10: modX

 */
/**
 * @package modx
 * @subpackage connectors
 */
@include(dirname(__FILE__) . '/config.core.php');
if (!defined('MODX_CORE_PATH')) define('MODX_CORE_PATH', dirname(dirname(__FILE__)) . '/core/');
if (!include_once(MODX_CORE_PATH . 'model/modx/modx.class.php')) die();

/* instantiate the modX class with the appropriate configuration */
if (empty($options) || !is_array($options)) $options = array();
$modx= new modX('', $options);

/* set debugging/logging options */
//$modx->setDebug(E_ALL & ~E_NOTICE);
$modx->setLogLevel(modX::LOG_LEVEL_ERROR);
//$modx->setLogTarget('FILE');

/* initialize the proper context */
$ctx = isset($_REQUEST['ctx']) && !empty($_REQUEST['ctx']) ? $_REQUEST['ctx'] : 'mgr';
$modx->initialize($ctx);

if (defined('MODX_REQP') && MODX_REQP === false) {
} else if (!$modx->context->checkPolicy('load')) {
    @session_write_close();
    die();
}

if ($ctx == 'mgr') {
    $ml = $modx->getOption('manager_language',null,'en');
    if ($ml != 'en') {
开发者ID:ncrossland,项目名称:revolution,代码行数:31,代码来源:index.php

示例11: dirname

$tstart = $mtime;
// get rid of time limit
set_time_limit(0);
// override with your own defines here (see build.config.sample.php)
@(require_once dirname(__FILE__) . '/build.config.php');
if (!defined('MODX_CORE_PATH')) {
    define('MODX_CORE_PATH', dirname(dirname(__FILE__)) . '/core/');
}
if (!defined('MODX_CONFIG_KEY')) {
    define('MODX_CONFIG_KEY', 'config');
}
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('mgr');
$cacheManager = $modx->getCacheManager();
$modx->setLogLevel(xPDO::LOG_LEVEL_ERROR);
$modx->setLogTarget('ECHO');
// Get all Actions
$content = "<?php\n";
$query = $modx->newQuery('modAction');
$query->where(array('namespace' => 'core'));
$query->sortby('id');
$collection = $modx->getCollection('modAction', $query);
foreach ($collection as $key => $c) {
    $content .= $cacheManager->generateObject($c, "collection['{$key}']", false, false, 'xpdo');
}
$cacheManager->writeFile(dirname(__FILE__) . '/data/transport.core.actions.php', $content);
unset($content, $collection, $key, $c);
// Get all Menus
$content = "<?php\n";
$query = $modx->newQuery('modMenu');
开发者ID:JoeBlow,项目名称:revolution,代码行数:31,代码来源:transport.data.php

示例12: explode

$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
$tstart = $mtime;
set_time_limit(0);
/* Instantiate MODx -- if this require fails, check your
 * _build/build.config.php file
 */
require_once dirname(dirname(__FILE__)) . '/_build/build.config.php';
if (!isset($modx) || !$modx instanceof modX) {
    require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
    $modx = new modX();
    $modx->initialize('mgr');
    $modx->getService('error', 'error.modError', '', '');
}
$modx->lexicon->load('mycomponent:default');
$modx->setLogLevel(xPDO::LOG_LEVEL_INFO);
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
if (!defined('MODX_CORE_PATH')) {
    session_write_close();
    die('build.config.php is not correct');
}
@(include dirname(__FILE__) . '/config/current.project.php');
if (!$currentProject) {
    session_write_close();
    die('Could not get current project');
}
$helper = new BuildHelper($modx);
$modx->lexicon->load('mycomponent:default');
$props = $helper->getProps(dirname(__FILE__) . '/config/' . $currentProject . '.config.php');
if (!is_array($props)) {
    session_write_close();
开发者ID:sergant210,项目名称:MessageManager,代码行数:31,代码来源:build.transport.php

示例13: array

 /**
  * Create or grab a reference to a static xPDO/modX instance.
  *
  * The instances can be reused by multiple tests and test suites.
  *
  * @param string $class A fixture class to get an instance of.
  * @param string $name A unique identifier for the fixture.
  * @param boolean $new
  * @param array $options An array of configuration options for the fixture.
  * @return object|null An instance of the specified fixture class or null on failure.
  */
 public static function &getFixture($class, $name, $new = false, array $options = array())
 {
     if (!$new && array_key_exists($name, self::$fixtures) && self::$fixtures[$name] instanceof $class) {
         $fixture =& self::$fixtures[$name];
     } else {
         $properties = array();
         include_once dirname(dirname(dirname(__FILE__))) . '/core/model/modx/modx.class.php';
         include dirname(__FILE__) . '/properties.inc.php';
         self::$properties = $properties;
         if (array_key_exists('debug', self::$properties)) {
             self::$debug = (bool) self::$properties['debug'];
         }
         $fixture = null;
         $driver = self::$properties['xpdo_driver'];
         switch ($class) {
             case 'modX':
                 if (!defined('MODX_REQP')) {
                     define('MODX_REQP', false);
                 }
                 if (!defined('MODX_CONFIG_KEY')) {
                     define('MODX_CONFIG_KEY', array_key_exists('config_key', self::$properties) ? self::$properties['config_key'] : 'test');
                 }
                 $fixture = new modX(null, self::$properties["{$driver}_array_options"]);
                 if ($fixture instanceof modX) {
                     $logLevel = array_key_exists('logLevel', self::$properties) ? self::$properties['logLevel'] : modX::LOG_LEVEL_WARN;
                     $logTarget = array_key_exists('logTarget', self::$properties) ? self::$properties['logTarget'] : (XPDO_CLI_MODE ? 'ECHO' : 'HTML');
                     $fixture->setLogLevel($logLevel);
                     $fixture->setLogTarget($logTarget);
                     if (!empty(self::$debug)) {
                         $fixture->setDebug(self::$properties['debug']);
                     }
                     $fixture->initialize(self::$properties['context']);
                     $fixture->user = $fixture->newObject('modUser');
                     $fixture->user->set('id', $fixture->getOption('modx.test.user.id', null, 1));
                     $fixture->user->set('username', $fixture->getOption('modx.test.user.username', null, 'test'));
                     $fixture->getRequest();
                     $fixture->getParser();
                     $fixture->request->loadErrorHandler();
                 }
                 break;
             case 'xPDO':
                 $fixture = new xPDO(self::$properties["{$driver}_string_dsn_test"], self::$properties["{$driver}_string_username"], self::$properties["{$driver}_string_password"], self::$properties["{$driver}_array_options"], self::$properties["{$driver}_array_driverOptions"]);
                 if ($fixture instanceof xPDO) {
                     $logLevel = array_key_exists('logLevel', self::$properties) ? self::$properties['logLevel'] : xPDO::LOG_LEVEL_WARN;
                     $logTarget = array_key_exists('logTarget', self::$properties) ? self::$properties['logTarget'] : (XPDO_CLI_MODE ? 'ECHO' : 'HTML');
                     $fixture->setLogLevel($logLevel);
                     $fixture->setLogTarget($logTarget);
                     if (!empty(self::$debug)) {
                         $fixture->setDebug(self::$properties['debug']);
                     }
                 }
                 break;
             default:
                 $fixture = new $class($options);
                 break;
         }
         if ($fixture !== null && $fixture instanceof $class) {
             self::$fixtures[$name] = $fixture;
         } else {
             die("Error setting fixture {$name} of expected class {$class}.");
         }
     }
     return $fixture;
 }
开发者ID:rosstimson,项目名称:revolution,代码行数:75,代码来源:MODxTestHarness.php

示例14: die

        die('Failed to locate config.core.php');
    }
    $docroot = dirname($docroot);
}
if (!file_exists($docroot . '/config.core.php')) {
    die('Failed to locate config.core.php');
}
include_once $docroot . '/config.core.php';
if (!defined('MODX_API_MODE')) {
    define('MODX_API_MODE', false);
}
include_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('mgr');
$log_level = $modx->getOption('log_level', $_GET, $modx->getOption('log_level'));
$old_level = $modx->setLogLevel($log_level);
$function = $modx->getOption('f', $_GET, 'help');
unset($_GET['f']);
$args = array_merge($_POST, $_GET);
// skip the cookies, more explicit than $_REQUEST
$modx->log(MODX_LOG_LEVEL_DEBUG, print_r($args, true), '', '', __FILE__, __LINE__);
$core_path = $modx->getOption('survey.core_path', '', MODX_CORE_PATH);
require_once $core_path . 'components/survey/controllers/surveymgrcontroller.class.php';
$Controller = new surveyMgrController($modx);
$results = $Controller->{$function}($args);
if ($results === false) {
    header('HTTP/1.0 401 Unauthorized');
    print 'Operation not allowed.';
    exit;
}
$modx->setLogLevel($old_level);
开发者ID:rIDclickup,项目名称:survey,代码行数:31,代码来源:connector.php

示例15: array

 $vaporOptions = array('excludeExtraTablePrefix' => array(), 'excludeExtraTables' => array(), 'excludeFiles' => array(MODX_BASE_PATH . 'vapor', MODX_BASE_PATH . 'phpmyadmin'));
 if (is_readable(VAPOR_DIR . 'config.php')) {
     $vaporConfigOptions = @(include VAPOR_DIR . 'config.php');
     if (is_array($vaporConfigOptions)) {
         $vaporOptions = array_merge($vaporOptions, $vaporConfigOptions);
     }
 }
 include dirname(dirname(__FILE__)) . '/config.core.php';
 include MODX_CORE_PATH . 'model/modx/modx.class.php';
 if (!XPDO_CLI_MODE && !ini_get('safe_mode')) {
     set_time_limit(0);
 }
 $options = array('log_level' => xPDO::LOG_LEVEL_INFO, 'log_target' => array('target' => 'FILE', 'options' => array('filename' => 'vapor-' . strftime('%Y%m%dT%H%M%S', $startTime) . '.log')), xPDO::OPT_CACHE_DB => false, xPDO::OPT_SETUP => true);
 $modx = new modX('', $options);
 $modx->setLogTarget($options['log_target']);
 $modx->setLogLevel($options['log_level']);
 $modx->setOption(xPDO::OPT_CACHE_DB, false);
 $modx->setOption(xPDO::OPT_SETUP, true);
 $modx->setDebug(-1);
 $modx->startTime = $startTime;
 $modx->getVersionData();
 $modxVersion = $modx->version['full_version'];
 if (version_compare($modxVersion, '2.2.1-pl', '>=')) {
     $modx->initialize('mgr', $options);
 } else {
     $modx->initialize('mgr');
 }
 if (!$modx->hasPermission('Vapor')) {
     die('Access denied');
 }
 $modx->setLogTarget($options['log_target']);
开发者ID:Tramp1357,项目名称:atlasorg,代码行数:31,代码来源:vapor.php


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