console.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. * DevExtreme (core/utils/console.js)
  3. * Version: 19.1.16
  4. * Build date: Tue Oct 18 2022
  5. *
  6. * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
  7. * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
  8. */
  9. "use strict";
  10. var isFunction = require("./type").isFunction;
  11. var noop = function() {};
  12. var getConsoleMethod = function(method) {
  13. if ("undefined" === typeof console || !isFunction(console[method])) {
  14. return noop
  15. }
  16. return console[method].bind(console)
  17. };
  18. var logger = {
  19. info: getConsoleMethod("info"),
  20. warn: getConsoleMethod("warn"),
  21. error: getConsoleMethod("error")
  22. };
  23. var debug = function() {
  24. function assert(condition, message) {
  25. if (!condition) {
  26. throw new Error(message)
  27. }
  28. }
  29. function assertParam(parameter, message) {
  30. assert(null !== parameter && void 0 !== parameter, message)
  31. }
  32. return {
  33. assert: assert,
  34. assertParam: assertParam
  35. }
  36. }();
  37. exports.logger = logger;
  38. exports.debug = debug;