本文整理汇总了PHP中LoggerLevel::getLevelTrace方法的典型用法代码示例。如果您正苦于以下问题:PHP LoggerLevel::getLevelTrace方法的具体用法?PHP LoggerLevel::getLevelTrace怎么用?PHP LoggerLevel::getLevelTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LoggerLevel
的用法示例。
在下文中一共展示了LoggerLevel::getLevelTrace方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLoggerLevel
public static function getLoggerLevel($level)
{
switch (strtolower($level)) {
case 'trace':
$level = LoggerLevel::getLevelTrace();
break;
case 'debug':
$level = LoggerLevel::getLevelDebug();
break;
case 'warn':
$level = LoggerLevel::getLevelWarn();
break;
case 'error':
$level = LoggerLevel::getLevelError();
break;
case 'fatal':
$level = LoggerLevel::getLevelFatal();
break;
case 'info':
default:
$level = LoggerLevel::getLevelInfo();
break;
}
return $level;
}
示例2: testTraceLayout
public function testTraceLayout()
{
$event = new LoggerLoggingEvent("LoggerLayoutXml2", new Logger("TEST"), LoggerLevel::getLevelTrace(), "testmessage");
$v = $this->formatEvent($event, $this->pattern);
$dt = $this->getEventDateTime($event);
$e = "{$dt} TRACE TEST (LoggerLayoutXml2): testmessage in NA at NA" . PHP_EOL;
self::assertEquals($e, $v);
}
示例3: getAllLevels
/** Returns an array of all existing levels, sorted ascending by severity. */
public static function getAllLevels()
{
return array(LoggerLevel::getLevelTrace(), LoggerLevel::getLevelDebug(), LoggerLevel::getLevelInfo(), LoggerLevel::getLevelWarn(), LoggerLevel::getLevelError(), LoggerLevel::getLevelFatal());
}
示例4: isTraceEnabled
/**
* Check whether this Logger is enabled for the TRACE Level.
* @return boolean
*/
public function isTraceEnabled()
{
return $this->isEnabledFor(LoggerLevel::getLevelTrace());
}
示例5: trace
/**
* Log a message object with the TRACE level.
*
* @param mixed $message message
* @param Exception $throwable Optional throwable information to include
* in the logging event.
*/
public function trace($message, $throwable = null)
{
$this->log(LoggerLevel::getLevelTrace(), $message, $throwable);
}
示例6: trace
/**
* Log a message object with the TRACE level.
*
* @param mixed $message message
* @param mixed $caller caller object or caller string id
*/
public function trace($message, $caller = null)
{
$this->log(LoggerLevel::getLevelTrace(), $message, $caller);
}
示例7: testLevelTrace
public function testLevelTrace()
{
$this->doTestLevel(LoggerLevel::getLevelTrace(), LoggerLevel::TRACE, 'TRACE', LOG_DEBUG);
$this->doTestLevel(LoggerLevel::toLevel(LoggerLevel::TRACE), LoggerLevel::TRACE, 'TRACE', LOG_DEBUG);
$this->doTestLevel(LoggerLevel::toLevel('TRACE'), LoggerLevel::TRACE, 'TRACE', LOG_DEBUG);
}
示例8: append
public function append(LoggerLoggingEvent $event)
{
if ($this->_option == NULL) {
$this->_option = LOG_PID | LOG_CONS;
}
$level = $event->getLevel();
if ($this->layout === null) {
$message = $event->getRenderedMessage();
} else {
$message = $this->layout->format($event);
}
// If the priority of a syslog message can be overridden by a value defined in the properties-file,
// use that value, else use the one that is defined in the code.
if (!$this->dry) {
// Attach the process ID to the message, use the facility defined in the .properties-file
openlog($this->_ident, $this->_option, $this->_facility);
if ($this->_overridePriority) {
syslog($this->_priority, $message);
} else {
if ($level->isGreaterOrEqual(LoggerLevel::getLevelFatal())) {
syslog(LOG_ALERT, $message);
} else {
if ($level->isGreaterOrEqual(LoggerLevel::getLevelError())) {
syslog(LOG_ERR, $message);
} else {
if ($level->isGreaterOrEqual(LoggerLevel::getLevelWarn())) {
syslog(LOG_WARNING, $message);
} else {
if ($level->isGreaterOrEqual(LoggerLevel::getLevelInfo())) {
syslog(LOG_INFO, $message);
} else {
if ($level->isGreaterOrEqual(LoggerLevel::getLevelDebug())) {
syslog(LOG_DEBUG, $message);
} else {
if ($level->isGreaterOrEqual(LoggerLevel::getLevelTrace())) {
syslog(LOG_DEBUG, $message);
// No trace level in syslog
}
}
}
}
}
}
}
closelog();
} else {
echo "DRY MODE OF SYSLOG APPENDER: " . $message;
}
}
示例9: isMemoryLimitReached
/**
*
* @param type $threshold
*/
public static function isMemoryLimitReached($threshold = 0.95)
{
$memory_limit = self::convertToBytes(ini_get('memory_limit'));
$memUsage = memory_get_usage(true);
if ($memUsage >= $memory_limit * $threshold) {
if (self::$logger->isEnabledFor(LoggerLevel::getLevelTrace())) {
self::$logger->trace("memUsage " . Tools::bytesToSize1024($memUsage) . ' >= ' . Tools::bytesToSize1024($memory_limit * $threshold));
}
return TRUE;
}
return FALSE;
}
示例10: sql_query
/**
* Send a MySQL query
* @param string $query An SQL query
* @return resource For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returns a resource on success, or false on error.
* For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, returns true on success or false on error.
*/
public function sql_query($query)
{
if (self::$logger->isDebugEnabled()) {
$start = microtime(true);
}
$result = mysql_query($query, $this->link);
$this->count++;
if (self::$logger->isInfoEnabled()) {
if (NULL == $this->countByQuery) {
$this->countByQuery = array();
}
if (!array_key_exists($query, $this->countByQuery)) {
$this->countByQuery[$query] = 1;
} else {
$this->countByQuery[$query] += 1;
}
if (self::$logger->isEnabledFor(LoggerLevel::getLevelTrace())) {
self::$logger->trace("SQL Query #" . $this->count . " (" . round(microtime(true) - $start, 4) . " sec) : " . $query);
}
}
if (!$result) {
$userid = $_SESSION['userid'];
$e = new Exception('user=' . $userid . ', SQL ALERT: ' . $this->sql_error() . ' : ' . $query);
self::$logger->error('EXCEPTION: ' . $e->getMessage());
self::$logger->error("EXCEPTION stack-trace:\n" . $e->getTraceAsString());
}
return $result;
}
示例11: compare
/**
* uSort compare method
*
*
* @param Comparable $activityA
* @param Comparable $activityB
*
* @return '1' if $activityB > $activityA, -1 if $activityB is lower, 0 if equals
*/
public static function compare(Comparable $activityA, Comparable $activityB)
{
// the oldest activity should be in front of the list
if ($activityA->endTimestamp > $activityB->endTimestamp) {
if (self::$logger->isEnabledFor(LoggerLevel::getLevelTrace())) {
self::$logger->trace("activity.compareTo FALSE (" . date('Y-m-d', $activityA->endTimestamp) . " > " . date('Y-m-d', $activityB->endTimestamp) . ")");
}
return 1;
} else {
if ($activityA->endTimestamp < $activityB->endTimestamp) {
if (self::$logger->isEnabledFor(LoggerLevel::getLevelTrace())) {
self::$logger->trace("activity.compareTo (" . date('Y-m-d', $activityA->endTimestamp) . " < " . date('Y-m-d', $activityB->endTimestamp) . ")");
}
return -1;
}
}
return 0;
}
示例12: testPriorityOverride
public function testPriorityOverride()
{
if (!method_exists('ReflectionProperty', 'setAccessible')) {
$this->markTestSkipped("ReflectionProperty::setAccessible() required to perform this test (available in PHP 5.3.2+).");
}
$appender = new LoggerAppenderSyslog();
$appender->setPriority('EMERG');
$appender->setOverridePriority(true);
$appender->activateOptions();
$levels = array(LoggerLevel::getLevelTrace(), LoggerLevel::getLevelDebug(), LoggerLevel::getLevelInfo(), LoggerLevel::getLevelWarn(), LoggerLevel::getLevelError(), LoggerLevel::getLevelFatal());
$expected = LOG_EMERG;
$method = new ReflectionMethod('LoggerAppenderSyslog', 'getSyslogPriority');
$method->setAccessible(true);
foreach ($levels as $level) {
$actual = $method->invoke($appender, $level);
$this->assertSame($expected, $actual);
}
}
示例13: getHoliday
/**
* Get holiday
* @param int $timestamp
* @return Holiday
*/
private function getHoliday($timestamp)
{
foreach (self::$HolidayList as $h) {
if ($h->timestamp == $timestamp) {
if (self::$logger->isEnabledFor(LoggerLevel::getLevelTrace())) {
self::$logger->trace("Holiday found " . date("d M Y", $h->timestamp) . " - " . date("d M Y", $timestamp) . " {$h->description}");
}
return $h;
}
}
if (self::$logger->isEnabledFor(LoggerLevel::getLevelTrace())) {
self::$logger->trace("No Holiday defined for on: " . date("d M Y", $timestamp) . " {$timestamp}");
}
return NULL;
}
示例14: __construct
/**
* Private constructor to respect the singleton pattern
*/
private function __construct()
{
self::$configVariables = array();
$query = "SELECT * FROM `codev_config_table`";
$result = SqlWrapper::getInstance()->sql_query($query);
if (!$result) {
echo "<span style='color:red'>ERROR: Query FAILED</span>";
exit;
}
while ($row = SqlWrapper::getInstance()->sql_fetch_object($result)) {
if (self::$logger->isDebugEnabled()) {
self::$logger->debug("id={$row->config_id}, val={$row->value}, type={$row->type}");
}
$key = $row->config_id . "_" . $row->user_id . $row->project_id . $row->team_id . $row->servicecontract_id . $row->commandset_id . $row->command_id;
self::$configVariables[$key] = new ConfigItem($row->config_id, $row->value, $row->type);
}
if (self::$logger->isEnabledFor(LoggerLevel::getLevelTrace())) {
self::$logger->trace("Config ready");
}
}