@prisma/debug 7.10.1 → 7.11.0-dev.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -160,13 +160,14 @@ function debugCreate(namespace) {
160
160
  };
161
161
  const debugCall = (...args) => {
162
162
  const { enabled, namespace: namespace2, color, log } = instanceProps;
163
+ const isEnabled = topProps.enabled(namespace2) || enabled;
163
164
  if (args.length !== 0) {
164
- argsHistory.push([namespace2, ...args]);
165
+ argsHistory.push([namespace2, ...isEnabled ? args : args.map(summarizeArg)]);
165
166
  }
166
167
  if (argsHistory.length > MAX_ARGS_HISTORY) {
167
168
  argsHistory.shift();
168
169
  }
169
- if (topProps.enabled(namespace2) || enabled) {
170
+ if (isEnabled) {
170
171
  const stringArgs = args.map((arg) => {
171
172
  if (typeof arg === "string") {
172
173
  return arg;
@@ -191,6 +192,15 @@ var Debug = new Proxy(debugCreate, {
191
192
  get: (_, prop) => topProps[prop],
192
193
  set: (_, prop, value) => topProps[prop] = value
193
194
  });
195
+ function summarizeArg(arg) {
196
+ if (arg instanceof Error) {
197
+ return `${arg.name}: ${arg.message}`;
198
+ }
199
+ if (typeof arg === "object" && arg !== null || typeof arg === "function") {
200
+ return "[Object]";
201
+ }
202
+ return arg;
203
+ }
194
204
  function safeStringify(value, indent = 2) {
195
205
  const cache = /* @__PURE__ */ new Set();
196
206
  return JSON.stringify(
package/dist/index.mjs CHANGED
@@ -137,13 +137,14 @@ function debugCreate(namespace) {
137
137
  };
138
138
  const debugCall = (...args) => {
139
139
  const { enabled, namespace: namespace2, color, log } = instanceProps;
140
+ const isEnabled = topProps.enabled(namespace2) || enabled;
140
141
  if (args.length !== 0) {
141
- argsHistory.push([namespace2, ...args]);
142
+ argsHistory.push([namespace2, ...isEnabled ? args : args.map(summarizeArg)]);
142
143
  }
143
144
  if (argsHistory.length > MAX_ARGS_HISTORY) {
144
145
  argsHistory.shift();
145
146
  }
146
- if (topProps.enabled(namespace2) || enabled) {
147
+ if (isEnabled) {
147
148
  const stringArgs = args.map((arg) => {
148
149
  if (typeof arg === "string") {
149
150
  return arg;
@@ -168,6 +169,15 @@ var Debug = new Proxy(debugCreate, {
168
169
  get: (_, prop) => topProps[prop],
169
170
  set: (_, prop, value) => topProps[prop] = value
170
171
  });
172
+ function summarizeArg(arg) {
173
+ if (arg instanceof Error) {
174
+ return `${arg.name}: ${arg.message}`;
175
+ }
176
+ if (typeof arg === "object" && arg !== null || typeof arg === "function") {
177
+ return "[Object]";
178
+ }
179
+ return arg;
180
+ }
171
181
  function safeStringify(value, indent = 2) {
172
182
  const cache = /* @__PURE__ */ new Set();
173
183
  return JSON.stringify(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/debug",
3
- "version": "7.10.1",
3
+ "version": "7.11.0-dev.10",
4
4
  "description": "This package is intended for Prisma's internal use",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -38,7 +38,6 @@
38
38
  "sideEffects": false,
39
39
  "scripts": {
40
40
  "dev": "DEV=true tsx helpers/build.ts",
41
- "build": "tsx helpers/build.ts",
42
- "test": "vitest run"
41
+ "build": "tsx helpers/build.ts"
43
42
  }
44
43
  }