logger.phtml 881 B

123456789101112131415161718192021222324
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. // @codingStandardsIgnoreFile
  7. ?>
  8. <?php /** @var $block \Magento\Ui\Block\Logger */ ?>
  9. <?php if ($block->isLoggingEnabled()): ?>
  10. <script>
  11. window.onerror = function(msg, url, line) {
  12. var key = "<?= /* @escapeNotVerified */ $block->getSessionStorageKey() ?>";
  13. var errors = {};
  14. if (sessionStorage.getItem(key)) {
  15. errors = JSON.parse(sessionStorage.getItem(key));
  16. }
  17. if (!(window.location.href in errors)) {
  18. errors[window.location.href] = [];
  19. }
  20. errors[window.location.href].push("error: \'" + msg + "\' " + "file: " + url + " " + "line: " + line);
  21. sessionStorage.setItem(key, JSON.stringify(errors));
  22. };
  23. </script>
  24. <?php endif; ?>