@dxos/log 0.8.4-main.a4bbb77 → 0.8.4-main.abd8ff62ef
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/lib/browser/chunk-IEP6GGEX.mjs +23 -0
- package/dist/lib/browser/chunk-IEP6GGEX.mjs.map +7 -0
- package/dist/lib/browser/chunk-V7FYKT4H.mjs +311 -0
- package/dist/lib/browser/chunk-V7FYKT4H.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +355 -224
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/platform/browser/index.mjs +26 -0
- package/dist/lib/browser/platform/browser/index.mjs.map +7 -0
- package/dist/lib/browser/platform/node/index.mjs +21 -0
- package/dist/lib/browser/platform/node/index.mjs.map +7 -0
- package/dist/lib/browser/processors/console-processor.mjs +102 -0
- package/dist/lib/browser/processors/console-processor.mjs.map +7 -0
- package/dist/lib/browser/processors/console-stub.mjs +9 -0
- package/dist/lib/browser/processors/console-stub.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-2SZHAWBN.mjs +24 -0
- package/dist/lib/node-esm/chunk-2SZHAWBN.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-5TBDXMQF.mjs +313 -0
- package/dist/lib/node-esm/chunk-5TBDXMQF.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +356 -312
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/platform/browser/index.mjs +27 -0
- package/dist/lib/node-esm/platform/browser/index.mjs.map +7 -0
- package/dist/lib/node-esm/platform/node/index.mjs +22 -0
- package/dist/lib/node-esm/platform/node/index.mjs.map +7 -0
- package/dist/lib/node-esm/processors/console-processor.mjs +103 -0
- package/dist/lib/node-esm/processors/console-processor.mjs.map +7 -0
- package/dist/lib/node-esm/processors/console-stub.mjs +10 -0
- package/dist/lib/node-esm/processors/console-stub.mjs.map +7 -0
- package/dist/types/src/config.d.ts.map +1 -1
- package/dist/types/src/context.d.ts +78 -2
- package/dist/types/src/context.d.ts.map +1 -1
- package/dist/types/src/dbg.d.ts +23 -0
- package/dist/types/src/dbg.d.ts.map +1 -0
- package/dist/types/src/decorators.d.ts +1 -1
- package/dist/types/src/decorators.d.ts.map +1 -1
- package/dist/types/src/environment.d.ts +24 -0
- package/dist/types/src/environment.d.ts.map +1 -0
- package/dist/types/src/environment.test.d.ts +2 -0
- package/dist/types/src/environment.test.d.ts.map +1 -0
- package/dist/types/src/experimental/ownership.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +7 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/jsonl.d.ts +53 -0
- package/dist/types/src/jsonl.d.ts.map +1 -0
- package/dist/types/src/jsonl.test.d.ts +2 -0
- package/dist/types/src/jsonl.test.d.ts.map +1 -0
- package/dist/types/src/log-buffer.d.ts +20 -0
- package/dist/types/src/log-buffer.d.ts.map +1 -0
- package/dist/types/src/log-buffer.test.d.ts +2 -0
- package/dist/types/src/log-buffer.test.d.ts.map +1 -0
- package/dist/types/src/log.d.ts +55 -18
- package/dist/types/src/log.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +20 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/options.d.ts +1 -6
- package/dist/types/src/options.d.ts.map +1 -1
- package/dist/types/src/platform/browser/index.d.ts.map +1 -1
- package/dist/types/src/platform/index.d.ts +1 -1
- package/dist/types/src/platform/index.d.ts.map +1 -1
- package/dist/types/src/platform/node/index.d.ts.map +1 -1
- package/dist/types/src/processors/browser-processor.d.ts.map +1 -1
- package/dist/types/src/processors/common.d.ts.map +1 -1
- package/dist/types/src/processors/console-processor.d.ts.map +1 -1
- package/dist/types/src/processors/file-processor.d.ts.map +1 -1
- package/dist/types/src/processors/index.d.ts +3 -3
- package/dist/types/src/processors/index.d.ts.map +1 -1
- package/dist/types/src/scope.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +30 -15
- package/src/config.ts +1 -0
- package/src/context.ts +278 -7
- package/src/dbg.ts +34 -0
- package/src/decorators.ts +4 -5
- package/src/environment.test.ts +222 -0
- package/src/environment.ts +129 -0
- package/src/experimental/classes.test.ts +0 -1
- package/src/index.ts +7 -4
- package/src/jsonl.test.ts +121 -0
- package/src/jsonl.ts +104 -0
- package/src/log-buffer.test.ts +158 -0
- package/src/log-buffer.ts +89 -0
- package/src/log.test.ts +48 -19
- package/src/log.ts +146 -58
- package/src/meta.ts +29 -1
- package/src/options.ts +26 -10
- package/src/platform/index.ts +1 -1
- package/src/platform/node/index.ts +1 -2
- package/src/processors/browser-processor.ts +27 -28
- package/src/processors/console-processor.ts +5 -13
- package/src/processors/file-processor.ts +9 -9
- package/src/processors/index.ts +3 -3
|
@@ -1,107 +1,160 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
LogEntry,
|
|
4
|
+
LogLevel,
|
|
5
|
+
LogProcessorType,
|
|
6
|
+
gatherLogInfoFromScope,
|
|
7
|
+
getContextFromEntry,
|
|
8
|
+
getRelativeFilename,
|
|
9
|
+
levels,
|
|
10
|
+
logInfo,
|
|
11
|
+
shortLevelName,
|
|
12
|
+
shouldLog
|
|
13
|
+
} from "./chunk-5TBDXMQF.mjs";
|
|
14
|
+
import {
|
|
15
|
+
__export,
|
|
16
|
+
__reExport
|
|
17
|
+
} from "./chunk-2SZHAWBN.mjs";
|
|
2
18
|
|
|
3
19
|
// src/index.ts
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
LogProcessorType2["BROWSER"] = "browser";
|
|
36
|
-
LogProcessorType2["DEBUG"] = "debug";
|
|
37
|
-
return LogProcessorType2;
|
|
38
|
-
})({});
|
|
20
|
+
var index_exports = {};
|
|
21
|
+
__export(index_exports, {
|
|
22
|
+
BROWSER_PROCESSOR: () => BROWSER_PROCESSOR,
|
|
23
|
+
DEBUG_PROCESSOR: () => DEBUG_PROCESSOR,
|
|
24
|
+
FILE_PROCESSOR: () => FILE_PROCESSOR,
|
|
25
|
+
LOG_META_MARKER: () => LOG_META_MARKER,
|
|
26
|
+
LogBuffer: () => LogBuffer,
|
|
27
|
+
LogEntry: () => LogEntry,
|
|
28
|
+
LogLevel: () => LogLevel,
|
|
29
|
+
LogProcessorType: () => LogProcessorType,
|
|
30
|
+
createFileProcessor: () => createFileProcessor,
|
|
31
|
+
createLog: () => createLog,
|
|
32
|
+
dbg: () => dbg,
|
|
33
|
+
debug: () => debug,
|
|
34
|
+
gatherLogInfoFromScope: () => gatherLogInfoFromScope,
|
|
35
|
+
getContextFromEntry: () => getContextFromEntry,
|
|
36
|
+
getCurrentOwnershipScope: () => getCurrentOwnershipScope,
|
|
37
|
+
getRelativeFilename: () => getRelativeFilename,
|
|
38
|
+
inferEnvironmentName: () => inferEnvironmentName,
|
|
39
|
+
isLogMeta: () => isLogMeta,
|
|
40
|
+
levels: () => levels,
|
|
41
|
+
log: () => log,
|
|
42
|
+
logInfo: () => logInfo,
|
|
43
|
+
omit: () => omit,
|
|
44
|
+
parseFilter: () => parseFilter,
|
|
45
|
+
pick: () => pick,
|
|
46
|
+
serializeToJsonl: () => serializeToJsonl,
|
|
47
|
+
shortLevelName: () => shortLevelName,
|
|
48
|
+
shouldLog: () => shouldLog
|
|
49
|
+
});
|
|
50
|
+
import { omit, pick } from "@dxos/util";
|
|
39
51
|
|
|
40
|
-
// src/
|
|
41
|
-
var
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
|
|
52
|
+
// src/environment.ts
|
|
53
|
+
var TAB_SUFFIX_STORAGE_KEY = "@dxos/log:env-suffix";
|
|
54
|
+
var SUFFIX_LENGTH = 6;
|
|
55
|
+
var randomSuffix = () => {
|
|
56
|
+
const cryptoRef = globalThis.crypto;
|
|
57
|
+
if (cryptoRef?.getRandomValues) {
|
|
58
|
+
const bytes = new Uint8Array(SUFFIX_LENGTH);
|
|
59
|
+
cryptoRef.getRandomValues(bytes);
|
|
60
|
+
let suffix = "";
|
|
61
|
+
for (const byte of bytes) {
|
|
62
|
+
suffix += (byte % 36).toString(36);
|
|
63
|
+
}
|
|
64
|
+
return suffix;
|
|
65
|
+
}
|
|
66
|
+
return Math.random().toString(36).slice(2, 2 + SUFFIX_LENGTH).padEnd(SUFFIX_LENGTH, "0");
|
|
45
67
|
};
|
|
46
|
-
var
|
|
47
|
-
if (!
|
|
48
|
-
return
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
try {
|
|
55
|
-
res[prop] = typeof scope[prop] === "function" ? scope[prop]() : scope[prop];
|
|
56
|
-
} catch (err) {
|
|
57
|
-
res[prop] = err.message;
|
|
68
|
+
var getOrCreateTabSuffix = (session) => {
|
|
69
|
+
if (!session) {
|
|
70
|
+
return randomSuffix();
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
const existing = session.getItem(TAB_SUFFIX_STORAGE_KEY);
|
|
74
|
+
if (existing && existing.length > 0) {
|
|
75
|
+
return existing;
|
|
58
76
|
}
|
|
77
|
+
const suffix = randomSuffix();
|
|
78
|
+
session.setItem(TAB_SUFFIX_STORAGE_KEY, suffix);
|
|
79
|
+
return suffix;
|
|
80
|
+
} catch {
|
|
81
|
+
return randomSuffix();
|
|
59
82
|
}
|
|
60
|
-
return res;
|
|
61
83
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return level >= filter.level && (!filter.pattern || path.includes(filter.pattern));
|
|
84
|
+
var isInstanceOf = (scope, ctorName) => {
|
|
85
|
+
const ctor = scope?.[ctorName];
|
|
86
|
+
return typeof ctor === "function" && scope instanceof ctor;
|
|
66
87
|
};
|
|
67
|
-
var
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return
|
|
88
|
+
var CF_WORKER_USER_AGENT = "Cloudflare-Workers";
|
|
89
|
+
var inferEnvironmentName = (options = {}) => {
|
|
90
|
+
const scope = options.scope ?? globalThis;
|
|
91
|
+
if (scope.navigator?.userAgent === CF_WORKER_USER_AGENT) {
|
|
92
|
+
return `cf-worker::${randomSuffix()}`;
|
|
93
|
+
}
|
|
94
|
+
if (isInstanceOf(scope, "SharedWorkerGlobalScope")) {
|
|
95
|
+
return `shared-worker:${scope.name ?? ""}:${randomSuffix()}`;
|
|
96
|
+
}
|
|
97
|
+
if (isInstanceOf(scope, "ServiceWorkerGlobalScope")) {
|
|
98
|
+
return `service-worker::${randomSuffix()}`;
|
|
99
|
+
}
|
|
100
|
+
if (isInstanceOf(scope, "DedicatedWorkerGlobalScope")) {
|
|
101
|
+
return `dedicated-worker:${scope.name ?? ""}:${randomSuffix()}`;
|
|
102
|
+
}
|
|
103
|
+
if (scope.window !== void 0 && scope.window === scope) {
|
|
104
|
+
const origin = scope.location?.origin ?? "";
|
|
105
|
+
return `tab:${origin}:${getOrCreateTabSuffix(scope.sessionStorage)}`;
|
|
72
106
|
}
|
|
107
|
+
const proc = scope.process;
|
|
108
|
+
if (proc && typeof proc === "object" && proc.versions?.node) {
|
|
109
|
+
const pid = typeof proc.pid === "number" ? String(proc.pid) : "";
|
|
110
|
+
return `node:${pid}:${randomSuffix()}`;
|
|
111
|
+
}
|
|
112
|
+
return `unknown::${randomSuffix()}`;
|
|
73
113
|
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
context = Object.assign(context ?? {}, scopeInfo);
|
|
80
|
-
}
|
|
114
|
+
|
|
115
|
+
// src/jsonl.ts
|
|
116
|
+
var serializeToJsonl = (entry, opts = {}) => {
|
|
117
|
+
if (entry.level <= LogLevel.TRACE) {
|
|
118
|
+
return void 0;
|
|
81
119
|
}
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
120
|
+
const { filename, line, context: scopeName } = entry.computedMeta;
|
|
121
|
+
const record = {
|
|
122
|
+
t: new Date(entry.timestamp).toISOString(),
|
|
123
|
+
l: shortLevelName[entry.level] ?? "?",
|
|
124
|
+
m: entry.message ?? ""
|
|
125
|
+
};
|
|
126
|
+
if (filename !== void 0) {
|
|
127
|
+
record.f = filename;
|
|
128
|
+
}
|
|
129
|
+
if (line !== void 0) {
|
|
130
|
+
record.n = line;
|
|
131
|
+
}
|
|
132
|
+
if (scopeName !== void 0) {
|
|
133
|
+
record.o = scopeName;
|
|
134
|
+
}
|
|
135
|
+
if (entry.computedError !== void 0) {
|
|
136
|
+
record.e = entry.computedError;
|
|
137
|
+
}
|
|
138
|
+
if (opts.env !== void 0) {
|
|
139
|
+
record.i = opts.env;
|
|
140
|
+
}
|
|
141
|
+
const computedContext = entry.computedContext;
|
|
142
|
+
if (Object.keys(computedContext).length > 0) {
|
|
143
|
+
try {
|
|
144
|
+
record.c = JSON.stringify(computedContext);
|
|
145
|
+
} catch {
|
|
92
146
|
}
|
|
93
147
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
148
|
+
try {
|
|
149
|
+
return JSON.stringify(record);
|
|
150
|
+
} catch {
|
|
151
|
+
return void 0;
|
|
98
152
|
}
|
|
99
|
-
return context && Object.keys(context).length > 0 ? context : void 0;
|
|
100
153
|
};
|
|
101
154
|
|
|
102
155
|
// src/decorators.ts
|
|
103
|
-
import { inspect } from "node:util";
|
|
104
156
|
import chalk from "chalk";
|
|
157
|
+
import { inspect } from "node:util";
|
|
105
158
|
var nextPromiseId = 0;
|
|
106
159
|
var createMethodLogDecorator = (log2) => (arg0, arg1, meta) => (target, propertyKey, descriptor) => {
|
|
107
160
|
const method = descriptor.value;
|
|
@@ -198,155 +251,36 @@ var logAsyncResolved = (log2, methodName, resolvedValue, promiseId, startTime, c
|
|
|
198
251
|
var logAsyncRejected = (log2, methodName, err, promiseId, startTime, combinedMeta) => {
|
|
199
252
|
log2.info(`.${formatFunction(methodName)} \u21B2 \u{1F525} ${chalk.gray("reject")} ${formatPromise(promiseId)} ${formatTimeElapsed(startTime)} ${chalk.gray("=>")} ${err}`, {}, combinedMeta);
|
|
200
253
|
};
|
|
201
|
-
var greenCheck = typeof chalk.green === "function" ? chalk.green("\u2714") : "\u2714";
|
|
202
|
-
var formatTimeElapsed = (startTime) => chalk.gray(`${(performance.now() - startTime).toFixed(0)}ms`);
|
|
203
254
|
var COLOR_FUNCTION = [
|
|
204
255
|
220,
|
|
205
256
|
220,
|
|
206
257
|
170
|
|
207
258
|
];
|
|
259
|
+
var greenCheck = typeof chalk.green === "function" ? chalk.green("\u2714") : "\u2714";
|
|
260
|
+
var formatTimeElapsed = (startTime) => chalk.gray(`${(performance.now() - startTime).toFixed(0)}ms`);
|
|
208
261
|
var formatFunction = (name) => chalk.bold(chalk.rgb(...COLOR_FUNCTION)(name));
|
|
209
262
|
var formatPromise = (id) => chalk.blue(`Promise#${id}`);
|
|
210
263
|
|
|
211
264
|
// src/options.ts
|
|
212
265
|
import defaultsDeep from "lodash.defaultsdeep";
|
|
213
266
|
|
|
214
|
-
// src/platform/
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
if (filepath) {
|
|
219
|
-
try {
|
|
220
|
-
const text = fs.readFileSync(filepath, "utf-8");
|
|
221
|
-
if (text) {
|
|
222
|
-
return yaml.load(text);
|
|
223
|
-
}
|
|
224
|
-
} catch (err) {
|
|
225
|
-
console.warn(`Invalid log file: ${filepath}`);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
// src/processors/console-processor.ts
|
|
231
|
-
import { inspect as inspect2 } from "node:util";
|
|
232
|
-
import chalk2 from "chalk";
|
|
233
|
-
import { getPrototypeSpecificInstanceId, pickBy } from "@dxos/util";
|
|
234
|
-
|
|
235
|
-
// src/processors/common.ts
|
|
236
|
-
var getRelativeFilename = (filename) => {
|
|
237
|
-
const match = filename.match(/.+\/(packages\/.+\/.+)/);
|
|
238
|
-
if (match) {
|
|
239
|
-
const [, filePath] = match;
|
|
240
|
-
return filePath;
|
|
241
|
-
}
|
|
242
|
-
return filename;
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
// src/processors/console-processor.ts
|
|
246
|
-
var LEVEL_COLORS = {
|
|
247
|
-
[LogLevel.TRACE]: "gray",
|
|
248
|
-
[LogLevel.DEBUG]: "gray",
|
|
249
|
-
[LogLevel.VERBOSE]: "gray",
|
|
250
|
-
[LogLevel.INFO]: "white",
|
|
251
|
-
[LogLevel.WARN]: "yellow",
|
|
252
|
-
[LogLevel.ERROR]: "red"
|
|
253
|
-
};
|
|
254
|
-
var truncate = (text, length = 0, right = false) => {
|
|
255
|
-
const str = text && length ? right ? text.slice(-length) : text.substring(0, length) : text ?? "";
|
|
256
|
-
return right ? str.padStart(length, " ") : str.padEnd(length, " ");
|
|
257
|
-
};
|
|
258
|
-
var DEFAULT_FORMATTER = (config, { path, line, level, message, context, error, scope }) => {
|
|
259
|
-
const column = config.options?.formatter?.column;
|
|
260
|
-
const filepath = path !== void 0 && line !== void 0 ? chalk2.grey(`${path}:${line}`) : void 0;
|
|
261
|
-
let instance;
|
|
262
|
-
if (scope) {
|
|
263
|
-
const prototype = Object.getPrototypeOf(scope);
|
|
264
|
-
if (prototype !== null) {
|
|
265
|
-
const id = getPrototypeSpecificInstanceId(scope);
|
|
266
|
-
instance = chalk2.magentaBright(`${prototype.constructor.name}#${id}`);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
const formattedTimestamp = config.options?.formatter?.timestamp ? (/* @__PURE__ */ new Date()).toISOString() : void 0;
|
|
270
|
-
const formattedLevel = chalk2[LEVEL_COLORS[level]](column ? shortLevelName[level] : LogLevel[level]);
|
|
271
|
-
const padding = column && filepath ? "".padStart(column - filepath.length) : void 0;
|
|
272
|
-
return config.options?.formatter?.timestampFirst ? [
|
|
273
|
-
formattedTimestamp,
|
|
274
|
-
filepath,
|
|
275
|
-
padding,
|
|
276
|
-
formattedLevel,
|
|
277
|
-
instance,
|
|
278
|
-
message,
|
|
279
|
-
context,
|
|
280
|
-
error
|
|
281
|
-
] : [
|
|
282
|
-
// NOTE: File path must come fist for console hyperlinks.
|
|
283
|
-
// Must not truncate for terminal output.
|
|
284
|
-
filepath,
|
|
285
|
-
padding,
|
|
286
|
-
formattedTimestamp,
|
|
287
|
-
formattedLevel,
|
|
288
|
-
instance,
|
|
289
|
-
message,
|
|
290
|
-
context,
|
|
291
|
-
error
|
|
292
|
-
];
|
|
293
|
-
};
|
|
294
|
-
var SHORT_FORMATTER = (config, { path, level, message }) => {
|
|
295
|
-
return [
|
|
296
|
-
chalk2.grey(truncate(path, 16, true)),
|
|
297
|
-
chalk2[LEVEL_COLORS[level]](shortLevelName[level]),
|
|
298
|
-
message
|
|
299
|
-
];
|
|
300
|
-
};
|
|
301
|
-
var formatter = DEFAULT_FORMATTER;
|
|
302
|
-
var CONSOLE_PROCESSOR = (config, entry) => {
|
|
303
|
-
const { level, message, meta, error } = entry;
|
|
304
|
-
if (!shouldLog(entry, config.filters)) {
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
const parts = {
|
|
308
|
-
level,
|
|
309
|
-
message,
|
|
310
|
-
error,
|
|
311
|
-
path: void 0,
|
|
312
|
-
line: void 0,
|
|
313
|
-
scope: void 0,
|
|
314
|
-
context: void 0
|
|
315
|
-
};
|
|
316
|
-
if (meta) {
|
|
317
|
-
parts.path = getRelativeFilename(meta.F);
|
|
318
|
-
parts.line = meta.L;
|
|
319
|
-
parts.scope = meta.S;
|
|
320
|
-
}
|
|
321
|
-
const context = getContextFromEntry(entry);
|
|
322
|
-
if (context) {
|
|
323
|
-
parts.context = inspect2(pickBy(context, (value) => value !== void 0), {
|
|
324
|
-
depth: config.options.depth,
|
|
325
|
-
colors: true,
|
|
326
|
-
maxArrayLength: 8,
|
|
327
|
-
sorted: false
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
const line = formatter(config, parts).filter(Boolean).join(" ");
|
|
331
|
-
console.log(line);
|
|
332
|
-
};
|
|
267
|
+
// src/platform/index.ts
|
|
268
|
+
var platform_exports = {};
|
|
269
|
+
__reExport(platform_exports, platform_star);
|
|
270
|
+
import * as platform_star from "#platform";
|
|
333
271
|
|
|
334
|
-
// src/processors/
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
272
|
+
// src/processors/index.ts
|
|
273
|
+
var processors_exports = {};
|
|
274
|
+
__export(processors_exports, {
|
|
275
|
+
BROWSER_PROCESSOR: () => BROWSER_PROCESSOR,
|
|
276
|
+
DEBUG_PROCESSOR: () => DEBUG_PROCESSOR,
|
|
277
|
+
FILE_PROCESSOR: () => FILE_PROCESSOR,
|
|
278
|
+
createFileProcessor: () => createFileProcessor,
|
|
279
|
+
getRelativeFilename: () => getRelativeFilename
|
|
280
|
+
});
|
|
339
281
|
|
|
340
282
|
// src/processors/browser-processor.ts
|
|
341
|
-
import {
|
|
342
|
-
var getRelativeFilename2 = (filename) => {
|
|
343
|
-
const match = filename.match(/.+\/(packages\/.+\/.+)/);
|
|
344
|
-
if (match) {
|
|
345
|
-
const [, filePath] = match;
|
|
346
|
-
return filePath;
|
|
347
|
-
}
|
|
348
|
-
return filename;
|
|
349
|
-
};
|
|
283
|
+
import { safariCheck } from "@dxos/util";
|
|
350
284
|
var CONFIG = {
|
|
351
285
|
useTestProcessor: false,
|
|
352
286
|
printFileLinks: false
|
|
@@ -357,18 +291,20 @@ var APP_BROWSER_PROCESSOR = (config, entry) => {
|
|
|
357
291
|
}
|
|
358
292
|
const LOG_BROWSER_PREFIX = config.prefix ?? "https://vscode.dev/github.com/dxos/dxos/blob/main/";
|
|
359
293
|
const LOG_BROWSER_CSS = [];
|
|
294
|
+
const { filename, line: lineNumber, context: scopeDebugName } = entry.computedMeta;
|
|
360
295
|
let link = "";
|
|
361
|
-
if (
|
|
362
|
-
const filename = getRelativeFilename2(entry.meta.F);
|
|
296
|
+
if (filename !== void 0 && lineNumber !== void 0) {
|
|
363
297
|
const filepath = `${LOG_BROWSER_PREFIX.replace(/\/$/, "")}/${filename}`;
|
|
364
|
-
link = `${filepath}#L${
|
|
298
|
+
link = `${filepath}#L${lineNumber}`;
|
|
365
299
|
}
|
|
366
300
|
let args = [];
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
const scopeName = scope.name ||
|
|
370
|
-
|
|
371
|
-
|
|
301
|
+
const scope = entry.meta?.S;
|
|
302
|
+
if (scope) {
|
|
303
|
+
const scopeName = scope.name || scopeDebugName;
|
|
304
|
+
if (scopeName) {
|
|
305
|
+
const processPrefix = scope.hostSessionId ? "[worker] " : "";
|
|
306
|
+
args.push(`%c${processPrefix}${scopeName}`, "color:#C026D3;font-weight:bold");
|
|
307
|
+
}
|
|
372
308
|
}
|
|
373
309
|
if (entry.message) {
|
|
374
310
|
args.push(entry.message);
|
|
@@ -376,9 +312,9 @@ var APP_BROWSER_PROCESSOR = (config, entry) => {
|
|
|
376
312
|
const context = getContextFromEntry(entry);
|
|
377
313
|
if (context) {
|
|
378
314
|
if (Object.keys(context).length === 1 && "error" in context) {
|
|
379
|
-
args.push(context.error);
|
|
315
|
+
args.push(unwrapEffectError(context.error));
|
|
380
316
|
} else if (Object.keys(context).length === 1 && "err" in context) {
|
|
381
|
-
args.push(context.err);
|
|
317
|
+
args.push(unwrapEffectError(context.err));
|
|
382
318
|
} else {
|
|
383
319
|
args.push(context);
|
|
384
320
|
}
|
|
@@ -413,10 +349,8 @@ var TEST_BROWSER_PROCESSOR = (config, entry) => {
|
|
|
413
349
|
if (!shouldLog(entry, config.filters)) {
|
|
414
350
|
return;
|
|
415
351
|
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
path = `${getRelativeFilename2(entry.meta.F)}:${entry.meta.L}`;
|
|
419
|
-
}
|
|
352
|
+
const { filename, line: lineNumber } = entry.computedMeta;
|
|
353
|
+
const path = filename !== void 0 && lineNumber !== void 0 ? `${filename}:${lineNumber}` : "";
|
|
420
354
|
let args = [];
|
|
421
355
|
const processPrefix = entry.meta?.S?.hostSessionId ? "[worker] " : "";
|
|
422
356
|
args.push(`${processPrefix}${entry.message}`);
|
|
@@ -443,11 +377,27 @@ var TEST_BROWSER_PROCESSOR = (config, entry) => {
|
|
|
443
377
|
}
|
|
444
378
|
};
|
|
445
379
|
var BROWSER_PROCESSOR = CONFIG.useTestProcessor ? TEST_BROWSER_PROCESSOR : APP_BROWSER_PROCESSOR;
|
|
380
|
+
var originalSymbol = /* @__PURE__ */ Symbol.for("effect/OriginalAnnotation");
|
|
381
|
+
var unwrapEffectError = (error) => {
|
|
382
|
+
if (typeof error === "object" && error !== null && originalSymbol in error) {
|
|
383
|
+
return error[originalSymbol];
|
|
384
|
+
}
|
|
385
|
+
return error;
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
// src/processors/index.ts
|
|
389
|
+
__reExport(processors_exports, console_processor_star);
|
|
390
|
+
import * as console_processor_star from "#console-processor";
|
|
391
|
+
|
|
392
|
+
// src/processors/debug-processor.ts
|
|
393
|
+
import { inspect as inspect2 } from "node:util";
|
|
394
|
+
var DEBUG_PROCESSOR = (config, entry) => {
|
|
395
|
+
console.log(inspect2(entry, false, null, true));
|
|
396
|
+
};
|
|
446
397
|
|
|
447
398
|
// src/processors/file-processor.ts
|
|
448
399
|
import { appendFileSync, mkdirSync, openSync } from "node:fs";
|
|
449
400
|
import { dirname } from "node:path";
|
|
450
|
-
import { jsonlogify } from "@dxos/util";
|
|
451
401
|
var EAGAIN_MAX_DURATION = 1e3;
|
|
452
402
|
var createFileProcessor = ({ pathOrFd, levels: levels2, filters }) => {
|
|
453
403
|
let fd;
|
|
@@ -468,15 +418,12 @@ var createFileProcessor = ({ pathOrFd, levels: levels2, filters }) => {
|
|
|
468
418
|
fd = openSync(pathOrFd, "a");
|
|
469
419
|
}
|
|
470
420
|
const record = {
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
}
|
|
478
|
-
} : {},
|
|
479
|
-
context: jsonlogify(getContextFromEntry(entry))
|
|
421
|
+
level: entry.level,
|
|
422
|
+
message: entry.message,
|
|
423
|
+
timestamp: entry.timestamp,
|
|
424
|
+
meta: entry.computedMeta,
|
|
425
|
+
context: entry.computedContext,
|
|
426
|
+
error: entry.computedError
|
|
480
427
|
};
|
|
481
428
|
let retryTS = 0;
|
|
482
429
|
while (true) {
|
|
@@ -500,7 +447,7 @@ var createFileProcessor = ({ pathOrFd, levels: levels2, filters }) => {
|
|
|
500
447
|
};
|
|
501
448
|
var logFilePath;
|
|
502
449
|
var getLogFilePath = () => {
|
|
503
|
-
logFilePath
|
|
450
|
+
logFilePath ??= process.env.LOG_FILE ?? (process.env.HOME ? `${process.env.HOME}/.dxlog/${(/* @__PURE__ */ new Date()).toISOString()}.log` : void 0);
|
|
504
451
|
return logFilePath;
|
|
505
452
|
};
|
|
506
453
|
var FILE_PROCESSOR = createFileProcessor({
|
|
@@ -515,14 +462,15 @@ var FILE_PROCESSOR = createFileProcessor({
|
|
|
515
462
|
|
|
516
463
|
// src/options.ts
|
|
517
464
|
var processors = {
|
|
518
|
-
[LogProcessorType.CONSOLE]: CONSOLE_PROCESSOR,
|
|
465
|
+
[LogProcessorType.CONSOLE]: processors_exports.CONSOLE_PROCESSOR,
|
|
519
466
|
[LogProcessorType.BROWSER]: BROWSER_PROCESSOR,
|
|
520
467
|
[LogProcessorType.DEBUG]: DEBUG_PROCESSOR
|
|
521
468
|
};
|
|
522
|
-
var
|
|
469
|
+
var browser = (typeof window !== "undefined" || typeof navigator !== "undefined") && !(typeof process !== "undefined" && process?.env?.VITEST);
|
|
523
470
|
var DEFAULT_PROCESSORS = [
|
|
524
|
-
|
|
471
|
+
browser ? BROWSER_PROCESSOR : processors_exports.CONSOLE_PROCESSOR
|
|
525
472
|
];
|
|
473
|
+
var parseLogLevel = (level, defValue = LogLevel.WARN) => levels[level.toLowerCase()] ?? defValue;
|
|
526
474
|
var parseFilter = (filter) => {
|
|
527
475
|
if (typeof filter === "number") {
|
|
528
476
|
return [
|
|
@@ -531,7 +479,6 @@ var parseFilter = (filter) => {
|
|
|
531
479
|
}
|
|
532
480
|
];
|
|
533
481
|
}
|
|
534
|
-
const parseLogLevel = (level, defValue = LogLevel.WARN) => levels[level.toLowerCase()] ?? defValue;
|
|
535
482
|
const lines = typeof filter === "string" ? filter.split(/,\s*/) : filter;
|
|
536
483
|
return lines.map((filter2) => {
|
|
537
484
|
const [pattern, level] = filter2.split(":");
|
|
@@ -543,67 +490,91 @@ var parseFilter = (filter) => {
|
|
|
543
490
|
};
|
|
544
491
|
});
|
|
545
492
|
};
|
|
546
|
-
var
|
|
547
|
-
const
|
|
493
|
+
var createConfig = (options) => {
|
|
494
|
+
const envOptions = "process" in globalThis ? {
|
|
548
495
|
file: process.env.LOG_CONFIG,
|
|
549
496
|
filter: process.env.LOG_FILTER,
|
|
550
497
|
processor: process.env.LOG_PROCESSOR
|
|
551
498
|
} : void 0;
|
|
552
|
-
const mergedOptions = defaultsDeep({}, loadOptions(
|
|
499
|
+
const mergedOptions = defaultsDeep({}, (0, platform_exports.loadOptions)(envOptions?.file), envOptions, options);
|
|
553
500
|
return {
|
|
554
501
|
options: mergedOptions,
|
|
555
502
|
filters: parseFilter(mergedOptions.filter ?? LogLevel.INFO),
|
|
556
503
|
captureFilters: parseFilter(mergedOptions.captureFilter ?? LogLevel.WARN),
|
|
557
504
|
processors: mergedOptions.processor ? [
|
|
558
505
|
processors[mergedOptions.processor]
|
|
559
|
-
] :
|
|
506
|
+
] : [
|
|
507
|
+
...DEFAULT_PROCESSORS
|
|
508
|
+
],
|
|
560
509
|
prefix: mergedOptions.prefix
|
|
561
510
|
};
|
|
562
511
|
};
|
|
563
512
|
|
|
564
513
|
// src/log.ts
|
|
565
|
-
var
|
|
514
|
+
var logCount = 0;
|
|
566
515
|
var createLog = () => {
|
|
567
516
|
const log2 = (...params) => processLog(LogLevel.DEBUG, ...params);
|
|
568
|
-
log2
|
|
517
|
+
Object.assign(log2, {
|
|
518
|
+
_id: `log-${++logCount}`,
|
|
519
|
+
_config: createConfig()
|
|
520
|
+
});
|
|
569
521
|
Object.defineProperty(log2, "runtimeConfig", {
|
|
570
522
|
get: () => log2._config
|
|
571
523
|
});
|
|
572
|
-
log2.addProcessor = (processor) => {
|
|
573
|
-
if (DEFAULT_PROCESSORS.filter((p) => p === processor).length === 0) {
|
|
574
|
-
DEFAULT_PROCESSORS.push(processor);
|
|
575
|
-
}
|
|
576
|
-
if (log2._config.processors.filter((p) => p === processor).length === 0) {
|
|
577
|
-
log2._config.processors.push(processor);
|
|
578
|
-
}
|
|
579
|
-
};
|
|
580
|
-
log2.config = (options) => {
|
|
581
|
-
log2._config = getConfig(options);
|
|
582
|
-
};
|
|
583
|
-
log2.trace = (...params) => processLog(LogLevel.TRACE, ...params);
|
|
584
|
-
log2.debug = (...params) => processLog(LogLevel.DEBUG, ...params);
|
|
585
|
-
log2.verbose = (...params) => processLog(LogLevel.VERBOSE, ...params);
|
|
586
|
-
log2.info = (...params) => processLog(LogLevel.INFO, ...params);
|
|
587
|
-
log2.warn = (...params) => processLog(LogLevel.WARN, ...params);
|
|
588
|
-
log2.error = (...params) => processLog(LogLevel.ERROR, ...params);
|
|
589
|
-
log2.catch = (error, context, meta) => processLog(LogLevel.ERROR, void 0, context, meta, error);
|
|
590
|
-
log2.break = () => log2.info("\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014");
|
|
591
|
-
log2.stack = (message, context, meta) => processLog(LogLevel.INFO, `${message ?? "Stack Dump"}
|
|
592
|
-
${getFormattedStackTrace()}`, context, meta);
|
|
593
|
-
log2.method = createMethodLogDecorator(log2);
|
|
594
|
-
log2.func = createFunctionLogDecorator(log2);
|
|
595
524
|
const processLog = (level, message, context = {}, meta, error) => {
|
|
596
|
-
|
|
525
|
+
const entry = new LogEntry({
|
|
597
526
|
level,
|
|
598
527
|
message,
|
|
599
528
|
context,
|
|
600
529
|
meta,
|
|
601
530
|
error
|
|
602
|
-
})
|
|
531
|
+
});
|
|
532
|
+
log2._config.processors.forEach((processor) => processor(log2._config, entry));
|
|
603
533
|
};
|
|
534
|
+
Object.assign(log2, {
|
|
535
|
+
/**
|
|
536
|
+
* Update config.
|
|
537
|
+
* NOTE: Preserves any processors that were already added to this logger instance
|
|
538
|
+
* unless an explicit processor option is provided.
|
|
539
|
+
*/
|
|
540
|
+
config: ({ processor, ...options } = {}) => {
|
|
541
|
+
const config = createConfig(options);
|
|
542
|
+
const processors2 = processor ? config.processors : log2._config.processors;
|
|
543
|
+
log2._config = {
|
|
544
|
+
...config,
|
|
545
|
+
processors: processors2
|
|
546
|
+
};
|
|
547
|
+
return log2;
|
|
548
|
+
},
|
|
549
|
+
/**
|
|
550
|
+
* Adds a processor to the logger.
|
|
551
|
+
*/
|
|
552
|
+
addProcessor: (processor) => {
|
|
553
|
+
if (log2._config.processors.filter((p) => p === processor).length === 0) {
|
|
554
|
+
log2._config.processors.push(processor);
|
|
555
|
+
}
|
|
556
|
+
return () => {
|
|
557
|
+
log2._config.processors = log2._config.processors.filter((p) => p !== processor);
|
|
558
|
+
};
|
|
559
|
+
},
|
|
560
|
+
trace: (...params) => processLog(LogLevel.TRACE, ...params),
|
|
561
|
+
debug: (...params) => processLog(LogLevel.DEBUG, ...params),
|
|
562
|
+
verbose: (...params) => processLog(LogLevel.VERBOSE, ...params),
|
|
563
|
+
info: (...params) => processLog(LogLevel.INFO, ...params),
|
|
564
|
+
warn: (...params) => processLog(LogLevel.WARN, ...params),
|
|
565
|
+
error: (...params) => processLog(LogLevel.ERROR, ...params),
|
|
566
|
+
catch: (error, context, meta) => processLog(LogLevel.ERROR, void 0, context, meta, error),
|
|
567
|
+
method: createMethodLogDecorator(log2),
|
|
568
|
+
function: createFunctionLogDecorator(log2),
|
|
569
|
+
break: () => log2.info("-".repeat(80)),
|
|
570
|
+
stack: (message, context, meta) => {
|
|
571
|
+
return processLog(LogLevel.INFO, `${message ?? "Stack Dump"}
|
|
572
|
+
${getFormattedStackTrace()}`, context, meta);
|
|
573
|
+
}
|
|
574
|
+
});
|
|
604
575
|
return log2;
|
|
605
576
|
};
|
|
606
|
-
var log =
|
|
577
|
+
var log = globalThis.DX_LOG ??= createLog();
|
|
607
578
|
var start = Date.now();
|
|
608
579
|
var last = start;
|
|
609
580
|
var debug = (label, args) => {
|
|
@@ -620,26 +591,102 @@ var debug = (label, args) => {
|
|
|
620
591
|
};
|
|
621
592
|
var getFormattedStackTrace = () => new Error().stack.split("\n").slice(3).join("\n");
|
|
622
593
|
|
|
623
|
-
// src/
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
594
|
+
// src/index.ts
|
|
595
|
+
__reExport(index_exports, processors_exports);
|
|
596
|
+
|
|
597
|
+
// src/meta.ts
|
|
598
|
+
var LOG_META_MARKER = "~LogMeta";
|
|
599
|
+
var isLogMeta = (value) => {
|
|
600
|
+
return value != null && typeof value === "object" && value[LOG_META_MARKER] === LOG_META_MARKER;
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
// src/dbg.ts
|
|
604
|
+
var dbg = (arg, meta) => {
|
|
605
|
+
if (meta?.A) {
|
|
606
|
+
console.log(`${meta.A[0]} =`, arg);
|
|
633
607
|
} else {
|
|
634
|
-
|
|
635
|
-
}
|
|
636
|
-
return
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
var
|
|
608
|
+
console.log(arg);
|
|
609
|
+
}
|
|
610
|
+
return arg;
|
|
611
|
+
};
|
|
612
|
+
|
|
613
|
+
// src/log-buffer.ts
|
|
614
|
+
import { CircularBuffer } from "@dxos/util";
|
|
615
|
+
var DEFAULT_BUFFER_SIZE = 2e3;
|
|
616
|
+
var MAX_CONTEXT_LENGTH = 500;
|
|
617
|
+
var LogBuffer = class {
|
|
618
|
+
_buffer;
|
|
619
|
+
constructor(size = DEFAULT_BUFFER_SIZE) {
|
|
620
|
+
this._buffer = new CircularBuffer(size);
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* Log processor that can be registered with `log.runtimeConfig.processors`.
|
|
624
|
+
* Captures every level except TRACE (does not apply `shouldLog` / filter; use for full debug dumps).
|
|
625
|
+
*/
|
|
626
|
+
logProcessor = (_config, entry) => {
|
|
627
|
+
if (entry.level <= LogLevel.TRACE) {
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
630
|
+
const { filename, line, context: scopeName } = entry.computedMeta;
|
|
631
|
+
const record = {
|
|
632
|
+
t: new Date(entry.timestamp).toISOString(),
|
|
633
|
+
l: shortLevelName[entry.level] ?? "?",
|
|
634
|
+
m: entry.message ?? ""
|
|
635
|
+
};
|
|
636
|
+
if (filename !== void 0) {
|
|
637
|
+
record.f = filename;
|
|
638
|
+
}
|
|
639
|
+
if (line !== void 0) {
|
|
640
|
+
record.n = line;
|
|
641
|
+
}
|
|
642
|
+
if (scopeName !== void 0) {
|
|
643
|
+
record.o = scopeName;
|
|
644
|
+
}
|
|
645
|
+
if (entry.computedError !== void 0) {
|
|
646
|
+
record.e = entry.computedError;
|
|
647
|
+
}
|
|
648
|
+
const computedContext = entry.computedContext;
|
|
649
|
+
if (Object.keys(computedContext).length > 0) {
|
|
650
|
+
try {
|
|
651
|
+
let json = JSON.stringify(computedContext);
|
|
652
|
+
if (json.length > MAX_CONTEXT_LENGTH) {
|
|
653
|
+
json = json.slice(0, MAX_CONTEXT_LENGTH);
|
|
654
|
+
}
|
|
655
|
+
record.c = json;
|
|
656
|
+
} catch {
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
this._buffer.push(record);
|
|
660
|
+
};
|
|
661
|
+
/** Number of entries currently in the buffer. */
|
|
662
|
+
get size() {
|
|
663
|
+
return this._buffer.elementCount;
|
|
664
|
+
}
|
|
665
|
+
/** Discard all buffered entries. */
|
|
666
|
+
clear() {
|
|
667
|
+
this._buffer.clear();
|
|
668
|
+
}
|
|
669
|
+
/** Serialize buffer contents as NDJSON (newline-delimited JSON). */
|
|
670
|
+
serialize() {
|
|
671
|
+
const lines = [];
|
|
672
|
+
for (const record of this._buffer) {
|
|
673
|
+
lines.push(JSON.stringify(record));
|
|
674
|
+
}
|
|
675
|
+
return lines.join("\n");
|
|
676
|
+
}
|
|
677
|
+
};
|
|
678
|
+
|
|
679
|
+
// src/experimental/ownership.ts
|
|
680
|
+
import { inspect as inspect3 } from "node:util";
|
|
681
|
+
var kDebugInfoProperties = /* @__PURE__ */ Symbol("kDebugInfoProperties");
|
|
642
682
|
var OwnershipScope = class {
|
|
683
|
+
constr;
|
|
684
|
+
parent;
|
|
685
|
+
instance;
|
|
686
|
+
constructor(constr, parent) {
|
|
687
|
+
this.constr = constr;
|
|
688
|
+
this.parent = parent;
|
|
689
|
+
}
|
|
643
690
|
getInfo() {
|
|
644
691
|
if (!this.instance) {
|
|
645
692
|
return {};
|
|
@@ -651,45 +698,42 @@ var OwnershipScope = class {
|
|
|
651
698
|
}
|
|
652
699
|
return info;
|
|
653
700
|
}
|
|
654
|
-
[
|
|
701
|
+
[inspect3.custom]() {
|
|
655
702
|
return {
|
|
656
703
|
className: this.constr.name,
|
|
657
704
|
info: this.getInfo(),
|
|
658
705
|
parent: this.parent
|
|
659
706
|
};
|
|
660
707
|
}
|
|
661
|
-
constructor(constr, parent) {
|
|
662
|
-
_define_property(this, "constr", void 0);
|
|
663
|
-
_define_property(this, "parent", void 0);
|
|
664
|
-
_define_property(this, "instance", void 0);
|
|
665
|
-
this.constr = constr;
|
|
666
|
-
this.parent = parent;
|
|
667
|
-
}
|
|
668
708
|
};
|
|
669
709
|
var getCurrentOwnershipScope = (thisRef) => thisRef;
|
|
670
710
|
export {
|
|
671
711
|
BROWSER_PROCESSOR,
|
|
672
|
-
CONSOLE_PROCESSOR,
|
|
673
712
|
DEBUG_PROCESSOR,
|
|
674
|
-
DEFAULT_FORMATTER,
|
|
675
713
|
FILE_PROCESSOR,
|
|
714
|
+
LOG_META_MARKER,
|
|
715
|
+
LogBuffer,
|
|
716
|
+
LogEntry,
|
|
676
717
|
LogLevel,
|
|
677
718
|
LogProcessorType,
|
|
678
|
-
SHORT_FORMATTER,
|
|
679
719
|
createFileProcessor,
|
|
720
|
+
createLog,
|
|
721
|
+
dbg,
|
|
680
722
|
debug,
|
|
681
723
|
gatherLogInfoFromScope,
|
|
682
724
|
getContextFromEntry,
|
|
683
725
|
getCurrentOwnershipScope,
|
|
684
726
|
getRelativeFilename,
|
|
727
|
+
inferEnvironmentName,
|
|
728
|
+
isLogMeta,
|
|
685
729
|
levels,
|
|
686
730
|
log,
|
|
687
731
|
logInfo,
|
|
688
732
|
omit,
|
|
689
733
|
parseFilter,
|
|
690
734
|
pick,
|
|
735
|
+
serializeToJsonl,
|
|
691
736
|
shortLevelName,
|
|
692
|
-
shouldLog
|
|
693
|
-
truncate
|
|
737
|
+
shouldLog
|
|
694
738
|
};
|
|
695
739
|
//# sourceMappingURL=index.mjs.map
|