You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.5KB

  1. <?php
  2. /* @var $panel yii\debug\panels\LogPanel */
  3. /* @var $data array */
  4. use yii\log\Target;
  5. use yii\log\Logger;
  6. ?>
  7. <?php
  8. $titles = ['all' => Yii::$app->i18n->format('Logged {n,plural,=1{1 message} other{# messages}}', ['n' => count($data['messages'])], 'en-US')];
  9. $errorCount = count(Target::filterMessages($data['messages'], Logger::LEVEL_ERROR));
  10. $warningCount = count(Target::filterMessages($data['messages'], Logger::LEVEL_WARNING));
  11. if ($errorCount) {
  12. $titles['errors'] = Yii::$app->i18n->format('{n,plural,=1{1 error} other{# errors}}', ['n' => $errorCount], 'en-US');
  13. }
  14. if ($warningCount) {
  15. $titles['warnings'] = Yii::$app->i18n->format('{n,plural,=1{1 warning} other{# warnings}}', ['n' => $warningCount], 'en-US');;
  16. }
  17. ?>
  18. <div class="yii-debug-toolbar__block">
  19. <a href="<?= $panel->getUrl() ?>" title="<?= implode(',&nbsp;', $titles) ?>">Log
  20. <span class="yii-debug-toolbar__label"><?= count($data['messages']) ?></span>
  21. </a>
  22. <?php if ($errorCount): ?>
  23. <a href="<?= $panel->getUrl(['Log[level]' => Logger::LEVEL_ERROR])?>" title="<?= $titles['errors'] ?>">
  24. <span class="yii-debug-toolbar__label yii-debug-toolbar__label_important"><?= $errorCount ?></span>
  25. </a>
  26. <?php endif; ?>
  27. <?php if ($warningCount): ?>
  28. <a href="<?= $panel->getUrl(['Log[level]' => Logger::LEVEL_WARNING])?>" title="<?= $titles['warnings'] ?>">
  29. <span class="yii-debug-toolbar__label yii-debug-toolbar__label_warning"><?= $warningCount ?></span>
  30. </a>
  31. <?php endif; ?>
  32. </div>