logger.js 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. var __create = Object.create;
  2. var __defProp = Object.defineProperty;
  3. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  4. var __getOwnPropNames = Object.getOwnPropertyNames;
  5. var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  6. var __getProtoOf = Object.getPrototypeOf;
  7. var __hasOwnProp = Object.prototype.hasOwnProperty;
  8. var __propIsEnum = Object.prototype.propertyIsEnumerable;
  9. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  10. var __spreadValues = (a, b) => {
  11. for (var prop in b || (b = {}))
  12. if (__hasOwnProp.call(b, prop))
  13. __defNormalProp(a, prop, b[prop]);
  14. if (__getOwnPropSymbols)
  15. for (var prop of __getOwnPropSymbols(b)) {
  16. if (__propIsEnum.call(b, prop))
  17. __defNormalProp(a, prop, b[prop]);
  18. }
  19. return a;
  20. };
  21. var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
  22. var __objRest = (source, exclude) => {
  23. var target = {};
  24. for (var prop in source)
  25. if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
  26. target[prop] = source[prop];
  27. if (source != null && __getOwnPropSymbols)
  28. for (var prop of __getOwnPropSymbols(source)) {
  29. if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
  30. target[prop] = source[prop];
  31. }
  32. return target;
  33. };
  34. var __export = (target, all) => {
  35. __markAsModule(target);
  36. for (var name in all)
  37. __defProp(target, name, { get: all[name], enumerable: true });
  38. };
  39. var __reExport = (target, module2, desc) => {
  40. if (module2 && typeof module2 === "object" || typeof module2 === "function") {
  41. for (let key of __getOwnPropNames(module2))
  42. if (!__hasOwnProp.call(target, key) && key !== "default")
  43. __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
  44. }
  45. return target;
  46. };
  47. var __toModule = (module2) => {
  48. return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
  49. };
  50. var __publicField = (obj, key, value) => {
  51. __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
  52. return value;
  53. };
  54. __export(exports, {
  55. Logger: () => Logger,
  56. logger: () => logger
  57. });
  58. var import_debug = __toModule(require("debug"));
  59. var import_util = __toModule(require("util"));
  60. class Logger {
  61. constructor(_a = {}) {
  62. __publicField(this, "config");
  63. var _b = _a, { context = "sequelize" } = _b, rest = __objRest(_b, ["context"]);
  64. this.config = __spreadValues({
  65. context
  66. }, rest);
  67. }
  68. warn(message) {
  69. console.warn(`(${this.config.context}) Warning: ${message}`);
  70. }
  71. inspect(value) {
  72. return import_util.default.inspect(value, {
  73. showHidden: false,
  74. depth: 1
  75. });
  76. }
  77. debugContext(name) {
  78. return (0, import_debug.default)(`${this.config.context}:${name}`);
  79. }
  80. }
  81. const logger = new Logger();
  82. //# sourceMappingURL=logger.js.map