debug.js 877 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * This file is part of the Klarna KP module
  3. *
  4. * (c) Klarna Bank AB (publ)
  5. *
  6. * For the full copyright and license information, please view the NOTICE
  7. * and LICENSE files that were distributed with this source code.
  8. */
  9. define(
  10. [
  11. 'Klarna_Kp/js/model/config'
  12. ],
  13. function (config) {
  14. 'use strict';
  15. return {
  16. log: function (message) {
  17. if (config.debug) {
  18. console.trace();
  19. console.log(message);
  20. }
  21. },
  22. group: function (groupid) {
  23. if (config.debug) {
  24. console.group(groupid);
  25. }
  26. },
  27. groupEnd: function () {
  28. if (config.debug) {
  29. console.groupEnd();
  30. }
  31. },
  32. table: function (tabularData, properties) {
  33. if (config.debug) {
  34. console.trace();
  35. console.table(tabularData, properties);
  36. }
  37. }
  38. };
  39. }
  40. );