本文整理汇总了PHP中LoggerLevel::getLevelAll方法的典型用法代码示例。如果您正苦于以下问题:PHP LoggerLevel::getLevelAll方法的具体用法?PHP LoggerLevel::getLevelAll怎么用?PHP LoggerLevel::getLevelAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LoggerLevel
的用法示例。
在下文中一共展示了LoggerLevel::getLevelAll方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* @param integer $level initial log level
*/
public function __construct($level = null)
{
parent::__construct('root');
if ($level == null) {
$level = LoggerLevel::getLevelAll();
}
$this->setLevel($level);
}
示例2: LoggerRoot
/**
* Constructor
*
* @param integer $level initial log level
*/
function LoggerRoot($level = null)
{
$this->Logger($this->name);
if ($level == null) {
$level = LoggerLevel::getLevelAll();
}
$this->setLevel($level);
}
示例3: testInitialSetup
public function testInitialSetup()
{
$root = new LoggerRoot();
self::assertSame(LoggerLevel::getLevelAll(), $root->getLevel());
self::assertSame(LoggerLevel::getLevelAll(), $root->getEffectiveLevel());
self::assertSame('root', $root->getName());
self::assertNull($root->getParent());
}
示例4: testResetConfiguration
public function testResetConfiguration()
{
$root = $this->hierarchy->getRootLogger();
$appender = new LoggerAppenderConsole('A1');
$root->addAppender($appender);
$logger = $this->hierarchy->getLogger('test');
self::assertEquals(1, count($this->hierarchy->getCurrentLoggers()));
$this->hierarchy->resetConfiguration();
self::assertEquals(LoggerLevel::getLevelDebug(), $root->getLevel());
self::assertEquals(LoggerLevel::getLevelAll(), $this->hierarchy->getThreshold());
self::assertEquals(1, count($this->hierarchy->getCurrentLoggers()));
foreach ($this->hierarchy->getCurrentLoggers() as $logger) {
self::assertNull($logger->getLevel());
self::assertTrue($logger->getAdditivity());
self::assertEquals(0, count($logger->getAllAppenders()), 0);
}
}
示例5: resetConfiguration
/**
* Reset all values contained in this hierarchy instance to their
* default.
*
* This removes all appenders from all loggers, sets
* the level of all non-root loggers to <i>null</i>,
* sets their additivity flag to <i>true</i> and sets the level
* of the root logger to {@link LOGGER_LEVEL_DEBUG}.
*
* <p>Existing loggers are not removed. They are just reset.
*
* <p>This method should be used sparingly and with care as it will
* block all logging until it is completed.</p>
*/
public function resetConfiguration()
{
$root = $this->getRootLogger();
$root->setLevel(LoggerLevel::getLevelDebug());
$this->setThreshold(LoggerLevel::getLevelAll());
$this->shutDown();
foreach ($this->loggers as $logger) {
$logger->setLevel(null);
$logger->setAdditivity(true);
$logger->removeAllAppenders();
}
$this->rendererMap->reset();
LoggerAppenderPool::clear();
}
示例6: testLevelAll
public function testLevelAll()
{
$this->doTestLevel(LoggerLevel::getLevelAll(), LoggerLevel::ALL, 'ALL', 7);
$this->doTestLevel(LoggerLevel::toLevel(LoggerLevel::ALL), LoggerLevel::ALL, 'ALL', 7);
$this->doTestLevel(LoggerLevel::toLevel('ALL'), LoggerLevel::ALL, 'ALL', 7);
}
示例7: doConfigureProperties
/**
* Read configuration options from <b>properties</b>.
*
* @see doConfigure().
* @param array $properties
* @param LoggerHierarchy &$hierarchy
*/
function doConfigureProperties($properties, &$hierarchy)
{
$value = @$properties[LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_LOGGER_DEBUG_KEY];
if (!empty($value)) {
LoggerLog::internalDebugging(LoggerOptionConverter::toBoolean($value, LoggerLog::internalDebugging()));
}
$thresholdStr = @$properties[LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_THRESHOLD_PREFIX];
$hierarchy->setThreshold(LoggerOptionConverter::toLevel($thresholdStr, LoggerLevel::getLevelAll()));
$this->configureRootCategory($properties, $hierarchy);
$this->configureLoggerFactory($properties);
$this->parseCatsAndRenderers($properties, $hierarchy);
LoggerLog::debug("LoggerPropertyConfigurator::doConfigureProperties() Finished configuring.");
return true;
}
示例8: resetConfiguration
/**
* Reset all values contained in this hierarchy instance to their
* default.
*
* This removes all appenders from all categories, sets
* the level of all non-root categories to <i>null</i>,
* sets their additivity flag to <i>true</i> and sets the level
* of the root logger to {@link LOGGER_LEVEL_DEBUG}. Moreover,
* message disabling is set its default "off" value.
*
* <p>Existing categories are not removed. They are just reset.
*
* <p>This method should be used sparingly and with care as it will
* block all logging until it is completed.</p>
*/
function resetConfiguration()
{
$root =& $this->getRootLogger();
$root->setLevel(LoggerLevel::getLevelDebug());
$this->setThreshold(LoggerLevel::getLevelAll());
$this->shutDown();
$loggers =& $this->getCurrentLoggers();
$enumLoggers = sizeof($loggers);
for ($i = 0; $i < $enumLoggers; $i++) {
$loggers[$i]->setLevel(null);
$loggers[$i]->setAdditivity(true);
$loggers[$i]->setResourceBundle(null);
}
$this->rendererMap->clear();
}
示例9: resetConfiguration
/**
* Reset all values contained in this hierarchy instance to their
* default.
*
* This removes all appenders from all categories, sets
* the level of all non-root categories to <i>null</i>,
* sets their additivity flag to <i>true</i> and sets the level
* of the root logger to {@link LOGGER_LEVEL_DEBUG}. Moreover,
* message disabling is set its default "off" value.
*
* <p>Existing categories are not removed. They are just reset.
*
* <p>This method should be used sparingly and with care as it will
* block all logging until it is completed.</p>
*/
public function resetConfiguration()
{
$root = $this->getRootLogger();
$root->setLevel(LoggerLevel::getLevelDebug());
$this->setThreshold(LoggerLevel::getLevelAll());
$this->shutDown();
$loggers = $this->getCurrentLoggers();
$enumLoggers = count($loggers);
for ($i = 0; $i < $enumLoggers; $i++) {
$loggers[$i]->setLevel(null);
$loggers[$i]->setAdditivity(true);
$loggers[$i]->removeAllAppenders();
}
$this->rendererMap->clear();
}
示例10: doConfigureProperties
/**
* Read configuration options from <b>properties</b>.
*
* @see doConfigure().
* @param array $properties
* @param LoggerHierarchy $hierarchy
*/
private function doConfigureProperties($properties, LoggerHierarchy $hierarchy)
{
$thresholdStr = @$properties[self::THRESHOLD_PREFIX];
$hierarchy->setThreshold(LoggerOptionConverter::toLevel($thresholdStr, LoggerLevel::getLevelAll()));
$this->configureRootCategory($properties, $hierarchy);
$this->parseCatsAndRenderers($properties, $hierarchy);
return true;
}
示例11: switch
/**
* Convert the string passed as argument to a level. If the
* conversion fails, then this method returns a DEBUG Level.
*
* @param mixed $arg
* @param LoggerLevel $default
* @static
*/
function &toLevel($arg, $defaultLevel = null)
{
if ($defaultLevel === null) {
return LoggerLevel::toLevel($arg, LoggerLevel::getLevelDebug());
} else {
if (is_int($arg)) {
switch ($arg) {
case LOG4PHP_LEVEL_ALL_INT:
return LoggerLevel::getLevelAll();
case LOG4PHP_LEVEL_DEBUG_INT:
return LoggerLevel::getLevelDebug();
case LOG4PHP_LEVEL_INFO_INT:
return LoggerLevel::getLevelInfo();
case LOG4PHP_LEVEL_WARN_INT:
return LoggerLevel::getLevelWarn();
case LOG4PHP_LEVEL_ERROR_INT:
return LoggerLevel::getLevelError();
case LOG4PHP_LEVEL_FATAL_INT:
return LoggerLevel::getLevelFatal();
case LOG4PHP_LEVEL_OFF_INT:
return LoggerLevel::getLevelOff();
default:
return $defaultLevel;
}
} else {
switch (strtoupper($arg)) {
case 'ALL':
return LoggerLevel::getLevelAll();
case 'DEBUG':
return LoggerLevel::getLevelDebug();
case 'INFO':
return LoggerLevel::getLevelInfo();
case 'WARN':
return LoggerLevel::getLevelWarn();
case 'ERROR':
return LoggerLevel::getLevelError();
case 'FATAL':
return LoggerLevel::getLevelFatal();
case 'OFF':
return LoggerLevel::getLevelOff();
default:
return $defaultLevel;
}
}
}
}
示例12: _convertESAPILeveltoLoggerLevel
/**
* Helper function.
*
* Converts a logging level.
*
* Converts the ESAPI logging level (a number) or level defined in the ESAPI
* properties file (a string) into the levels used by Apache's log4php. Note
* that log4php does not define a TRACE level and so TRACE is simply an
* alias of ALL which log4php does define.
*
* @param int $level The logging level to convert.
*
* @throws Exception if the supplied level doesn't match a level currently
* defined.
*
* @return int The log4php logging Level equivalent.
*/
private static function _convertESAPILeveltoLoggerLevel($level)
{
if (is_string($level)) {
switch (strtoupper($level)) {
case 'ALL':
/* Same as TRACE */
/* Same as TRACE */
case 'TRACE':
return LoggerLevel::getLevelAll();
case 'DEBUG':
return LoggerLevel::getLevelDebug();
case 'INFO':
return LoggerLevel::getLevelInfo();
case 'WARN':
return LoggerLevel::getLevelWarn();
case 'ERROR':
return LoggerLevel::getLevelError();
case 'FATAL':
return LoggerLevel::getLevelFatal();
case 'OFF':
return LoggerLevel::getLevelOff();
default:
throw new Exception("Invalid logging level Value was: {$level}");
}
} else {
switch ($level) {
case Auditor::ALL:
/* Same as TRACE */
/* Same as TRACE */
case Auditor::TRACE:
return LoggerLevel::getLevelAll();
case Auditor::DEBUG:
return LoggerLevel::getLevelDebug();
case Auditor::INFO:
return LoggerLevel::getLevelInfo();
case Auditor::WARNING:
return LoggerLevel::getLevelWarn();
case Auditor::ERROR:
return LoggerLevel::getLevelError();
case Auditor::FATAL:
return LoggerLevel::getLevelFatal();
case Auditor::OFF:
return LoggerLevel::getLevelOff();
default:
throw new Exception("Invalid logging level Value was: {$level}");
}
}
}
示例13: doConfigure
private function doConfigure($url, LoggerHierarchy $hierarchy)
{
$config = (require $url);
// set threshold
if (isset($config['threshold'])) {
$hierarchy->setThreshold(LoggerOptionConverter::toLevel($config['threshold'], LoggerLevel::getLevelAll()));
}
// parse and create appenders
if (isset($config['appenders'])) {
foreach ($config['appenders'] as $appenderName => $appenderProperties) {
$appender = LoggerAppenderPool::getAppenderFromPool($appenderName, $appenderProperties['class']);
if ($appender->requiresLayout()) {
if (isset($appenderProperties['layout'])) {
if (isset($appenderProperties['layout']['class']) and !empty($appenderProperties['layout']['class'])) {
$layoutClass = $appenderProperties['layout']['class'];
} else {
$layoutClass = 'LoggerLayoutSimple';
}
$layout = LoggerReflectionUtils::createObject($layoutClass);
if ($layout === null) {
$layout = LoggerReflectionUtils::createObject('LoggerLayoutSimple');
}
if ($layout instanceof LoggerLayoutPattern) {
$layout->setConversionPattern($appenderProperties['layout']['conversionPattern']);
}
$appender->setLayout($layout);
} else {
// TODO: throw exception?
}
}
}
}
// parse and create root logger
if (isset($config['rootLogger'])) {
$rootLogger = $hierarchy->getRootLogger();
if (isset($config['rootLogger']['level'])) {
$rootLogger->setLevel(LoggerOptionConverter::toLevel($config['rootLogger']['level'], LoggerLevel::getLevelDebug()));
if (isset($config['rootLogger']['appenders'])) {
foreach ($config['rootLogger']['appenders'] as $appenderName) {
$appender = LoggerAppenderPool::getAppenderFromPool($appenderName);
if ($appender !== null) {
$rootLogger->addAppender($appender);
}
}
}
}
}
// parse and create loggers
if (isset($config['loggers'])) {
foreach ($config['loggers'] as $loggerName => $loggerProperties) {
if (is_string($loggerName)) {
$logger = $hierarchy->getLogger($loggerName);
if (isset($loggerProperties['level'])) {
$logger->setLevel(LoggerOptionConverter::toLevel($loggerProperties['level'], LoggerLevel::getLevelDebug()));
if (isset($loggerProperties['appenders'])) {
foreach ($loggerProperties['appenders'] as $appenderName) {
$appender = LoggerAppenderPool::getAppenderFromPool($appenderName);
if ($appender !== null) {
$logger->addAppender($appender);
}
}
}
}
} else {
// TODO: throw exception
}
}
}
return true;
}
示例14: doConfigure
private function doConfigure($url, LoggerHierarchy $hierarchy)
{
if (!is_array($url)) {
$config = (require $url);
} else {
$config = $url;
}
// set threshold
if (isset($config['threshold'])) {
$hierarchy->setThreshold(LoggerOptionConverter::toLevel($config['threshold'], LoggerLevel::getLevelAll()));
}
// add renderes
if (isset($config['renderers'])) {
foreach ($config['renderers'] as $renderedClass => $renderingClass) {
$hierarchy->getRendererMap()->addRenderer($renderedClass, $renderingClass);
}
}
// parse and create appenders
if (isset($config['appenders'])) {
foreach ($config['appenders'] as $appenderName => $appenderProperties) {
$appender = LoggerAppenderPool::getAppenderFromPool($appenderName, $appenderProperties['class']);
// unset so that the property wont be drawn up again
unset($appenderProperties['class']);
if ($appender->requiresLayout()) {
if (isset($appenderProperties['layout'])) {
if (isset($appenderProperties['layout']['class']) and !empty($appenderProperties['layout']['class'])) {
$layoutClass = $appenderProperties['layout']['class'];
} else {
$layoutClass = 'LoggerLayoutSimple';
}
$layout = LoggerReflectionUtils::createObject($layoutClass);
if ($layout === null) {
$layout = LoggerReflectionUtils::createObject('LoggerLayoutSimple');
}
if (isset($appenderProperties['file']) && method_exists($appender, 'setFileName')) {
$appender->setFile($appenderProperties['file'], true);
}
if ($layout instanceof LoggerLayoutPattern) {
$layout->setConversionPattern($appenderProperties['layout']['conversionPattern']);
}
$appender->setLayout($layout);
// unset so that the property wont be drawn up again
unset($appenderProperties['layout']);
} else {
// TODO: throw exception?
}
}
// set remaining properties and activate appender
$setter = new LoggerReflectionUtils($appender);
foreach ($appenderProperties as $key => $val) {
$setter->setProperty($key, $val);
}
$setter->activate();
}
}
// parse and create root logger
if (isset($config['rootLogger'])) {
$rootLogger = $hierarchy->getRootLogger();
if (isset($config['rootLogger']['level'])) {
$rootLogger->setLevel(LoggerOptionConverter::toLevel($config['rootLogger']['level'], LoggerLevel::getLevelDebug()));
if (isset($config['rootLogger']['appenders'])) {
foreach ($config['rootLogger']['appenders'] as $appenderName) {
$appender = LoggerAppenderPool::getAppenderFromPool($appenderName);
if ($appender !== null) {
$rootLogger->addAppender($appender);
}
}
}
}
}
// parse and create loggers
if (isset($config['loggers'])) {
foreach ($config['loggers'] as $loggerName => $loggerProperties) {
if (is_string($loggerName)) {
$logger = $hierarchy->getLogger($loggerName);
if (isset($loggerProperties['level'])) {
$logger->setLevel(LoggerOptionConverter::toLevel($loggerProperties['level'], LoggerLevel::getLevelDebug()));
if (isset($loggerProperties['appenders'])) {
foreach ($loggerProperties['appenders'] as $appenderName) {
$appender = LoggerAppenderPool::getAppenderFromPool($appenderName);
if ($appender !== null) {
$logger->addAppender($appender);
}
}
}
}
} else {
// TODO: throw exception
}
}
}
return true;
}