123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <?php
- /**
- * YiiDebugToolbarPanelLogging class file.
- *
- * @author Sergey Malyshev <malyshev.php@gmail.com>
- */
- /**
- * YiiDebugToolbarPanelLogging represents an ...
- *
- * Description of YiiDebugToolbarPanelLogging
- *
- * @author Sergey Malyshev <malyshev.php@gmail.com>
- * @author Igor Golovanov <igor.golovanov@gmail.com>
- * @version $Id$
- * @package YiiDebugToolbar
- * @since 1.1.7
- */
- class YiiDebugToolbarPanelLogging extends YiiDebugToolbarPanel
- {
- public $i = 'j';
-
- /**
- * Message count.
- *
- * @var integer
- */
- private $_countMessages;
- /**
- * Logs.
- *
- * @var array
- */
- private $_logs;
- /**
- * {@inheritdoc}
- */
- public function getMenuTitle()
- {
- return YiiDebug::t('Logging');
- }
- /**
- * {@inheritdoc}
- */
- public function getMenuSubTitle()
- {
- return $this->countMessages;
- }
- /**
- * {@inheritdoc}
- */
- public function getTitle()
- {
- return YiiDebug::t('Log Messages');
- }
- /**
- * Get logs.
- *
- * @return array
- */
- public function getLogs()
- {
- if (null === $this->_logs)
- {
- $this->_logs = $this->filterLogs();
- }
- return $this->_logs;
- }
- /**
- * Get count of messages.
- *
- * @return integer
- */
- public function getCountMessages()
- {
- if (null === $this->_countMessages)
- {
- $this->_countMessages = count($this->logs);
- }
- return $this->_countMessages;
- }
- /**
- * {@inheritdoc}
- */
- public function run()
- {
- $this->render('logging', array(
- 'logs' => $this->logs
- ));
- }
- /**
- * Get filter logs.
- *
- * @return array
- */
- protected function filterLogs()
- {
- $logs = array();
- foreach ($this->owner->getLogs() as $entry)
- {
- if (CLogger::LEVEL_PROFILE !== $entry[1] && false === strpos($entry[2], 'system.db.CDbCommand'))
- {
- $logs[] = $entry;
- }
- }
- return $logs;
- }
- }
|