@dxos/log 0.8.4-main.84f28bd → 0.8.4-main.a4bbb77

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.
@@ -5,7 +5,7 @@ import omit from "lodash.omit";
5
5
  import { pick } from "@dxos/util";
6
6
 
7
7
  // src/config.ts
8
- var LogLevel = /* @__PURE__ */ function(LogLevel2) {
8
+ var LogLevel = /* @__PURE__ */ (function(LogLevel2) {
9
9
  LogLevel2[LogLevel2["TRACE"] = 5] = "TRACE";
10
10
  LogLevel2[LogLevel2["DEBUG"] = 10] = "DEBUG";
11
11
  LogLevel2[LogLevel2["VERBOSE"] = 11] = "VERBOSE";
@@ -13,7 +13,7 @@ var LogLevel = /* @__PURE__ */ function(LogLevel2) {
13
13
  LogLevel2[LogLevel2["WARN"] = 13] = "WARN";
14
14
  LogLevel2[LogLevel2["ERROR"] = 14] = "ERROR";
15
15
  return LogLevel2;
16
- }({});
16
+ })({});
17
17
  var levels = {
18
18
  trace: 5,
19
19
  debug: 10,
@@ -30,17 +30,18 @@ var shortLevelName = {
30
30
  [13]: "W",
31
31
  [14]: "E"
32
32
  };
33
- var LogProcessorType = /* @__PURE__ */ function(LogProcessorType2) {
33
+ var LogProcessorType = /* @__PURE__ */ (function(LogProcessorType2) {
34
34
  LogProcessorType2["CONSOLE"] = "console";
35
35
  LogProcessorType2["BROWSER"] = "browser";
36
36
  LogProcessorType2["DEBUG"] = "debug";
37
37
  return LogProcessorType2;
38
- }({});
38
+ })({});
39
39
 
40
40
  // src/scope.ts
41
41
  var logInfoProperties = Symbol("logInfoProperties");
42
42
  var logInfo = (target, propertyKey, descriptor) => {
43
- (target[logInfoProperties] ??= []).push(propertyKey);
43
+ var _target, _logInfoProperties;
44
+ ((_target = target)[_logInfoProperties = logInfoProperties] ?? (_target[_logInfoProperties] = [])).push(propertyKey);
44
45
  };
45
46
  var gatherLogInfoFromScope = (scope) => {
46
47
  if (!scope) {
@@ -48,7 +49,7 @@ var gatherLogInfoFromScope = (scope) => {
48
49
  }
49
50
  const res = {};
50
51
  const prototype = Object.getPrototypeOf(scope);
51
- const infoProps = prototype[logInfoProperties] ?? [];
52
+ const infoProps = (typeof prototype === "object" && prototype !== null ? prototype[logInfoProperties] : []) ?? [];
52
53
  for (const prop of infoProps) {
53
54
  try {
54
55
  res[prop] = typeof scope[prop] === "function" ? scope[prop]() : scope[prop];
@@ -91,18 +92,16 @@ var getContextFromEntry = (entry) => {
91
92
  }
92
93
  }
93
94
  if (entry.error) {
94
- const errorContext = entry.error.context;
95
95
  context = Object.assign(context ?? {}, {
96
- error: entry.error,
97
- ...errorContext
96
+ error: entry.error
98
97
  });
99
98
  }
100
99
  return context && Object.keys(context).length > 0 ? context : void 0;
101
100
  };
102
101
 
103
102
  // src/decorators.ts
104
- import chalk from "chalk";
105
103
  import { inspect } from "node:util";
104
+ import chalk from "chalk";
106
105
  var nextPromiseId = 0;
107
106
  var createMethodLogDecorator = (log2) => (arg0, arg1, meta) => (target, propertyKey, descriptor) => {
108
107
  const method = descriptor.value;
@@ -213,8 +212,8 @@ var formatPromise = (id) => chalk.blue(`Promise#${id}`);
213
212
  import defaultsDeep from "lodash.defaultsdeep";
214
213
 
215
214
  // src/platform/node/index.ts
216
- import yaml from "js-yaml";
217
215
  import fs from "node:fs";
216
+ import yaml from "js-yaml";
218
217
  var loadOptions = (filepath) => {
219
218
  if (filepath) {
220
219
  try {
@@ -229,8 +228,8 @@ var loadOptions = (filepath) => {
229
228
  };
230
229
 
231
230
  // src/processors/console-processor.ts
232
- import chalk2 from "chalk";
233
231
  import { inspect as inspect2 } from "node:util";
232
+ import chalk2 from "chalk";
234
233
  import { getPrototypeSpecificInstanceId, pickBy } from "@dxos/util";
235
234
 
236
235
  // src/processors/common.ts
@@ -262,8 +261,10 @@ var DEFAULT_FORMATTER = (config, { path, line, level, message, context, error, s
262
261
  let instance;
263
262
  if (scope) {
264
263
  const prototype = Object.getPrototypeOf(scope);
265
- const id = getPrototypeSpecificInstanceId(scope);
266
- instance = chalk2.magentaBright(`${prototype.constructor.name}#${id}`);
264
+ if (prototype !== null) {
265
+ const id = getPrototypeSpecificInstanceId(scope);
266
+ instance = chalk2.magentaBright(`${prototype.constructor.name}#${id}`);
267
+ }
267
268
  }
268
269
  const formattedTimestamp = config.options?.formatter?.timestamp ? (/* @__PURE__ */ new Date()).toISOString() : void 0;
269
270
  const formattedLevel = chalk2[LEVEL_COLORS[level]](column ? shortLevelName[level] : LogLevel[level]);
@@ -369,11 +370,15 @@ var APP_BROWSER_PROCESSOR = (config, entry) => {
369
370
  const processPrefix = entry.meta.S?.hostSessionId ? "[worker] " : "";
370
371
  args.push(`%c${processPrefix}${scopeName}`, "color:#C026D3;font-weight:bold");
371
372
  }
372
- args.push(entry.message);
373
+ if (entry.message) {
374
+ args.push(entry.message);
375
+ }
373
376
  const context = getContextFromEntry(entry);
374
377
  if (context) {
375
378
  if (Object.keys(context).length === 1 && "error" in context) {
376
379
  args.push(context.error);
380
+ } else if (Object.keys(context).length === 1 && "err" in context) {
381
+ args.push(context.err);
377
382
  } else {
378
383
  args.push(context);
379
384
  }
@@ -495,7 +500,7 @@ var createFileProcessor = ({ pathOrFd, levels: levels2, filters }) => {
495
500
  };
496
501
  var logFilePath;
497
502
  var getLogFilePath = () => {
498
- logFilePath ??= process.env.LOG_FILE ?? (process.env.HOME ? `${process.env.HOME}/.dxlog/${(/* @__PURE__ */ new Date()).toISOString()}.log` : void 0);
503
+ logFilePath ?? (logFilePath = process.env.LOG_FILE ?? (process.env.HOME ? `${process.env.HOME}/.dxlog/${(/* @__PURE__ */ new Date()).toISOString()}.log` : void 0));
499
504
  return logFilePath;
500
505
  };
501
506
  var FILE_PROCESSOR = createFileProcessor({
@@ -557,6 +562,7 @@ var getConfig = (options) => {
557
562
  };
558
563
 
559
564
  // src/log.ts
565
+ var _globalThis;
560
566
  var createLog = () => {
561
567
  const log2 = (...params) => processLog(LogLevel.DEBUG, ...params);
562
568
  log2._config = getConfig();
@@ -580,7 +586,7 @@ var createLog = () => {
580
586
  log2.info = (...params) => processLog(LogLevel.INFO, ...params);
581
587
  log2.warn = (...params) => processLog(LogLevel.WARN, ...params);
582
588
  log2.error = (...params) => processLog(LogLevel.ERROR, ...params);
583
- log2.catch = (error, context, meta) => processLog(LogLevel.ERROR, error?.message ?? String(error), context, meta, error);
589
+ log2.catch = (error, context, meta) => processLog(LogLevel.ERROR, void 0, context, meta, error);
584
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");
585
591
  log2.stack = (message, context, meta) => processLog(LogLevel.INFO, `${message ?? "Stack Dump"}
586
592
  ${getFormattedStackTrace()}`, context, meta);
@@ -597,7 +603,7 @@ ${getFormattedStackTrace()}`, context, meta);
597
603
  };
598
604
  return log2;
599
605
  };
600
- var log = globalThis.dx_log ??= createLog();
606
+ var log = (_globalThis = globalThis).dx_log ?? (_globalThis.dx_log = createLog());
601
607
  var start = Date.now();
602
608
  var last = start;
603
609
  var debug = (label, args) => {
@@ -616,14 +622,24 @@ var getFormattedStackTrace = () => new Error().stack.split("\n").slice(3).join("
616
622
 
617
623
  // src/experimental/ownership.ts
618
624
  import { inspect as inspect4 } from "node:util";
625
+ function _define_property(obj, key, value) {
626
+ if (key in obj) {
627
+ Object.defineProperty(obj, key, {
628
+ value,
629
+ enumerable: true,
630
+ configurable: true,
631
+ writable: true
632
+ });
633
+ } else {
634
+ obj[key] = value;
635
+ }
636
+ return obj;
637
+ }
619
638
  var kOwnershipScope = Symbol("kOwnershipScope");
620
639
  var kCurrentOwnershipScope = Symbol("kCurrentOwnershipScope");
621
640
  var kDebugInfoProperties = Symbol("kDebugInfoProperties");
641
+ var _inspect_custom = inspect4.custom;
622
642
  var OwnershipScope = class {
623
- constructor(constr, parent) {
624
- this.constr = constr;
625
- this.parent = parent;
626
- }
627
643
  getInfo() {
628
644
  if (!this.instance) {
629
645
  return {};
@@ -635,13 +651,20 @@ var OwnershipScope = class {
635
651
  }
636
652
  return info;
637
653
  }
638
- [inspect4.custom]() {
654
+ [_inspect_custom]() {
639
655
  return {
640
656
  className: this.constr.name,
641
657
  info: this.getInfo(),
642
658
  parent: this.parent
643
659
  };
644
660
  }
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
+ }
645
668
  };
646
669
  var getCurrentOwnershipScope = (thisRef) => thisRef;
647
670
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/index.ts", "../../../src/config.ts", "../../../src/scope.ts", "../../../src/context.ts", "../../../src/decorators.ts", "../../../src/options.ts", "../../../src/platform/node/index.ts", "../../../src/processors/console-processor.ts", "../../../src/processors/common.ts", "../../../src/processors/debug-processor.ts", "../../../src/processors/browser-processor.ts", "../../../src/processors/file-processor.ts", "../../../src/log.ts", "../../../src/experimental/ownership.ts"],
4
- "sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nimport omit from 'lodash.omit';\n\nimport { pick } from '@dxos/util';\n\nexport { omit, pick };\n\nexport * from './config';\nexport * from './context';\nexport * from './log';\nexport { parseFilter } from './options';\nexport * from './processors';\nexport * from './scope';\nexport * from './meta';\n\nexport { getCurrentOwnershipScope } from './experimental/ownership';\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { type LogProcessor } from './context';\n\n/**\n * Standard levels.\n */\n// NOTE: Keep aligned with LogLevel in @dxos/protocols.\n// TODO(burdon): Update numbers?\nexport enum LogLevel {\n TRACE = 5,\n DEBUG = 10,\n VERBOSE = 11,\n INFO = 12,\n WARN = 13,\n ERROR = 14,\n}\n\nexport const levels: { [index: string]: LogLevel } = {\n trace: LogLevel.TRACE,\n debug: LogLevel.DEBUG,\n verbose: LogLevel.VERBOSE,\n info: LogLevel.INFO,\n warn: LogLevel.WARN,\n error: LogLevel.ERROR,\n};\n\nexport const shortLevelName = {\n [LogLevel.TRACE]: 'T',\n [LogLevel.DEBUG]: 'D',\n [LogLevel.VERBOSE]: 'V',\n [LogLevel.INFO]: 'I',\n [LogLevel.WARN]: 'W',\n [LogLevel.ERROR]: 'E',\n};\n\nexport enum LogProcessorType {\n CONSOLE = 'console',\n BROWSER = 'browser',\n DEBUG = 'debug',\n}\n\n/**\n * Individual filter condition.\n */\nexport type LogFilter = {\n level: LogLevel;\n pattern?: string;\n};\n\n/**\n * Options to set inline or load from the YML file.\n */\nexport type LogOptions = {\n file?: string;\n filter?: string | string[] | LogLevel;\n captureFilter?: string | string[] | LogLevel;\n depth?: number; // Context object depth.\n processor?: string | LogProcessorType;\n formatter?: {\n column: number;\n timestamp: boolean;\n timestampFirst: boolean;\n };\n prefix?: string;\n};\n\n/**\n * Runtime config.\n */\nexport interface LogConfig {\n options: LogOptions;\n filters?: LogFilter[];\n captureFilters?: LogFilter[];\n processors: LogProcessor[];\n prefix?: string;\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nconst logInfoProperties = Symbol('logInfoProperties');\n\n/**\n * Decorate fields, properties, or methods to automatically include their values in log messages.\n *\n * Example:\n *\n * ```typescript\n * class Example {\n * @logInfo\n * peerId: PublicKey;\n * }\n * ```\n */\nexport const logInfo = (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => {\n // console.log(target, propertyKey, descriptor);\n (target[logInfoProperties] ??= []).push(propertyKey);\n};\n\n/**\n * Introspects class instance to find decorated metadata.\n * @param scope Class instance.\n */\nexport const gatherLogInfoFromScope = (scope: any): Record<string, any> => {\n if (!scope) {\n return {};\n }\n\n const res: Record<string, any> = {};\n\n const prototype = Object.getPrototypeOf(scope);\n const infoProps = prototype[logInfoProperties] ?? [];\n for (const prop of infoProps) {\n try {\n res[prop] = typeof scope[prop] === 'function' ? scope[prop]() : scope[prop];\n } catch (err: any) {\n res[prop] = err.message;\n }\n }\n\n return res;\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { type LogConfig, type LogFilter, type LogLevel } from './config';\nimport { type CallMetadata } from './meta';\nimport { gatherLogInfoFromScope } from './scope';\n\n/**\n * Optional object passed to the logging API.\n */\nexport type LogContext = Record<string, any> | Error | any;\n\n/**\n * Record for current log line.\n */\nexport interface LogEntry {\n level: LogLevel;\n message: string;\n context?: LogContext;\n meta?: CallMetadata;\n error?: Error;\n}\n\n/**\n * Processes (e.g., prints, forwards) log entries.\n */\nexport type LogProcessor = (config: LogConfig, entry: LogEntry) => void;\n\nconst matchFilter = (filter: LogFilter, level: LogLevel, path: string) => {\n return level >= filter.level && (!filter.pattern || path.includes(filter.pattern));\n};\n\n/**\n * Determines if the current line should be logged (called by the processor).\n */\nexport const shouldLog = (entry: LogEntry, filters?: LogFilter[]): boolean => {\n if (filters === undefined) {\n return true;\n } else {\n return filters.some((filter) => matchFilter(filter, entry.level, entry.meta?.F ?? ''));\n }\n};\n\nexport const getContextFromEntry = (entry: LogEntry): Record<string, any> | undefined => {\n let context;\n if (entry.meta) {\n const scopeInfo = gatherLogInfoFromScope(entry.meta.S);\n if (Object.keys(scopeInfo).length > 0) {\n context = Object.assign(context ?? {}, scopeInfo);\n }\n }\n\n const entryContext = typeof entry.context === 'function' ? entry.context() : entry.context;\n if (entryContext) {\n if (entryContext instanceof Error) {\n // Additional context from Error.\n const c = (entryContext as any).context;\n // If ERROR then show stacktrace.\n context = Object.assign(context ?? {}, { error: entryContext.stack, ...c });\n } else if (typeof entryContext === 'object') {\n context = Object.assign(context ?? {}, entryContext);\n }\n }\n\n if (entry.error) {\n const errorContext = (entry.error as any).context;\n context = Object.assign(context ?? {}, { error: entry.error, ...errorContext });\n }\n\n return context && Object.keys(context).length > 0 ? context : undefined;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport chalk from 'chalk';\nimport { inspect } from 'node:util';\n\nimport type { LogMethods } from './log';\nimport { type CallMetadata } from './meta';\n\nlet nextPromiseId = 0;\n\nexport const createMethodLogDecorator =\n (log: LogMethods) =>\n (arg0?: never, arg1?: never, meta?: CallMetadata): MethodDecorator =>\n (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n const method = descriptor.value!;\n const methodName = propertyKey as string;\n descriptor.value = function (this: any, ...args: any) {\n const combinedMeta = {\n F: '',\n L: 0,\n ...(meta ?? {}),\n S: this as any,\n } as CallMetadata;\n\n const formattedArgs = args.map((arg: any) => inspect(arg, false, 1, true)).join(', ');\n\n try {\n const startTime = performance.now();\n const result = method.apply(this, args);\n\n if (isThenable(result)) {\n const id = nextPromiseId++;\n logAsyncBegin(log, methodName, formattedArgs, id, combinedMeta);\n result.then(\n (resolvedValue) => {\n logAsyncResolved(log, methodName, resolvedValue, id, startTime, combinedMeta);\n },\n (err) => {\n logAsyncRejected(log, methodName, err, id, startTime, combinedMeta);\n },\n );\n } else {\n logSyncCall(log, methodName, formattedArgs, result, combinedMeta);\n }\n\n return result;\n } catch (err: any) {\n logSyncError(log, methodName, formattedArgs, err, combinedMeta);\n throw err;\n }\n };\n Object.defineProperty(descriptor.value, 'name', { value: methodName + '$log' });\n };\n\nexport const createFunctionLogDecorator =\n (log: LogMethods) =>\n <F extends (...args: any[]) => any>(\n name: string,\n fn: F,\n opts: { transformOutput?: (result: ReturnType<F>) => Promise<any> | any } = {},\n ): F => {\n const decoratedFn = function (this: any, ...args: any) {\n const combinedMeta = {\n F: '',\n L: 0,\n } as CallMetadata;\n\n const formattedArgs = args.map((arg: any) => inspect(arg, false, 1, true)).join(', ');\n\n try {\n const startTime = performance.now();\n const result = fn.apply(this, args);\n\n let transformedResult = result;\n if (opts.transformOutput) {\n if (isThenable(result)) {\n transformedResult = result.then(opts.transformOutput as any);\n } else {\n transformedResult = opts.transformOutput(result);\n }\n }\n\n if (isThenable(transformedResult)) {\n const id = nextPromiseId++;\n logAsyncBegin(log, name, formattedArgs, id, combinedMeta);\n transformedResult.then(\n (resolvedValue) => {\n logAsyncResolved(log, name, resolvedValue, id, startTime, combinedMeta);\n },\n (err) => {\n logAsyncRejected(log, name, err, id, startTime, combinedMeta);\n },\n );\n } else {\n logSyncCall(log, name, formattedArgs, transformedResult, combinedMeta);\n }\n\n return result;\n } catch (err: any) {\n logSyncError(log, name, formattedArgs, err, combinedMeta);\n throw err;\n }\n };\n Object.defineProperty(decoratedFn, 'name', { value: name + '$log' });\n return decoratedFn as F;\n };\n\nconst isThenable = (obj: any): obj is Promise<unknown> => obj && typeof obj.then === 'function';\n\nconst logSyncCall = (\n log: LogMethods,\n methodName: string,\n formattedArgs: string,\n result: unknown,\n combinedMeta: CallMetadata,\n) => {\n log.info(\n `.${formatFunction(methodName)} (${formattedArgs}) ${chalk.gray('=>')} ${inspect(result, false, 1, true)}`,\n {},\n combinedMeta,\n );\n};\n\nconst logSyncError = (\n log: LogMethods,\n methodName: string,\n formattedArgs: string,\n err: Error,\n combinedMeta: CallMetadata,\n) => {\n log.error(`.${formatFunction(methodName)} (${formattedArgs}) 🔥 ${err}`, {}, combinedMeta);\n};\n\nconst logAsyncBegin = (\n log: LogMethods,\n methodName: string,\n formattedArgs: string,\n promiseId: number,\n combinedMeta: CallMetadata,\n) => {\n log.info(\n `.${formatFunction(methodName)} ↴ (${formattedArgs}) ${chalk.gray('=>')} ${formatPromise(promiseId)}`,\n {},\n combinedMeta,\n );\n};\n\nconst logAsyncResolved = (\n log: LogMethods,\n methodName: string,\n resolvedValue: unknown | undefined,\n promiseId: number,\n startTime: number,\n combinedMeta: CallMetadata,\n) => {\n if (resolvedValue !== undefined) {\n log.info(\n `.${formatFunction(methodName)} ↲ ${greenCheck} ${chalk.gray('resolve')} ${formatPromise(promiseId)} ${formatTimeElapsed(startTime)} ${chalk.gray('=>')} ${inspect(\n resolvedValue,\n false,\n 1,\n true,\n )}`,\n {},\n combinedMeta,\n );\n } else {\n log.info(\n `.${formatFunction(methodName)} ↲ ${greenCheck} ${chalk.gray('resolve')} ${formatPromise(promiseId)} ${formatTimeElapsed(startTime)}`,\n {},\n combinedMeta,\n );\n }\n};\n\nconst logAsyncRejected = (\n log: LogMethods,\n methodName: string,\n err: Error,\n promiseId: number,\n startTime: number,\n combinedMeta: CallMetadata,\n) => {\n log.info(\n `.${formatFunction(methodName)} ↲ 🔥 ${chalk.gray('reject')} ${formatPromise(promiseId)} ${formatTimeElapsed(startTime)} ${chalk.gray('=>')} ${err}`,\n {},\n combinedMeta,\n );\n};\n\n// https://github.com/dxos/dxos/issues/7286\nconst greenCheck = typeof chalk.green === 'function' ? chalk.green('✔') : '✔';\n\nconst formatTimeElapsed = (startTime: number) => chalk.gray(`${(performance.now() - startTime).toFixed(0)}ms`);\n\nconst COLOR_FUNCTION = [220, 220, 170] as const;\n\nconst formatFunction = (name: string) => chalk.bold(chalk.rgb(...COLOR_FUNCTION)(name));\n\nconst formatPromise = (id: number) => chalk.blue(`Promise#${id}`);\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport defaultsDeep from 'lodash.defaultsdeep';\n\nimport { type LogConfig, type LogFilter, LogLevel, type LogOptions, LogProcessorType, levels } from './config';\nimport { type LogProcessor } from './context';\nimport { loadOptions } from './platform';\nimport { CONSOLE_PROCESSOR, DEBUG_PROCESSOR, BROWSER_PROCESSOR } from './processors';\n\n/**\n * Processor variants.\n */\nexport const processors: { [index: string]: LogProcessor } = {\n [LogProcessorType.CONSOLE]: CONSOLE_PROCESSOR,\n [LogProcessorType.BROWSER]: BROWSER_PROCESSOR,\n [LogProcessorType.DEBUG]: DEBUG_PROCESSOR,\n};\n\nconst IS_BROWSER = typeof window !== 'undefined' || typeof navigator !== 'undefined';\n\nexport const DEFAULT_PROCESSORS = [IS_BROWSER ? BROWSER_PROCESSOR : CONSOLE_PROCESSOR];\n\nexport const parseFilter = (filter: string | string[] | LogLevel): LogFilter[] => {\n if (typeof filter === 'number') {\n return [{ level: filter }];\n }\n\n const parseLogLevel = (level: string, defValue = LogLevel.WARN) => levels[level.toLowerCase()] ?? defValue;\n\n const lines = typeof filter === 'string' ? filter.split(/,\\s*/) : filter;\n return lines.map((filter) => {\n const [pattern, level] = filter.split(':');\n return level ? { level: parseLogLevel(level), pattern } : { level: parseLogLevel(pattern) };\n });\n};\n\nexport const getConfig = (options?: LogOptions): LogConfig => {\n const nodeOptions: LogOptions | undefined =\n 'process' in globalThis\n ? {\n file: process!.env.LOG_CONFIG,\n filter: process!.env.LOG_FILTER,\n processor: process!.env.LOG_PROCESSOR,\n }\n : undefined;\n\n const mergedOptions: LogOptions = defaultsDeep({}, loadOptions(nodeOptions?.file), nodeOptions, options);\n return {\n options: mergedOptions,\n filters: parseFilter(mergedOptions.filter ?? LogLevel.INFO),\n captureFilters: parseFilter(mergedOptions.captureFilter ?? LogLevel.WARN),\n processors: mergedOptions.processor ? [processors[mergedOptions.processor]] : DEFAULT_PROCESSORS,\n prefix: mergedOptions.prefix,\n };\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport yaml from 'js-yaml';\nimport fs from 'node:fs';\n\nimport { type LogOptions } from '../../config';\n\n/**\n * Node config loader.\n */\nexport const loadOptions = (filepath?: string): LogOptions | undefined => {\n if (filepath) {\n // console.log(`Log file: ${fullpath}`);\n try {\n const text = fs.readFileSync(filepath, 'utf-8');\n if (text) {\n return yaml.load(text) as LogOptions;\n }\n } catch (err) {\n console.warn(`Invalid log file: ${filepath}`);\n }\n }\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport chalk from 'chalk';\nimport { inspect } from 'node:util';\n\nimport { getPrototypeSpecificInstanceId, pickBy } from '@dxos/util';\n\nimport { getRelativeFilename } from './common';\nimport { type LogConfig, LogLevel, shortLevelName } from '../config';\nimport { getContextFromEntry, type LogProcessor, shouldLog } from '../context';\n\nconst LEVEL_COLORS: Record<LogLevel, typeof chalk.ForegroundColor> = {\n [LogLevel.TRACE]: 'gray',\n [LogLevel.DEBUG]: 'gray',\n [LogLevel.VERBOSE]: 'gray',\n [LogLevel.INFO]: 'white',\n [LogLevel.WARN]: 'yellow',\n [LogLevel.ERROR]: 'red',\n};\n\nexport const truncate = (text?: string, length = 0, right = false) => {\n const str = text && length ? (right ? text.slice(-length) : text.substring(0, length)) : text ?? '';\n return right ? str.padStart(length, ' ') : str.padEnd(length, ' ');\n};\n\n// TODO(burdon): Optional package name.\n// TODO(burdon): Show exceptions on one line.\nexport type FormatParts = {\n path?: string;\n line?: number;\n timestamp?: string;\n level: LogLevel;\n message: string;\n context?: any;\n error?: Error;\n scope?: any;\n};\n\nexport type Formatter = (config: LogConfig, parts: FormatParts) => (string | undefined)[];\n\nexport const DEFAULT_FORMATTER: Formatter = (\n config,\n { path, line, level, message, context, error, scope },\n): string[] => {\n const column = config.options?.formatter?.column;\n const filepath = path !== undefined && line !== undefined ? chalk.grey(`${path}:${line}`) : undefined;\n\n let instance;\n if (scope) {\n const prototype = Object.getPrototypeOf(scope);\n const id = getPrototypeSpecificInstanceId(scope);\n instance = chalk.magentaBright(`${prototype.constructor.name}#${id}`);\n }\n\n const formattedTimestamp = config.options?.formatter?.timestamp ? new Date().toISOString() : undefined;\n const formattedLevel = chalk[LEVEL_COLORS[level]](column ? shortLevelName[level] : LogLevel[level]);\n const padding = column && filepath ? ''.padStart(column - filepath.length) : undefined;\n\n return config.options?.formatter?.timestampFirst\n ? [formattedTimestamp, filepath, padding, formattedLevel, instance, message, context, error]\n : [\n // NOTE: File path must come fist for console hyperlinks.\n // Must not truncate for terminal output.\n filepath,\n padding,\n formattedTimestamp,\n formattedLevel,\n instance,\n message,\n context,\n error,\n ];\n};\n\nexport const SHORT_FORMATTER: Formatter = (config, { path, level, message }) => {\n return [\n chalk.grey(truncate(path, 16, true)), // NOTE: Breaks terminal linking.\n chalk[LEVEL_COLORS[level]](shortLevelName[level]),\n message,\n ];\n};\n\n// TODO(burdon): Config option.\nconst formatter = DEFAULT_FORMATTER;\n\nexport const CONSOLE_PROCESSOR: LogProcessor = (config, entry) => {\n const { level, message, meta, error } = entry;\n if (!shouldLog(entry, config.filters)) {\n return;\n }\n\n const parts: FormatParts = {\n level,\n message,\n error,\n path: undefined,\n line: undefined,\n scope: undefined,\n context: undefined,\n };\n\n if (meta) {\n parts.path = getRelativeFilename(meta.F);\n parts.line = meta.L;\n parts.scope = meta.S;\n }\n\n const context = getContextFromEntry(entry);\n if (context) {\n // Remove undefined fields.\n // https://nodejs.org/api/util.html#utilinspectobject-options\n parts.context = inspect(\n pickBy(context, (value?: unknown) => value !== undefined),\n { depth: config.options.depth, colors: true, maxArrayLength: 8, sorted: false },\n );\n }\n\n const line = formatter(config, parts).filter(Boolean).join(' ');\n console.log(line);\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nexport const getRelativeFilename = (filename: string) => {\n // TODO(burdon): Hack uses \"packages\" as an anchor (pre-parse NX?)\n // Including `packages/` part of the path so that excluded paths (e.g. from dist) are clickable in vscode.\n const match = filename.match(/.+\\/(packages\\/.+\\/.+)/);\n if (match) {\n const [, filePath] = match;\n return filePath;\n }\n\n return filename;\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { inspect } from 'node:util';\n\nimport { type LogProcessor } from '../context';\n\nexport const DEBUG_PROCESSOR: LogProcessor = (config, entry) => {\n console.log(inspect(entry, false, null, true));\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { getDebugName, safariCheck } from '@dxos/util';\n\nimport { LogLevel } from '../config';\nimport { getContextFromEntry, type LogProcessor, shouldLog } from '../context';\n\nconst getRelativeFilename = (filename: string) => {\n // TODO(burdon): Hack uses \"packages\" as an anchor (pre-parse NX?)\n // Including `packages/` part of the path so that excluded paths (e.g. from dist) are clickable in vscode.\n const match = filename.match(/.+\\/(packages\\/.+\\/.+)/);\n if (match) {\n const [, filePath] = match;\n return filePath;\n }\n\n return filename;\n};\n\ntype Config = {\n useTestProcessor: boolean;\n printFileLinks: boolean;\n};\n\nconst CONFIG: Config = {\n useTestProcessor: false,\n printFileLinks: false,\n};\n\n/**\n * For running apps in the browser normally.\n */\nconst APP_BROWSER_PROCESSOR: LogProcessor = (config, entry) => {\n if (!shouldLog(entry, config.filters)) {\n return;\n }\n\n // Example local editor prefix: 'vscode://file/Users/burdon/Code/dxos/dxos/'.\n const LOG_BROWSER_PREFIX = config.prefix ?? 'https://vscode.dev/github.com/dxos/dxos/blob/main/';\n\n // TODO(burdon): CSS breaks formatting (e.g., [Object] rather than expandable property).\n // TODO(burdon): Consider custom formatters.\n // https://www.mattzeunert.com/2016/02/19/custom-chrome-devtools-object-formatters.html\n // NOTE: Cannot change color of link (from bright white).\n // const LOG_BROWSER_CSS = ['color:gray; font-size:10px; padding-bottom: 4px', 'color:#B97852; font-size:14px;'];\n const LOG_BROWSER_CSS: string[] = [];\n\n let link = '';\n if (entry.meta) {\n const filename = getRelativeFilename(entry.meta.F);\n const filepath = `${LOG_BROWSER_PREFIX.replace(/\\/$/, '')}/${filename}`;\n // TODO(burdon): Line numbers not working for app link, even with colons.\n // https://stackoverflow.com/a/54459820/2804332\n link = `${filepath}#L${entry.meta.L}`;\n }\n\n let args = [];\n\n if (entry.meta?.S) {\n const scope = entry.meta?.S;\n const scopeName = scope.name || getDebugName(scope);\n const processPrefix = entry.meta.S?.hostSessionId ? '[worker] ' : '';\n // TODO(dmaretskyi): Those can be made clickable with a custom formatter.\n args.push(`%c${processPrefix}${scopeName}`, 'color:#C026D3;font-weight:bold');\n }\n\n args.push(entry.message);\n\n const context = getContextFromEntry(entry);\n if (context) {\n if (Object.keys(context).length === 1 && 'error' in context) {\n args.push(context.error);\n } else {\n args.push(context);\n }\n }\n\n // https://github.com/cloudflare/workers-sdk/issues/5591\n const levels: any = {\n [LogLevel.ERROR]: console.error.bind(console),\n [LogLevel.WARN]: console.warn.bind(console),\n [LogLevel.DEBUG]: console.log.bind(console),\n };\n\n // Safari prints source code location as this file, not the caller.\n if (CONFIG.printFileLinks || safariCheck()) {\n if (LOG_BROWSER_CSS?.length) {\n args = [`%c${link}\\n%c${args.join(' ')}`, ...LOG_BROWSER_CSS];\n } else {\n args = [link + '\\n', ...args];\n }\n }\n\n // https://github.com/cloudflare/workers-sdk/issues/5591\n const level = levels[entry.level] ?? console.log.bind(console);\n if (typeof entry.meta?.C === 'function') {\n entry.meta.C(level, args);\n } else {\n level(...args);\n }\n};\n\n/**\n * For running unit tests in the headless browser.\n */\nconst TEST_BROWSER_PROCESSOR: LogProcessor = (config, entry) => {\n if (!shouldLog(entry, config.filters)) {\n return;\n }\n\n let path = '';\n if (entry.meta) {\n path = `${getRelativeFilename(entry.meta.F)}:${entry.meta.L}`;\n }\n\n let args = [];\n\n const processPrefix = entry.meta?.S?.hostSessionId ? '[worker] ' : '';\n args.push(`${processPrefix}${entry.message}`);\n\n const context = getContextFromEntry(entry);\n if (context) {\n args.push(context);\n }\n\n const levels: any = {\n [LogLevel.ERROR]: console.error,\n [LogLevel.WARN]: console.warn,\n [LogLevel.DEBUG]: console.log,\n };\n\n if (CONFIG.printFileLinks) {\n args = [path, ...args];\n }\n\n const level = levels[entry.level] ?? console.log;\n if (typeof entry.meta?.C === 'function') {\n entry.meta.C(level, args);\n } else {\n level(...args);\n }\n};\n\nexport const BROWSER_PROCESSOR: LogProcessor = CONFIG.useTestProcessor ? TEST_BROWSER_PROCESSOR : APP_BROWSER_PROCESSOR;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { appendFileSync, mkdirSync, openSync } from 'node:fs';\nimport { dirname } from 'node:path';\n\nimport { jsonlogify } from '@dxos/util';\n\nimport { getRelativeFilename } from './common';\nimport { type LogFilter, LogLevel } from '../config';\nimport { type LogProcessor, getContextFromEntry, shouldLog } from '../context';\n\n// Amount of time to retry writing after encountering EAGAIN before giving up.\nconst EAGAIN_MAX_DURATION = 1000;\n/**\n * Create a file processor.\n * @param path - Path to log file to create or append to, or existing open file descriptor e.g. stdout.\n * @param levels - Log levels to process. Takes preference over Filters.\n * @param filters - Filters to apply.\n */\nexport const createFileProcessor = ({\n pathOrFd,\n levels,\n filters,\n}: {\n pathOrFd: string | number;\n levels: LogLevel[];\n filters?: LogFilter[];\n}): LogProcessor => {\n let fd: number | undefined;\n\n return (config, entry) => {\n if (levels.length > 0 && !levels.includes(entry.level)) {\n return;\n }\n if (!shouldLog(entry, filters)) {\n return;\n }\n if (typeof pathOrFd === 'number') {\n fd = pathOrFd;\n } else {\n try {\n mkdirSync(dirname(pathOrFd));\n } catch {}\n fd = openSync(pathOrFd, 'a');\n }\n\n const record = {\n ...entry,\n timestamp: Date.now(),\n ...(entry.meta ? { meta: { file: getRelativeFilename(entry.meta.F), line: entry.meta.L } } : {}),\n context: jsonlogify(getContextFromEntry(entry)),\n };\n let retryTS: number = 0;\n\n // Retry writing if EAGAIN is encountered.\n //\n // Node may set stdout and stderr to non-blocking. https://github.com/nodejs/node/issues/42826\n // This can cause EAGAIN errors when writing to them.\n // In order to not drop logs, make log methods asynchronous, or deal with buffering/delayed writes, spin until write succeeds.\n\n while (true) {\n try {\n return appendFileSync(fd, JSON.stringify(record) + '\\n');\n } catch (err: any) {\n if (err.code !== 'EAGAIN') {\n throw err;\n }\n if (retryTS === 0) {\n retryTS = performance.now();\n } else {\n if (performance.now() - retryTS > EAGAIN_MAX_DURATION) {\n console.log(`could not write after ${EAGAIN_MAX_DURATION}ms of EAGAIN failures, giving up`);\n throw err;\n }\n }\n }\n }\n };\n};\n\nlet logFilePath: string | undefined;\nconst getLogFilePath = () => {\n logFilePath ??=\n process.env.LOG_FILE ??\n (process.env.HOME ? `${process.env.HOME}/.dxlog/${new Date().toISOString()}.log` : undefined);\n\n return logFilePath!;\n};\n\nexport const FILE_PROCESSOR: LogProcessor = createFileProcessor({\n pathOrFd: getLogFilePath(),\n levels: [LogLevel.ERROR, LogLevel.WARN, LogLevel.INFO, LogLevel.TRACE],\n});\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { type LogConfig, LogLevel, type LogOptions } from './config';\nimport { type LogContext, type LogProcessor } from './context';\nimport { createFunctionLogDecorator, createMethodLogDecorator } from './decorators';\nimport { type CallMetadata } from './meta';\nimport { getConfig, DEFAULT_PROCESSORS } from './options';\n\n/**\n * Logging function.\n */\ntype LogFunction = (message: string, context?: LogContext, meta?: CallMetadata) => void;\n\n/**\n * Logging methods.\n */\nexport interface LogMethods {\n trace: LogFunction;\n debug: LogFunction;\n verbose: LogFunction;\n info: LogFunction;\n warn: LogFunction;\n error: LogFunction;\n catch: (error: Error | any, context?: LogContext, meta?: CallMetadata) => void;\n break: () => void;\n stack: (message?: string, context?: never, meta?: CallMetadata) => void;\n method: (arg0?: never, arg1?: never, meta?: CallMetadata) => MethodDecorator;\n func: <F extends (...args: any[]) => any>(\n name: string,\n fn: F,\n opts?: { transformOutput?: (result: ReturnType<F>) => Promise<any> | any },\n ) => F;\n}\n\n/**\n * Properties accessible on the logging function.\n */\ninterface Log extends LogMethods, LogFunction {\n config: (options: LogOptions) => void;\n addProcessor: (processor: LogProcessor) => void;\n runtimeConfig: LogConfig;\n}\n\ninterface LogImp extends Log {\n _config: LogConfig;\n}\n\nconst createLog = (): LogImp => {\n const log: LogImp = ((...params) => processLog(LogLevel.DEBUG, ...params)) as LogImp;\n\n log._config = getConfig();\n Object.defineProperty(log, 'runtimeConfig', { get: () => log._config });\n\n log.addProcessor = (processor: LogProcessor) => {\n if (DEFAULT_PROCESSORS.filter((p) => p === processor).length === 0) {\n DEFAULT_PROCESSORS.push(processor);\n }\n if (log._config.processors.filter((p) => p === processor).length === 0) {\n log._config.processors.push(processor);\n }\n };\n\n // Set config.\n log.config = (options: LogOptions) => {\n log._config = getConfig(options);\n };\n\n // TODO(burdon): API to set context and separate error object.\n // E.g., log.warn('failed', { key: 123 }, err);\n\n log.trace = (...params) => processLog(LogLevel.TRACE, ...params);\n log.debug = (...params) => processLog(LogLevel.DEBUG, ...params);\n log.verbose = (...params) => processLog(LogLevel.VERBOSE, ...params);\n log.info = (...params) => processLog(LogLevel.INFO, ...params);\n log.warn = (...params) => processLog(LogLevel.WARN, ...params);\n log.error = (...params) => processLog(LogLevel.ERROR, ...params);\n\n // Catch only shows error message, not stacktrace.\n log.catch = (error: Error | any, context, meta) =>\n processLog(LogLevel.ERROR, error?.message ?? String(error), context, meta, error);\n\n // Show break.\n log.break = () => log.info('——————————————————————————————————————————————————');\n\n log.stack = (message, context, meta) =>\n processLog(LogLevel.INFO, `${message ?? 'Stack Dump'}\\n${getFormattedStackTrace()}`, context, meta);\n\n log.method = createMethodLogDecorator(log);\n log.func = createFunctionLogDecorator(log);\n\n /**\n * Process the current log call.\n */\n const processLog = (\n level: LogLevel,\n message: string,\n context: LogContext = {},\n meta?: CallMetadata,\n error?: Error,\n ) => {\n log._config.processors.forEach((processor) => processor(log._config, { level, message, context, meta, error }));\n };\n\n return log;\n};\n\n/**\n * Global logging function.\n */\nexport const log: Log = ((globalThis as any).dx_log ??= createLog());\n\nconst start = Date.now();\nlet last = start;\n\n/**\n * Log debug stack.\n */\nexport const debug = (label?: any, args?: any) => {\n const now = Date.now();\n const err = new Error();\n console.group(\n `DEBUG[${label}]`,\n JSON.stringify({ t: Number(now - start).toLocaleString(), dt: Number(now - last).toLocaleString(), ...args }),\n );\n console.warn(err.stack);\n console.groupEnd();\n last = Date.now();\n};\n\n/**\n * Accessible from browser console.\n */\ndeclare global {\n // eslint-disable-next-line camelcase\n const dx_log: Log;\n}\n\nconst getFormattedStackTrace = () => new Error().stack!.split('\\n').slice(3).join('\\n');\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { inspect } from 'node:util';\n\nconst kOwnershipScope = Symbol('kOwnershipScope');\nconst kCurrentOwnershipScope = Symbol('kCurrentOwnershipScope');\nconst kDebugInfoProperties = Symbol('kDebugInfoProperties');\n\n/**\n *\n */\n// TODO(burdon): Document.\nexport class OwnershipScope {\n public instance: any;\n\n constructor(\n public constr: any,\n public parent?: OwnershipScope,\n ) {}\n\n getInfo() {\n if (!this.instance) {\n return {};\n }\n const props = this.constr.prototype[kDebugInfoProperties] ?? [];\n const info: any = {};\n for (const prop of props) {\n info[prop] = this.instance[prop];\n }\n return info;\n }\n\n [inspect.custom]() {\n return {\n className: this.constr.name,\n info: this.getInfo(),\n parent: this.parent,\n };\n }\n}\n\nfunction decorateMethodWeakReturnOwnership(prototype: any, key: string) {\n const original = prototype[key];\n prototype[key] = function (...args: any) {\n const res = original.apply(this, ...args);\n\n if (res && typeof res.then === 'function') {\n res.then((value: any) => {\n if (kOwnershipScope in value) {\n value[kOwnershipScope].parent ??= this[kOwnershipScope];\n }\n });\n } else {\n if (res && kOwnershipScope in res) {\n res[kOwnershipScope].parent ??= this[kOwnershipScope];\n }\n }\n\n return res;\n };\n}\n\nexport function ownershipClass<T extends { new (...args: any[]): {} }>(constr: T) {\n for (const key of Object.getOwnPropertyNames(constr.prototype)) {\n if (key !== 'constructor' && typeof constr.prototype[key] === 'function') {\n decorateMethodWeakReturnOwnership(constr.prototype, key);\n }\n }\n\n return class extends constr {\n constructor(...args: any[]) {\n const currentCausality = (globalThis as any)[kCurrentOwnershipScope];\n (globalThis as any)[kCurrentOwnershipScope] = new OwnershipScope(constr, currentCausality);\n super(...args);\n (this as any)[kOwnershipScope] = (globalThis as any)[kCurrentOwnershipScope];\n (this as any)[kOwnershipScope].instance = this;\n (globalThis as any)[kCurrentOwnershipScope] = currentCausality;\n }\n };\n}\n\nexport const debugInfo = (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {\n // console.log(target, propertyKey, descriptor);\n (target[kDebugInfoProperties] ??= []).push(propertyKey);\n};\n\nexport const getCurrentOwnershipScope = (thisRef: any) => thisRef;\n"],
5
- "mappings": ";;;AAIA,OAAOA,UAAU;AAEjB,SAASC,YAAY;;;ACKd,IAAKC,WAAAA,yBAAAA,WAAAA;;;;;;;SAAAA;;AASL,IAAMC,SAAwC;EACnDC,OAAK;EACLC,OAAK;EACLC,SAAO;EACPC,MAAI;EACJC,MAAI;EACJC,OAAK;AACP;A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EAAGC,KAAK,IAAA;;;ACvIlF,SAASC,WAAAA,gBAAe;AAExB,IAAMC,kBAAkBC,OAAO,iBAAA;AAC/B,IAAMC,yBAAyBD,OAAO,wBAAA;AACtC,IAAME,uBAAuBF,OAAO,sBAAA;AAM7B,IAAMG,iBAAN,MAAMA;EAGX,YACSC,QACAC,QACP;SAFOD,SAAAA;SACAC,SAAAA;EACN;EAEHC,UAAU;AACR,QAAI,CAAC,KAAKC,UAAU;AAClB,aAAO,CAAC;IACV;AACA,UAAMC,QAAQ,KAAKJ,OAAOK,UAAUP,oBAAAA,KAAyB,CAAA;AAC7D,UAAMQ,OAAY,CAAC;AACnB,eAAWC,QAAQH,OAAO;AACxBE,WAAKC,IAAAA,IAAQ,KAAKJ,SAASI,IAAAA;IAC7B;AACA,WAAOD;EACT;EAEA,CAACE,SAAQC,MAAM,IAAI;AACjB,WAAO;MACLC,WAAW,KAAKV,OAAOW;MACvBL,MAAM,KAAKJ,QAAO;MAClBD,QAAQ,KAAKA;IACf;EACF;AACF;AA+CO,IAAMW,2BAA2B,CAACC,YAAiBA;",
6
- "names": ["omit", "pick", "LogLevel", "levels", "trace", "debug", "verbose", "info", "warn", "error", "shortLevelName", "LogProcessorType", "logInfoProperties", "Symbol", "logInfo", "target", "propertyKey", "descriptor", "push", "gatherLogInfoFromScope", "scope", "res", "prototype", "Object", "getPrototypeOf", "infoProps", "prop", "err", "message", "matchFilter", "filter", "level", "path", "pattern", "includes", "shouldLog", "entry", "filters", "undefined", "some", "meta", "F", "getContextFromEntry", "context", "scopeInfo", "gatherLogInfoFromScope", "S", "Object", "keys", "length", "assign", "entryContext", "Error", "c", "error", "stack", "errorContext", "chalk", "inspect", "nextPromiseId", "createMethodLogDecorator", "log", "arg0", "arg1", "meta", "target", "propertyKey", "descriptor", "method", "value", "methodName", "args", "combinedMeta", "F", "L", "S", "formattedArgs", "map", "arg", "inspect", "join", "startTime", "performance", "now", "result", "apply", "isThenable", "id", "logAsyncBegin", "then", "resolvedValue", "logAsyncResolved", "err", "logAsyncRejected", "logSyncCall", "logSyncError", "Object", "defineProperty", "createFunctionLogDecorator", "name", "fn", "opts", "decoratedFn", "transformedResult", "transformOutput", "obj", "info", "formatFunction", "chalk", "gray", "error", "promiseId", "formatPromise", "undefined", "greenCheck", "formatTimeElapsed", "green", "toFixed", "COLOR_FUNCTION", "bold", "rgb", "blue", "defaultsDeep", "yaml", "fs", "loadOptions", "filepath", "text", "fs", "readFileSync", "yaml", "load", "err", "console", "warn", "chalk", "inspect", "getPrototypeSpecificInstanceId", "pickBy", "getRelativeFilename", "filename", "match", "filePath", "LEVEL_COLORS", "LogLevel", "TRACE", "DEBUG", "VERBOSE", "INFO", "WARN", "ERROR", "truncate", "text", "length", "right", "str", "slice", "substring", "padStart", "padEnd", "DEFAULT_FORMATTER", "config", "path", "line", "level", "message", "context", "error", "scope", "column", "options", "formatter", "filepath", "undefined", "chalk", "grey", "instance", "prototype", "Object", "getPrototypeOf", "id", "getPrototypeSpecificInstanceId", "magentaBright", "name", "formattedTimestamp", "timestamp", "Date", "toISOString", "formattedLevel", "shortLevelName", "padding", "timestampFirst", "SHORT_FORMATTER", "CONSOLE_PROCESSOR", "entry", "meta", "shouldLog", "filters", "parts", "getRelativeFilename", "F", "L", "S", "getContextFromEntry", "inspect", "pickBy", "value", "depth", "colors", "maxArrayLength", "sorted", "filter", "Boolean", "join", "console", "log", "inspect", "DEBUG_PROCESSOR", "config", "entry", "console", "log", "inspect", "getDebugName", "safariCheck", "getRelativeFilename", "filename", "match", "filePath", "CONFIG", "useTestProcessor", "printFileLinks", "APP_BROWSER_PROCESSOR", "config", "entry", "shouldLog", "filters", "LOG_BROWSER_PREFIX", "prefix", "LOG_BROWSER_CSS", "link", "meta", "F", "filepath", "replace", "L", "args", "S", "scope", "scopeName", "name", "getDebugName", "processPrefix", "hostSessionId", "push", "message", "context", "getContextFromEntry", "Object", "keys", "length", "error", "levels", "LogLevel", "ERROR", "console", "bind", "WARN", "warn", "DEBUG", "log", "safariCheck", "join", "level", "C", "TEST_BROWSER_PROCESSOR", "path", "BROWSER_PROCESSOR", "appendFileSync", "mkdirSync", "openSync", "dirname", "jsonlogify", "EAGAIN_MAX_DURATION", "createFileProcessor", "pathOrFd", "levels", "filters", "fd", "config", "entry", "length", "includes", "level", "shouldLog", "mkdirSync", "dirname", "openSync", "record", "timestamp", "Date", "now", "meta", "file", "getRelativeFilename", "F", "line", "L", "context", "jsonlogify", "getContextFromEntry", "retryTS", "appendFileSync", "JSON", "stringify", "err", "code", "performance", "console", "log", "logFilePath", "getLogFilePath", "process", "env", "LOG_FILE", "HOME", "toISOString", "undefined", "FILE_PROCESSOR", "LogLevel", "ERROR", "WARN", "INFO", "TRACE", "processors", "LogProcessorType", "CONSOLE", "CONSOLE_PROCESSOR", "BROWSER", "BROWSER_PROCESSOR", "DEBUG", "DEBUG_PROCESSOR", "IS_BROWSER", "window", "navigator", "DEFAULT_PROCESSORS", "parseFilter", "filter", "level", "parseLogLevel", "defValue", "LogLevel", "WARN", "levels", "toLowerCase", "lines", "split", "map", "pattern", "getConfig", "options", "nodeOptions", "globalThis", "file", "process", "env", "LOG_CONFIG", "LOG_FILTER", "processor", "LOG_PROCESSOR", "undefined", "mergedOptions", "defaultsDeep", "loadOptions", "filters", "INFO", "captureFilters", "captureFilter", "prefix", "createLog", "log", "params", "processLog", "LogLevel", "DEBUG", "_config", "getConfig", "Object", "defineProperty", "get", "addProcessor", "processor", "DEFAULT_PROCESSORS", "filter", "p", "length", "push", "processors", "config", "options", "trace", "TRACE", "debug", "verbose", "VERBOSE", "info", "INFO", "warn", "WARN", "error", "ERROR", "catch", "context", "meta", "message", "String", "break", "stack", "getFormattedStackTrace", "method", "createMethodLogDecorator", "func", "createFunctionLogDecorator", "level", "forEach", "globalThis", "dx_log", "start", "Date", "now", "last", "label", "args", "err", "Error", "console", "group", "JSON", "stringify", "t", "Number", "toLocaleString", "dt", "groupEnd", "split", "slice", "join", "inspect", "kOwnershipScope", "Symbol", "kCurrentOwnershipScope", "kDebugInfoProperties", "OwnershipScope", "constr", "parent", "getInfo", "instance", "props", "prototype", "info", "prop", "inspect", "custom", "className", "name", "getCurrentOwnershipScope", "thisRef"]
4
+ "sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nimport omit from 'lodash.omit';\n\nimport { pick } from '@dxos/util';\n\nexport { omit, pick };\n\nexport * from './config';\nexport * from './context';\nexport * from './log';\nexport { parseFilter } from './options';\nexport * from './processors';\nexport * from './scope';\nexport type * from './meta';\n\nexport { getCurrentOwnershipScope } from './experimental/ownership';\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { type LogProcessor } from './context';\n\n/**\n * Standard levels.\n * NOTE: Keep aligned with LogLevel in @dxos/protocols.\n */\n// TODO(burdon): Update numbers?\nexport enum LogLevel {\n TRACE = 5,\n DEBUG = 10,\n VERBOSE = 11,\n INFO = 12,\n WARN = 13,\n ERROR = 14,\n}\n\nexport const levels: Record<string, LogLevel> = {\n trace: LogLevel.TRACE,\n debug: LogLevel.DEBUG,\n verbose: LogLevel.VERBOSE,\n info: LogLevel.INFO,\n warn: LogLevel.WARN,\n error: LogLevel.ERROR,\n};\n\nexport const shortLevelName = {\n [LogLevel.TRACE]: 'T',\n [LogLevel.DEBUG]: 'D',\n [LogLevel.VERBOSE]: 'V',\n [LogLevel.INFO]: 'I',\n [LogLevel.WARN]: 'W',\n [LogLevel.ERROR]: 'E',\n};\n\nexport enum LogProcessorType {\n CONSOLE = 'console',\n BROWSER = 'browser',\n DEBUG = 'debug',\n}\n\n/**\n * Individual filter condition.\n */\nexport type LogFilter = {\n level: LogLevel;\n pattern?: string;\n};\n\n/**\n * Options to set inline or load from the YML file.\n */\nexport type LogOptions = {\n file?: string;\n filter?: string | string[] | LogLevel;\n captureFilter?: string | string[] | LogLevel;\n depth?: number; // Context object depth.\n processor?: string | LogProcessorType;\n formatter?: {\n column: number;\n timestamp: boolean;\n timestampFirst: boolean;\n };\n prefix?: string;\n};\n\n/**\n * Runtime config.\n */\nexport interface LogConfig {\n options: LogOptions;\n filters?: LogFilter[];\n captureFilters?: LogFilter[];\n processors: LogProcessor[];\n prefix?: string;\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nconst logInfoProperties = Symbol('logInfoProperties');\n\n/**\n * Decorate fields, properties, or methods to automatically include their values in log messages.\n *\n * Example:\n *\n * ```typescript\n * class Example {\n * @logInfo\n * peerId: PublicKey;\n * }\n * ```\n */\nexport const logInfo = (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => {\n // console.log(target, propertyKey, descriptor);\n (target[logInfoProperties] ??= []).push(propertyKey);\n};\n\n/**\n * Introspects class instance to find decorated metadata.\n * @param scope Class instance.\n */\nexport const gatherLogInfoFromScope = (scope: any): Record<string, any> => {\n if (!scope) {\n return {};\n }\n\n const res: Record<string, any> = {};\n\n const prototype = Object.getPrototypeOf(scope);\n const infoProps = (typeof prototype === 'object' && prototype !== null ? prototype[logInfoProperties] : []) ?? [];\n for (const prop of infoProps) {\n try {\n res[prop] = typeof scope[prop] === 'function' ? scope[prop]() : scope[prop];\n } catch (err: any) {\n res[prop] = err.message;\n }\n }\n\n return res;\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { type LogConfig, type LogFilter, type LogLevel } from './config';\nimport { type CallMetadata } from './meta';\nimport { gatherLogInfoFromScope } from './scope';\n\n/**\n * Optional object passed to the logging API.\n */\nexport type LogContext = Record<string, any> | Error | any;\n\n/**\n * Record for current log line.\n */\nexport interface LogEntry {\n level: LogLevel;\n message?: string;\n context?: LogContext;\n meta?: CallMetadata;\n error?: Error;\n}\n\n/**\n * Processes (e.g., prints, forwards) log entries.\n */\nexport type LogProcessor = (config: LogConfig, entry: LogEntry) => void;\n\nconst matchFilter = (filter: LogFilter, level: LogLevel, path: string) => {\n return level >= filter.level && (!filter.pattern || path.includes(filter.pattern));\n};\n\n/**\n * Determines if the current line should be logged (called by the processor).\n */\nexport const shouldLog = (entry: LogEntry, filters?: LogFilter[]): boolean => {\n if (filters === undefined) {\n return true;\n } else {\n return filters.some((filter) => matchFilter(filter, entry.level, entry.meta?.F ?? ''));\n }\n};\n\nexport const getContextFromEntry = (entry: LogEntry): Record<string, any> | undefined => {\n let context;\n if (entry.meta) {\n const scopeInfo = gatherLogInfoFromScope(entry.meta.S);\n if (Object.keys(scopeInfo).length > 0) {\n context = Object.assign(context ?? {}, scopeInfo);\n }\n }\n\n const entryContext = typeof entry.context === 'function' ? entry.context() : entry.context;\n if (entryContext) {\n if (entryContext instanceof Error) {\n // Additional context from Error.\n const c = (entryContext as any).context;\n // If ERROR then show stacktrace.\n context = Object.assign(context ?? {}, { error: entryContext.stack, ...c });\n } else if (typeof entryContext === 'object') {\n context = Object.assign(context ?? {}, entryContext);\n }\n }\n\n if (entry.error) {\n context = Object.assign(context ?? {}, { error: entry.error });\n }\n\n return context && Object.keys(context).length > 0 ? context : undefined;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { inspect } from 'node:util';\n\nimport chalk from 'chalk';\n\nimport type { LogMethods } from './log';\nimport { type CallMetadata } from './meta';\n\nlet nextPromiseId = 0;\n\nexport const createMethodLogDecorator =\n (log: LogMethods) =>\n (arg0?: never, arg1?: never, meta?: CallMetadata): MethodDecorator =>\n (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n const method = descriptor.value!;\n const methodName = propertyKey as string;\n descriptor.value = function (this: any, ...args: any) {\n const combinedMeta = {\n F: '',\n L: 0,\n ...(meta ?? {}),\n S: this as any,\n } as CallMetadata;\n\n const formattedArgs = args.map((arg: any) => inspect(arg, false, 1, true)).join(', ');\n\n try {\n const startTime = performance.now();\n const result = method.apply(this, args);\n\n if (isThenable(result)) {\n const id = nextPromiseId++;\n logAsyncBegin(log, methodName, formattedArgs, id, combinedMeta);\n result.then(\n (resolvedValue) => {\n logAsyncResolved(log, methodName, resolvedValue, id, startTime, combinedMeta);\n },\n (err) => {\n logAsyncRejected(log, methodName, err, id, startTime, combinedMeta);\n },\n );\n } else {\n logSyncCall(log, methodName, formattedArgs, result, combinedMeta);\n }\n\n return result;\n } catch (err: any) {\n logSyncError(log, methodName, formattedArgs, err, combinedMeta);\n throw err;\n }\n };\n Object.defineProperty(descriptor.value, 'name', { value: methodName + '$log' });\n };\n\nexport const createFunctionLogDecorator =\n (log: LogMethods) =>\n <F extends (...args: any[]) => any>(\n name: string,\n fn: F,\n opts: { transformOutput?: (result: ReturnType<F>) => Promise<any> | any } = {},\n ): F => {\n const decoratedFn = function (this: any, ...args: any) {\n const combinedMeta = {\n F: '',\n L: 0,\n } as CallMetadata;\n\n const formattedArgs = args.map((arg: any) => inspect(arg, false, 1, true)).join(', ');\n\n try {\n const startTime = performance.now();\n const result = fn.apply(this, args);\n\n let transformedResult = result;\n if (opts.transformOutput) {\n if (isThenable(result)) {\n transformedResult = result.then(opts.transformOutput as any);\n } else {\n transformedResult = opts.transformOutput(result);\n }\n }\n\n if (isThenable(transformedResult)) {\n const id = nextPromiseId++;\n logAsyncBegin(log, name, formattedArgs, id, combinedMeta);\n transformedResult.then(\n (resolvedValue) => {\n logAsyncResolved(log, name, resolvedValue, id, startTime, combinedMeta);\n },\n (err) => {\n logAsyncRejected(log, name, err, id, startTime, combinedMeta);\n },\n );\n } else {\n logSyncCall(log, name, formattedArgs, transformedResult, combinedMeta);\n }\n\n return result;\n } catch (err: any) {\n logSyncError(log, name, formattedArgs, err, combinedMeta);\n throw err;\n }\n };\n Object.defineProperty(decoratedFn, 'name', { value: name + '$log' });\n return decoratedFn as F;\n };\n\nconst isThenable = (obj: any): obj is Promise<unknown> => obj && typeof obj.then === 'function';\n\nconst logSyncCall = (\n log: LogMethods,\n methodName: string,\n formattedArgs: string,\n result: unknown,\n combinedMeta: CallMetadata,\n) => {\n log.info(\n `.${formatFunction(methodName)} (${formattedArgs}) ${chalk.gray('=>')} ${inspect(result, false, 1, true)}`,\n {},\n combinedMeta,\n );\n};\n\nconst logSyncError = (\n log: LogMethods,\n methodName: string,\n formattedArgs: string,\n err: Error,\n combinedMeta: CallMetadata,\n) => {\n log.error(`.${formatFunction(methodName)} (${formattedArgs}) 🔥 ${err}`, {}, combinedMeta);\n};\n\nconst logAsyncBegin = (\n log: LogMethods,\n methodName: string,\n formattedArgs: string,\n promiseId: number,\n combinedMeta: CallMetadata,\n) => {\n log.info(\n `.${formatFunction(methodName)} ↴ (${formattedArgs}) ${chalk.gray('=>')} ${formatPromise(promiseId)}`,\n {},\n combinedMeta,\n );\n};\n\nconst logAsyncResolved = (\n log: LogMethods,\n methodName: string,\n resolvedValue: unknown | undefined,\n promiseId: number,\n startTime: number,\n combinedMeta: CallMetadata,\n) => {\n if (resolvedValue !== undefined) {\n log.info(\n `.${formatFunction(methodName)} ↲ ${greenCheck} ${chalk.gray('resolve')} ${formatPromise(promiseId)} ${formatTimeElapsed(startTime)} ${chalk.gray('=>')} ${inspect(\n resolvedValue,\n false,\n 1,\n true,\n )}`,\n {},\n combinedMeta,\n );\n } else {\n log.info(\n `.${formatFunction(methodName)} ↲ ${greenCheck} ${chalk.gray('resolve')} ${formatPromise(promiseId)} ${formatTimeElapsed(startTime)}`,\n {},\n combinedMeta,\n );\n }\n};\n\nconst logAsyncRejected = (\n log: LogMethods,\n methodName: string,\n err: Error,\n promiseId: number,\n startTime: number,\n combinedMeta: CallMetadata,\n) => {\n log.info(\n `.${formatFunction(methodName)} ↲ 🔥 ${chalk.gray('reject')} ${formatPromise(promiseId)} ${formatTimeElapsed(startTime)} ${chalk.gray('=>')} ${err}`,\n {},\n combinedMeta,\n );\n};\n\n// https://github.com/dxos/dxos/issues/7286\nconst greenCheck = typeof chalk.green === 'function' ? chalk.green('✔') : '✔';\n\nconst formatTimeElapsed = (startTime: number) => chalk.gray(`${(performance.now() - startTime).toFixed(0)}ms`);\n\nconst COLOR_FUNCTION = [220, 220, 170] as const;\n\nconst formatFunction = (name: string) => chalk.bold(chalk.rgb(...COLOR_FUNCTION)(name));\n\nconst formatPromise = (id: number) => chalk.blue(`Promise#${id}`);\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport defaultsDeep from 'lodash.defaultsdeep';\n\nimport { type LogConfig, type LogFilter, LogLevel, type LogOptions, LogProcessorType, levels } from './config';\nimport { type LogProcessor } from './context';\nimport { loadOptions } from './platform';\nimport { BROWSER_PROCESSOR, CONSOLE_PROCESSOR, DEBUG_PROCESSOR } from './processors';\n\n/**\n * Processor variants.\n */\nexport const processors: { [index: string]: LogProcessor } = {\n [LogProcessorType.CONSOLE]: CONSOLE_PROCESSOR,\n [LogProcessorType.BROWSER]: BROWSER_PROCESSOR,\n [LogProcessorType.DEBUG]: DEBUG_PROCESSOR,\n};\n\nconst IS_BROWSER = typeof window !== 'undefined' || typeof navigator !== 'undefined';\n\nexport const DEFAULT_PROCESSORS = [IS_BROWSER ? BROWSER_PROCESSOR : CONSOLE_PROCESSOR];\n\nexport const parseFilter = (filter: string | string[] | LogLevel): LogFilter[] => {\n if (typeof filter === 'number') {\n return [{ level: filter }];\n }\n\n const parseLogLevel = (level: string, defValue = LogLevel.WARN) => levels[level.toLowerCase()] ?? defValue;\n\n const lines = typeof filter === 'string' ? filter.split(/,\\s*/) : filter;\n return lines.map((filter) => {\n const [pattern, level] = filter.split(':');\n return level ? { level: parseLogLevel(level), pattern } : { level: parseLogLevel(pattern) };\n });\n};\n\nexport const getConfig = (options?: LogOptions): LogConfig => {\n const nodeOptions: LogOptions | undefined =\n 'process' in globalThis\n ? {\n file: process!.env.LOG_CONFIG,\n filter: process!.env.LOG_FILTER,\n processor: process!.env.LOG_PROCESSOR,\n }\n : undefined;\n\n const mergedOptions: LogOptions = defaultsDeep({}, loadOptions(nodeOptions?.file), nodeOptions, options);\n return {\n options: mergedOptions,\n filters: parseFilter(mergedOptions.filter ?? LogLevel.INFO),\n captureFilters: parseFilter(mergedOptions.captureFilter ?? LogLevel.WARN),\n processors: mergedOptions.processor ? [processors[mergedOptions.processor]] : DEFAULT_PROCESSORS,\n prefix: mergedOptions.prefix,\n };\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport fs from 'node:fs';\n\nimport yaml from 'js-yaml';\n\nimport { type LogOptions } from '../../config';\n\n/**\n * Node config loader.\n */\nexport const loadOptions = (filepath?: string): LogOptions | undefined => {\n if (filepath) {\n // console.log(`Log file: ${fullpath}`);\n try {\n const text = fs.readFileSync(filepath, 'utf-8');\n if (text) {\n return yaml.load(text) as LogOptions;\n }\n } catch (err) {\n console.warn(`Invalid log file: ${filepath}`);\n }\n }\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { inspect } from 'node:util';\n\nimport chalk from 'chalk';\n\nimport { getPrototypeSpecificInstanceId, pickBy } from '@dxos/util';\n\nimport { type LogConfig, LogLevel, shortLevelName } from '../config';\nimport { type LogProcessor, getContextFromEntry, shouldLog } from '../context';\n\nimport { getRelativeFilename } from './common';\n\nconst LEVEL_COLORS: Record<LogLevel, typeof chalk.ForegroundColor> = {\n [LogLevel.TRACE]: 'gray',\n [LogLevel.DEBUG]: 'gray',\n [LogLevel.VERBOSE]: 'gray',\n [LogLevel.INFO]: 'white',\n [LogLevel.WARN]: 'yellow',\n [LogLevel.ERROR]: 'red',\n};\n\nexport const truncate = (text?: string, length = 0, right = false) => {\n const str = text && length ? (right ? text.slice(-length) : text.substring(0, length)) : (text ?? '');\n return right ? str.padStart(length, ' ') : str.padEnd(length, ' ');\n};\n\n// TODO(burdon): Optional package name.\n// TODO(burdon): Show exceptions on one line.\nexport type FormatParts = {\n path?: string;\n line?: number;\n timestamp?: string;\n level: LogLevel;\n message?: string;\n context?: any;\n error?: Error;\n scope?: any;\n};\n\nexport type Formatter = (config: LogConfig, parts: FormatParts) => (string | undefined)[];\n\nexport const DEFAULT_FORMATTER: Formatter = (\n config,\n { path, line, level, message, context, error, scope },\n): string[] => {\n const column = config.options?.formatter?.column;\n const filepath = path !== undefined && line !== undefined ? chalk.grey(`${path}:${line}`) : undefined;\n\n let instance;\n if (scope) {\n const prototype = Object.getPrototypeOf(scope);\n if (prototype !== null) {\n const id = getPrototypeSpecificInstanceId(scope);\n instance = chalk.magentaBright(`${prototype.constructor.name}#${id}`);\n }\n }\n\n const formattedTimestamp = config.options?.formatter?.timestamp ? new Date().toISOString() : undefined;\n const formattedLevel = chalk[LEVEL_COLORS[level]](column ? shortLevelName[level] : LogLevel[level]);\n const padding = column && filepath ? ''.padStart(column - filepath.length) : undefined;\n\n return config.options?.formatter?.timestampFirst\n ? [formattedTimestamp, filepath, padding, formattedLevel, instance, message, context, error]\n : [\n // NOTE: File path must come fist for console hyperlinks.\n // Must not truncate for terminal output.\n filepath,\n padding,\n formattedTimestamp,\n formattedLevel,\n instance,\n message,\n context,\n error,\n ];\n};\n\nexport const SHORT_FORMATTER: Formatter = (config, { path, level, message }) => {\n return [\n chalk.grey(truncate(path, 16, true)), // NOTE: Breaks terminal linking.\n chalk[LEVEL_COLORS[level]](shortLevelName[level]),\n message,\n ];\n};\n\n// TODO(burdon): Config option.\nconst formatter = DEFAULT_FORMATTER;\n\nexport const CONSOLE_PROCESSOR: LogProcessor = (config, entry) => {\n const { level, message, meta, error } = entry;\n if (!shouldLog(entry, config.filters)) {\n return;\n }\n\n const parts: FormatParts = {\n level,\n message,\n error,\n path: undefined,\n line: undefined,\n scope: undefined,\n context: undefined,\n };\n\n if (meta) {\n parts.path = getRelativeFilename(meta.F);\n parts.line = meta.L;\n parts.scope = meta.S;\n }\n\n const context = getContextFromEntry(entry);\n if (context) {\n // Remove undefined fields.\n // https://nodejs.org/api/util.html#utilinspectobject-options\n parts.context = inspect(\n pickBy(context, (value?: unknown) => value !== undefined),\n { depth: config.options.depth, colors: true, maxArrayLength: 8, sorted: false },\n );\n }\n\n const line = formatter(config, parts).filter(Boolean).join(' ');\n console.log(line);\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nexport const getRelativeFilename = (filename: string) => {\n // TODO(burdon): Hack uses \"packages\" as an anchor (pre-parse NX?)\n // Including `packages/` part of the path so that excluded paths (e.g. from dist) are clickable in vscode.\n const match = filename.match(/.+\\/(packages\\/.+\\/.+)/);\n if (match) {\n const [, filePath] = match;\n return filePath;\n }\n\n return filename;\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { inspect } from 'node:util';\n\nimport { type LogProcessor } from '../context';\n\nexport const DEBUG_PROCESSOR: LogProcessor = (config, entry) => {\n console.log(inspect(entry, false, null, true));\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { getDebugName, safariCheck } from '@dxos/util';\n\nimport { LogLevel } from '../config';\nimport { type LogProcessor, getContextFromEntry, shouldLog } from '../context';\n\nconst getRelativeFilename = (filename: string) => {\n // TODO(burdon): Hack uses \"packages\" as an anchor (pre-parse NX?)\n // Including `packages/` part of the path so that excluded paths (e.g. from dist) are clickable in vscode.\n const match = filename.match(/.+\\/(packages\\/.+\\/.+)/);\n if (match) {\n const [, filePath] = match;\n return filePath;\n }\n\n return filename;\n};\n\ntype Config = {\n useTestProcessor: boolean;\n printFileLinks: boolean;\n};\n\nconst CONFIG: Config = {\n useTestProcessor: false,\n printFileLinks: false,\n};\n\n/**\n * For running apps in the browser normally.\n */\nconst APP_BROWSER_PROCESSOR: LogProcessor = (config, entry) => {\n if (!shouldLog(entry, config.filters)) {\n return;\n }\n\n // Example local editor prefix: 'vscode://file/Users/burdon/Code/dxos/dxos/'.\n const LOG_BROWSER_PREFIX = config.prefix ?? 'https://vscode.dev/github.com/dxos/dxos/blob/main/';\n\n // TODO(burdon): CSS breaks formatting (e.g., [Object] rather than expandable property).\n // TODO(burdon): Consider custom formatters.\n // https://www.mattzeunert.com/2016/02/19/custom-chrome-devtools-object-formatters.html\n // NOTE: Cannot change color of link (from bright white).\n // const LOG_BROWSER_CSS = ['color:gray; font-size:10px; padding-bottom: 4px', 'color:#B97852; font-size:14px;'];\n const LOG_BROWSER_CSS: string[] = [];\n\n let link = '';\n if (entry.meta) {\n const filename = getRelativeFilename(entry.meta.F);\n const filepath = `${LOG_BROWSER_PREFIX.replace(/\\/$/, '')}/${filename}`;\n // TODO(burdon): Line numbers not working for app link, even with colons.\n // https://stackoverflow.com/a/54459820/2804332\n link = `${filepath}#L${entry.meta.L}`;\n }\n\n let args = [];\n\n if (entry.meta?.S) {\n const scope = entry.meta?.S;\n const scopeName = scope.name || getDebugName(scope);\n const processPrefix = entry.meta.S?.hostSessionId ? '[worker] ' : '';\n // TODO(dmaretskyi): Those can be made clickable with a custom formatter.\n args.push(`%c${processPrefix}${scopeName}`, 'color:#C026D3;font-weight:bold');\n }\n\n if (entry.message) {\n args.push(entry.message);\n }\n\n const context = getContextFromEntry(entry);\n if (context) {\n if (Object.keys(context).length === 1 && 'error' in context) {\n args.push(context.error);\n } else if (Object.keys(context).length === 1 && 'err' in context) {\n args.push(context.err);\n } else {\n args.push(context);\n }\n }\n\n // https://github.com/cloudflare/workers-sdk/issues/5591\n const levels: any = {\n [LogLevel.ERROR]: console.error.bind(console),\n [LogLevel.WARN]: console.warn.bind(console),\n [LogLevel.DEBUG]: console.log.bind(console),\n };\n\n // Safari prints source code location as this file, not the caller.\n if (CONFIG.printFileLinks || safariCheck()) {\n if (LOG_BROWSER_CSS?.length) {\n args = [`%c${link}\\n%c${args.join(' ')}`, ...LOG_BROWSER_CSS];\n } else {\n args = [link + '\\n', ...args];\n }\n }\n\n // https://github.com/cloudflare/workers-sdk/issues/5591\n const level = levels[entry.level] ?? console.log.bind(console);\n if (typeof entry.meta?.C === 'function') {\n entry.meta.C(level, args);\n } else {\n level(...args);\n }\n};\n\n/**\n * For running unit tests in the headless browser.\n */\nconst TEST_BROWSER_PROCESSOR: LogProcessor = (config, entry) => {\n if (!shouldLog(entry, config.filters)) {\n return;\n }\n\n let path = '';\n if (entry.meta) {\n path = `${getRelativeFilename(entry.meta.F)}:${entry.meta.L}`;\n }\n\n let args = [];\n\n const processPrefix = entry.meta?.S?.hostSessionId ? '[worker] ' : '';\n args.push(`${processPrefix}${entry.message}`);\n\n const context = getContextFromEntry(entry);\n if (context) {\n args.push(context);\n }\n\n const levels: any = {\n [LogLevel.ERROR]: console.error,\n [LogLevel.WARN]: console.warn,\n [LogLevel.DEBUG]: console.log,\n };\n\n if (CONFIG.printFileLinks) {\n args = [path, ...args];\n }\n\n const level = levels[entry.level] ?? console.log;\n if (typeof entry.meta?.C === 'function') {\n entry.meta.C(level, args);\n } else {\n level(...args);\n }\n};\n\nexport const BROWSER_PROCESSOR: LogProcessor = CONFIG.useTestProcessor ? TEST_BROWSER_PROCESSOR : APP_BROWSER_PROCESSOR;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { appendFileSync, mkdirSync, openSync } from 'node:fs';\nimport { dirname } from 'node:path';\n\nimport { jsonlogify } from '@dxos/util';\n\nimport { type LogFilter, LogLevel } from '../config';\nimport { type LogProcessor, getContextFromEntry, shouldLog } from '../context';\n\nimport { getRelativeFilename } from './common';\n\n// Amount of time to retry writing after encountering EAGAIN before giving up.\nconst EAGAIN_MAX_DURATION = 1000;\n/**\n * Create a file processor.\n * @param path - Path to log file to create or append to, or existing open file descriptor e.g. stdout.\n * @param levels - Log levels to process. Takes preference over Filters.\n * @param filters - Filters to apply.\n */\nexport const createFileProcessor = ({\n pathOrFd,\n levels,\n filters,\n}: {\n pathOrFd: string | number;\n levels: LogLevel[];\n filters?: LogFilter[];\n}): LogProcessor => {\n let fd: number | undefined;\n\n return (config, entry) => {\n if (levels.length > 0 && !levels.includes(entry.level)) {\n return;\n }\n if (!shouldLog(entry, filters)) {\n return;\n }\n if (typeof pathOrFd === 'number') {\n fd = pathOrFd;\n } else {\n try {\n mkdirSync(dirname(pathOrFd));\n } catch {}\n fd = openSync(pathOrFd, 'a');\n }\n\n const record = {\n ...entry,\n timestamp: Date.now(),\n ...(entry.meta ? { meta: { file: getRelativeFilename(entry.meta.F), line: entry.meta.L } } : {}),\n context: jsonlogify(getContextFromEntry(entry)),\n };\n let retryTS: number = 0;\n\n // Retry writing if EAGAIN is encountered.\n //\n // Node may set stdout and stderr to non-blocking. https://github.com/nodejs/node/issues/42826\n // This can cause EAGAIN errors when writing to them.\n // In order to not drop logs, make log methods asynchronous, or deal with buffering/delayed writes, spin until write succeeds.\n\n while (true) {\n try {\n return appendFileSync(fd, JSON.stringify(record) + '\\n');\n } catch (err: any) {\n if (err.code !== 'EAGAIN') {\n throw err;\n }\n if (retryTS === 0) {\n retryTS = performance.now();\n } else {\n if (performance.now() - retryTS > EAGAIN_MAX_DURATION) {\n console.log(`could not write after ${EAGAIN_MAX_DURATION}ms of EAGAIN failures, giving up`);\n throw err;\n }\n }\n }\n }\n };\n};\n\nlet logFilePath: string | undefined;\nconst getLogFilePath = () => {\n logFilePath ??=\n process.env.LOG_FILE ??\n (process.env.HOME ? `${process.env.HOME}/.dxlog/${new Date().toISOString()}.log` : undefined);\n\n return logFilePath!;\n};\n\nexport const FILE_PROCESSOR: LogProcessor = createFileProcessor({\n pathOrFd: getLogFilePath(),\n levels: [LogLevel.ERROR, LogLevel.WARN, LogLevel.INFO, LogLevel.TRACE],\n});\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { type LogConfig, LogLevel, type LogOptions } from './config';\nimport { type LogContext, type LogProcessor } from './context';\nimport { createFunctionLogDecorator, createMethodLogDecorator } from './decorators';\nimport { type CallMetadata } from './meta';\nimport { DEFAULT_PROCESSORS, getConfig } from './options';\n\n/**\n * Logging function.\n */\ntype LogFunction = (message: string, context?: LogContext, meta?: CallMetadata) => void;\n\n/**\n * Logging methods.\n */\nexport interface LogMethods {\n trace: LogFunction;\n debug: LogFunction;\n verbose: LogFunction;\n info: LogFunction;\n warn: LogFunction;\n error: LogFunction;\n catch: (error: Error | any, context?: LogContext, meta?: CallMetadata) => void;\n break: () => void;\n stack: (message?: string, context?: never, meta?: CallMetadata) => void;\n method: (arg0?: never, arg1?: never, meta?: CallMetadata) => MethodDecorator;\n func: <F extends (...args: any[]) => any>(\n name: string,\n fn: F,\n opts?: { transformOutput?: (result: ReturnType<F>) => Promise<any> | any },\n ) => F;\n}\n\n/**\n * Properties accessible on the logging function.\n */\ninterface Log extends LogMethods, LogFunction {\n config: (options: LogOptions) => void;\n addProcessor: (processor: LogProcessor) => void;\n runtimeConfig: LogConfig;\n}\n\ninterface LogImp extends Log {\n _config: LogConfig;\n}\n\nconst createLog = (): LogImp => {\n const log: LogImp = ((...params) => processLog(LogLevel.DEBUG, ...params)) as LogImp;\n\n log._config = getConfig();\n Object.defineProperty(log, 'runtimeConfig', { get: () => log._config });\n\n log.addProcessor = (processor: LogProcessor) => {\n if (DEFAULT_PROCESSORS.filter((p) => p === processor).length === 0) {\n DEFAULT_PROCESSORS.push(processor);\n }\n if (log._config.processors.filter((p) => p === processor).length === 0) {\n log._config.processors.push(processor);\n }\n };\n\n // Set config.\n log.config = (options: LogOptions) => {\n log._config = getConfig(options);\n };\n\n // TODO(burdon): API to set context and separate error object.\n // E.g., log.warn('failed', { key: 123 }, err);\n\n log.trace = (...params) => processLog(LogLevel.TRACE, ...params);\n log.debug = (...params) => processLog(LogLevel.DEBUG, ...params);\n log.verbose = (...params) => processLog(LogLevel.VERBOSE, ...params);\n log.info = (...params) => processLog(LogLevel.INFO, ...params);\n log.warn = (...params) => processLog(LogLevel.WARN, ...params);\n log.error = (...params) => processLog(LogLevel.ERROR, ...params);\n\n // Catch only shows error message, not stacktrace.\n log.catch = (error: Error | any, context, meta) => processLog(LogLevel.ERROR, undefined, context, meta, error);\n\n // Show break.\n log.break = () => log.info('——————————————————————————————————————————————————');\n\n log.stack = (message, context, meta) =>\n processLog(LogLevel.INFO, `${message ?? 'Stack Dump'}\\n${getFormattedStackTrace()}`, context, meta);\n\n log.method = createMethodLogDecorator(log);\n log.func = createFunctionLogDecorator(log);\n\n /**\n * Process the current log call.\n */\n const processLog = (\n level: LogLevel,\n message: string | undefined,\n context: LogContext = {},\n meta?: CallMetadata,\n error?: Error,\n ) => {\n log._config.processors.forEach((processor) => processor(log._config, { level, message, context, meta, error }));\n };\n\n return log;\n};\n\n/**\n * Global logging function.\n */\nexport const log: Log = ((globalThis as any).dx_log ??= createLog());\n\nconst start = Date.now();\nlet last = start;\n\n/**\n * Log debug stack.\n */\nexport const debug = (label?: any, args?: any) => {\n const now = Date.now();\n const err = new Error();\n console.group(\n `DEBUG[${label}]`,\n JSON.stringify({ t: Number(now - start).toLocaleString(), dt: Number(now - last).toLocaleString(), ...args }),\n );\n console.warn(err.stack);\n console.groupEnd();\n last = Date.now();\n};\n\n/**\n * Accessible from browser console.\n */\ndeclare global {\n // eslint-disable-next-line camelcase\n const dx_log: Log;\n}\n\nconst getFormattedStackTrace = () => new Error().stack!.split('\\n').slice(3).join('\\n');\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { inspect } from 'node:util';\n\nconst kOwnershipScope = Symbol('kOwnershipScope');\nconst kCurrentOwnershipScope = Symbol('kCurrentOwnershipScope');\nconst kDebugInfoProperties = Symbol('kDebugInfoProperties');\n\n/**\n *\n */\n// TODO(burdon): Document.\nexport class OwnershipScope {\n public instance: any;\n\n constructor(\n public constr: any,\n public parent?: OwnershipScope,\n ) {}\n\n getInfo() {\n if (!this.instance) {\n return {};\n }\n const props = this.constr.prototype[kDebugInfoProperties] ?? [];\n const info: any = {};\n for (const prop of props) {\n info[prop] = this.instance[prop];\n }\n return info;\n }\n\n [inspect.custom]() {\n return {\n className: this.constr.name,\n info: this.getInfo(),\n parent: this.parent,\n };\n }\n}\n\nfunction decorateMethodWeakReturnOwnership(prototype: any, key: string) {\n const original = prototype[key];\n prototype[key] = function (...args: any) {\n const res = original.apply(this, ...args);\n\n if (res && typeof res.then === 'function') {\n res.then((value: any) => {\n if (kOwnershipScope in value) {\n value[kOwnershipScope].parent ??= this[kOwnershipScope];\n }\n });\n } else {\n if (res && kOwnershipScope in res) {\n res[kOwnershipScope].parent ??= this[kOwnershipScope];\n }\n }\n\n return res;\n };\n}\n\nexport function ownershipClass<T extends { new (...args: any[]): {} }>(constr: T) {\n for (const key of Object.getOwnPropertyNames(constr.prototype)) {\n if (key !== 'constructor' && typeof constr.prototype[key] === 'function') {\n decorateMethodWeakReturnOwnership(constr.prototype, key);\n }\n }\n\n return class extends constr {\n constructor(...args: any[]) {\n const currentCausality = (globalThis as any)[kCurrentOwnershipScope];\n (globalThis as any)[kCurrentOwnershipScope] = new OwnershipScope(constr, currentCausality);\n super(...args);\n (this as any)[kOwnershipScope] = (globalThis as any)[kCurrentOwnershipScope];\n (this as any)[kOwnershipScope].instance = this;\n (globalThis as any)[kCurrentOwnershipScope] = currentCausality;\n }\n };\n}\n\nexport const debugInfo = (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {\n // console.log(target, propertyKey, descriptor);\n (target[kDebugInfoProperties] ??= []).push(propertyKey);\n};\n\nexport const getCurrentOwnershipScope = (thisRef: any) => thisRef;\n"],
5
+ "mappings": ";;;AAIA,OAAOA,UAAU;AAEjB,SAASC,YAAY;;;ACKd,IAAKC,WAAAA,0BAAAA,WAAAA;;;;;;;SAAAA;;AASL,IAAMC,SAAmC;EAC9CC,OAAK;EACLC,OAAK;EACLC,SAAO;EACPC,MAAI;EACJC,MAAI;EACJC,OAAK;AACP;AAEO,IAAMC,iBAAiB;EAC5B,CAAA,CAAA,GAAkB;EAClB,CAAA,EAAA,GAAkB;EAClB,CAAA,EAAA,GAAoB;EACpB,CAAA,EAAA,GAAiB;EACjB,CAAA,EAAA,GAAiB;EACjB,CAAA,EAAA,GAAkB;AACpB;AAEO,IAAKC,mBAAAA,0BAAAA,mBAAAA;;;;SAAAA;;;;AClCZ,IAAMC,oBAAoBC,OAAO,mBAAA;AAc1B,IAAMC,UAAU,CAACC,QAAaC,aAAqBC,eAAAA;MAEvDF,SAAOH;AAAPG,IAAAA,UAAAA,QAAOH,qBAAAA,iBAAAA,MAAPG,QAAOH,kBAAAA,IAAuB,CAAA,IAAIM,KAAKF,WAAAA;AAC1C;AAMO,IAAMG,yBAAyB,CAACC,UAAAA;AACrC,MAAI,CAACA,OAAO;AACV,WAAO,CAAC;EACV;AAEA,QAAMC,MAA2B,CAAC;AAElC,QAAMC,YAAYC,OAAOC,eAAeJ,KAAAA;AACxC,QA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AAC;AACnB,eAAWC,QAAQJ,OAAO;AACxBG,WAAKC,IAAAA,IAAQ,KAAKL,SAASK,IAAAA;IAC7B;AACA,WAAOD;EACT;EAEA,CAACR,eAAAA,IAAkB;AACjB,WAAO;MACLU,WAAW,KAAKJ,OAAOK;MACvBH,MAAM,KAAKL,QAAO;MAClBS,QAAQ,KAAKA;IACf;EACF;EAvBA,YACSN,QACAM,QACP;;;AALF,qBAAA,MAAOR,YAAP,MAAA;SAGSE,SAAAA;SACAM,SAAAA;EACN;AAqBL;AA+CO,IAAMC,2BAA2B,CAACC,YAAiBA;",
6
+ "names": ["omit", "pick", "LogLevel", "levels", "trace", "debug", "verbose", "info", "warn", "error", "shortLevelName", "LogProcessorType", "logInfoProperties", "Symbol", "logInfo", "target", "propertyKey", "descriptor", "push", "gatherLogInfoFromScope", "scope", "res", "prototype", "Object", "getPrototypeOf", "infoProps", "prop", "err", "message", "matchFilter", "filter", "level", "path", "pattern", "includes", "shouldLog", "entry", "filters", "undefined", "some", "meta", "F", "getContextFromEntry", "context", "scopeInfo", "gatherLogInfoFromScope", "S", "Object", "keys", "length", "assign", "entryContext", "Error", "c", "error", "stack", "inspect", "chalk", "nextPromiseId", "createMethodLogDecorator", "log", "arg0", "arg1", "meta", "target", "propertyKey", "descriptor", "method", "value", "methodName", "args", "combinedMeta", "F", "L", "S", "formattedArgs", "map", "arg", "inspect", "join", "startTime", "performance", "now", "result", "apply", "isThenable", "id", "logAsyncBegin", "then", "resolvedValue", "logAsyncResolved", "err", "logAsyncRejected", "logSyncCall", "logSyncError", "Object", "defineProperty", "createFunctionLogDecorator", "name", "fn", "opts", "decoratedFn", "transformedResult", "transformOutput", "obj", "info", "formatFunction", "chalk", "gray", "error", "promiseId", "formatPromise", "undefined", "greenCheck", "formatTimeElapsed", "green", "toFixed", "COLOR_FUNCTION", "bold", "rgb", "blue", "defaultsDeep", "fs", "yaml", "loadOptions", "filepath", "text", "fs", "readFileSync", "yaml", "load", "err", "console", "warn", "inspect", "chalk", "getPrototypeSpecificInstanceId", "pickBy", "getRelativeFilename", "filename", "match", "filePath", "LEVEL_COLORS", "LogLevel", "TRACE", "DEBUG", "VERBOSE", "INFO", "WARN", "ERROR", "truncate", "text", "length", "right", "str", "slice", "substring", "padStart", "padEnd", "DEFAULT_FORMATTER", "config", "path", "line", "level", "message", "context", "error", "scope", "column", "options", "formatter", "filepath", "undefined", "chalk", "grey", "instance", "prototype", "Object", "getPrototypeOf", "id", "getPrototypeSpecificInstanceId", "magentaBright", "name", "formattedTimestamp", "timestamp", "Date", "toISOString", "formattedLevel", "shortLevelName", "padding", "timestampFirst", "SHORT_FORMATTER", "CONSOLE_PROCESSOR", "entry", "meta", "shouldLog", "filters", "parts", "getRelativeFilename", "F", "L", "S", "getContextFromEntry", "inspect", "pickBy", "value", "depth", "colors", "maxArrayLength", "sorted", "filter", "Boolean", "join", "console", "log", "inspect", "DEBUG_PROCESSOR", "config", "entry", "console", "log", "inspect", "getDebugName", "safariCheck", "getRelativeFilename", "filename", "match", "filePath", "CONFIG", "useTestProcessor", "printFileLinks", "APP_BROWSER_PROCESSOR", "config", "entry", "shouldLog", "filters", "LOG_BROWSER_PREFIX", "prefix", "LOG_BROWSER_CSS", "link", "meta", "F", "filepath", "replace", "L", "args", "S", "scope", "scopeName", "name", "getDebugName", "processPrefix", "hostSessionId", "push", "message", "context", "getContextFromEntry", "Object", "keys", "length", "error", "err", "levels", "LogLevel", "ERROR", "console", "bind", "WARN", "warn", "DEBUG", "log", "safariCheck", "join", "level", "C", "TEST_BROWSER_PROCESSOR", "path", "BROWSER_PROCESSOR", "appendFileSync", "mkdirSync", "openSync", "dirname", "jsonlogify", "EAGAIN_MAX_DURATION", "createFileProcessor", "pathOrFd", "levels", "filters", "fd", "config", "entry", "length", "includes", "level", "shouldLog", "mkdirSync", "dirname", "openSync", "record", "timestamp", "Date", "now", "meta", "file", "getRelativeFilename", "F", "line", "L", "context", "jsonlogify", "getContextFromEntry", "retryTS", "appendFileSync", "JSON", "stringify", "err", "code", "performance", "console", "log", "logFilePath", "getLogFilePath", "process", "env", "LOG_FILE", "HOME", "toISOString", "undefined", "FILE_PROCESSOR", "LogLevel", "ERROR", "WARN", "INFO", "TRACE", "processors", "LogProcessorType", "CONSOLE", "CONSOLE_PROCESSOR", "BROWSER", "BROWSER_PROCESSOR", "DEBUG", "DEBUG_PROCESSOR", "IS_BROWSER", "window", "navigator", "DEFAULT_PROCESSORS", "parseFilter", "filter", "level", "parseLogLevel", "defValue", "LogLevel", "WARN", "levels", "toLowerCase", "lines", "split", "map", "pattern", "getConfig", "options", "nodeOptions", "globalThis", "file", "process", "env", "LOG_CONFIG", "LOG_FILTER", "processor", "LOG_PROCESSOR", "undefined", "mergedOptions", "defaultsDeep", "loadOptions", "filters", "INFO", "captureFilters", "captureFilter", "prefix", "globalThis", "createLog", "log", "params", "processLog", "LogLevel", "DEBUG", "_config", "getConfig", "Object", "defineProperty", "get", "addProcessor", "processor", "DEFAULT_PROCESSORS", "filter", "p", "length", "push", "processors", "config", "options", "trace", "TRACE", "debug", "verbose", "VERBOSE", "info", "INFO", "warn", "WARN", "error", "ERROR", "catch", "context", "meta", "undefined", "break", "stack", "message", "getFormattedStackTrace", "method", "createMethodLogDecorator", "func", "createFunctionLogDecorator", "level", "forEach", "globalThis", "dx_log", "start", "Date", "now", "last", "label", "args", "err", "Error", "console", "group", "JSON", "stringify", "t", "Number", "toLocaleString", "dt", "groupEnd", "split", "slice", "join", "inspect", "kOwnershipScope", "Symbol", "kCurrentOwnershipScope", "kDebugInfoProperties", "inspect", "custom", "OwnershipScope", "getInfo", "instance", "props", "constr", "prototype", "info", "prop", "className", "name", "parent", "getCurrentOwnershipScope", "thisRef"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"src/config.ts":{"bytes":3986,"imports":[],"format":"esm"},"src/scope.ts":{"bytes":3839,"imports":[],"format":"esm"},"src/context.ts":{"bytes":6847,"imports":[{"path":"src/scope.ts","kind":"import-statement","original":"./scope"}],"format":"esm"},"src/decorators.ts":{"bytes":19779,"imports":[{"path":"chalk","kind":"import-statement","external":true},{"path":"node:util","kind":"import-statement","external":true}],"format":"esm"},"src/platform/node/index.ts":{"bytes":2034,"imports":[{"path":"js-yaml","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true}],"format":"esm"},"src/platform/index.ts":{"bytes":447,"imports":[{"path":"src/platform/node/index.ts","kind":"import-statement","original":"./node"}],"format":"esm"},"src/processors/common.ts":{"bytes":1609,"imports":[],"format":"esm"},"src/processors/console-processor.ts":{"bytes":13077,"imports":[{"path":"chalk","kind":"import-statement","external":true},{"path":"node:util","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/processors/common.ts","kind":"import-statement","original":"./common"},{"path":"src/config.ts","kind":"import-statement","original":"../config"},{"path":"src/context.ts","kind":"import-statement","original":"../context"}],"format":"esm"},"src/processors/debug-processor.ts":{"bytes":1057,"imports":[{"path":"node:util","kind":"import-statement","external":true}],"format":"esm"},"src/processors/browser-processor.ts":{"bytes":15341,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"../config"},{"path":"src/context.ts","kind":"import-statement","original":"../context"}],"format":"esm"},"src/processors/file-processor.ts":{"bytes":10084,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/processors/common.ts","kind":"import-statement","original":"./common"},{"path":"src/config.ts","kind":"import-statement","original":"../config"},{"path":"src/context.ts","kind":"import-statement","original":"../context"}],"format":"esm"},"src/processors/index.ts":{"bytes":890,"imports":[{"path":"src/processors/console-processor.ts","kind":"import-statement","original":"./console-processor"},{"path":"src/processors/debug-processor.ts","kind":"import-statement","original":"./debug-processor"},{"path":"src/processors/browser-processor.ts","kind":"import-statement","original":"./browser-processor"},{"path":"src/processors/file-processor.ts","kind":"import-statement","original":"./file-processor"},{"path":"src/processors/common.ts","kind":"import-statement","original":"./common"}],"format":"esm"},"src/options.ts":{"bytes":7545,"imports":[{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"./config"},{"path":"src/platform/index.ts","kind":"import-statement","original":"./platform"},{"path":"src/processors/index.ts","kind":"import-statement","original":"./processors"}],"format":"esm"},"src/log.ts":{"bytes":12901,"imports":[{"path":"src/config.ts","kind":"import-statement","original":"./config"},{"path":"src/decorators.ts","kind":"import-statement","original":"./decorators"},{"path":"src/options.ts","kind":"import-statement","original":"./options"}],"format":"esm"},"src/meta.ts":{"bytes":1612,"imports":[],"format":"esm"},"src/experimental/ownership.ts":{"bytes":9249,"imports":[{"path":"node:util","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":1601,"imports":[{"path":"lodash.omit","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"./config"},{"path":"src/context.ts","kind":"import-statement","original":"./context"},{"path":"src/log.ts","kind":"import-statement","original":"./log"},{"path":"src/options.ts","kind":"import-statement","original":"./options"},{"path":"src/processors/index.ts","kind":"import-statement","original":"./processors"},{"path":"src/scope.ts","kind":"import-statement","original":"./scope"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/experimental/ownership.ts","kind":"import-statement","original":"./experimental/ownership"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":54581},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"lodash.omit","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"node:util","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"js-yaml","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"node:util","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"node:util","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"node:util","kind":"import-statement","external":true}],"exports":["BROWSER_PROCESSOR","CONSOLE_PROCESSOR","DEBUG_PROCESSOR","DEFAULT_FORMATTER","FILE_PROCESSOR","LogLevel","LogProcessorType","SHORT_FORMATTER","createFileProcessor","debug","gatherLogInfoFromScope","getContextFromEntry","getCurrentOwnershipScope","getRelativeFilename","levels","log","logInfo","omit","parseFilter","pick","shortLevelName","shouldLog","truncate"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":67},"src/config.ts":{"bytesInOutput":795},"src/scope.ts":{"bytesInOutput":571},"src/context.ts":{"bytesInOutput":1241},"src/decorators.ts":{"bytesInOutput":4556},"src/options.ts":{"bytesInOutput":1542},"src/platform/node/index.ts":{"bytesInOutput":315},"src/platform/index.ts":{"bytesInOutput":0},"src/processors/console-processor.ts":{"bytesInOutput":2730},"src/processors/common.ts":{"bytesInOutput":194},"src/processors/index.ts":{"bytesInOutput":0},"src/processors/debug-processor.ts":{"bytesInOutput":146},"src/processors/browser-processor.ts":{"bytesInOutput":2844},"src/processors/file-processor.ts":{"bytesInOutput":1812},"src/log.ts":{"bytesInOutput":2429},"src/experimental/ownership.ts":{"bytesInOutput":782}},"bytes":20982}}}
1
+ {"inputs":{"src/config.ts":{"bytes":3966,"imports":[],"format":"esm"},"src/scope.ts":{"bytes":4229,"imports":[],"format":"esm"},"src/context.ts":{"bytes":6568,"imports":[{"path":"src/scope.ts","kind":"import-statement","original":"./scope"}],"format":"esm"},"src/decorators.ts":{"bytes":19783,"imports":[{"path":"node:util","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true}],"format":"esm"},"src/platform/node/index.ts":{"bytes":2034,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"js-yaml","kind":"import-statement","external":true}],"format":"esm"},"src/platform/index.ts":{"bytes":447,"imports":[{"path":"src/platform/node/index.ts","kind":"import-statement","original":"./node"}],"format":"esm"},"src/processors/common.ts":{"bytes":1609,"imports":[],"format":"esm"},"src/processors/console-processor.ts":{"bytes":13229,"imports":[{"path":"node:util","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"../config"},{"path":"src/context.ts","kind":"import-statement","original":"../context"},{"path":"src/processors/common.ts","kind":"import-statement","original":"./common"}],"format":"esm"},"src/processors/debug-processor.ts":{"bytes":1057,"imports":[{"path":"node:util","kind":"import-statement","external":true}],"format":"esm"},"src/processors/browser-processor.ts":{"bytes":15856,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"../config"},{"path":"src/context.ts","kind":"import-statement","original":"../context"}],"format":"esm"},"src/processors/file-processor.ts":{"bytes":10107,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"../config"},{"path":"src/context.ts","kind":"import-statement","original":"../context"},{"path":"src/processors/common.ts","kind":"import-statement","original":"./common"}],"format":"esm"},"src/processors/index.ts":{"bytes":890,"imports":[{"path":"src/processors/console-processor.ts","kind":"import-statement","original":"./console-processor"},{"path":"src/processors/debug-processor.ts","kind":"import-statement","original":"./debug-processor"},{"path":"src/processors/browser-processor.ts","kind":"import-statement","original":"./browser-processor"},{"path":"src/processors/file-processor.ts","kind":"import-statement","original":"./file-processor"},{"path":"src/processors/common.ts","kind":"import-statement","original":"./common"}],"format":"esm"},"src/options.ts":{"bytes":7545,"imports":[{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"./config"},{"path":"src/platform/index.ts","kind":"import-statement","original":"./platform"},{"path":"src/processors/index.ts","kind":"import-statement","original":"./processors"}],"format":"esm"},"src/log.ts":{"bytes":12930,"imports":[{"path":"src/config.ts","kind":"import-statement","original":"./config"},{"path":"src/decorators.ts","kind":"import-statement","original":"./decorators"},{"path":"src/options.ts","kind":"import-statement","original":"./options"}],"format":"esm"},"src/experimental/ownership.ts":{"bytes":10233,"imports":[{"path":"node:util","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":1561,"imports":[{"path":"lodash.omit","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"./config"},{"path":"src/context.ts","kind":"import-statement","original":"./context"},{"path":"src/log.ts","kind":"import-statement","original":"./log"},{"path":"src/options.ts","kind":"import-statement","original":"./options"},{"path":"src/processors/index.ts","kind":"import-statement","original":"./processors"},{"path":"src/scope.ts","kind":"import-statement","original":"./scope"},{"path":"src/experimental/ownership.ts","kind":"import-statement","original":"./experimental/ownership"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":55006},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"lodash.omit","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"node:util","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"js-yaml","kind":"import-statement","external":true},{"path":"node:util","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"node:util","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"node:util","kind":"import-statement","external":true}],"exports":["BROWSER_PROCESSOR","CONSOLE_PROCESSOR","DEBUG_PROCESSOR","DEFAULT_FORMATTER","FILE_PROCESSOR","LogLevel","LogProcessorType","SHORT_FORMATTER","createFileProcessor","debug","gatherLogInfoFromScope","getContextFromEntry","getCurrentOwnershipScope","getRelativeFilename","levels","log","logInfo","omit","parseFilter","pick","shortLevelName","shouldLog","truncate"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":67},"src/config.ts":{"bytesInOutput":799},"src/scope.ts":{"bytesInOutput":731},"src/context.ts":{"bytesInOutput":1172},"src/decorators.ts":{"bytesInOutput":4556},"src/options.ts":{"bytesInOutput":1542},"src/platform/node/index.ts":{"bytesInOutput":315},"src/platform/index.ts":{"bytesInOutput":0},"src/processors/console-processor.ts":{"bytesInOutput":2770},"src/processors/common.ts":{"bytesInOutput":194},"src/processors/index.ts":{"bytesInOutput":0},"src/processors/debug-processor.ts":{"bytesInOutput":146},"src/processors/browser-processor.ts":{"bytesInOutput":2975},"src/processors/file-processor.ts":{"bytesInOutput":1827},"src/log.ts":{"bytesInOutput":2459},"src/experimental/ownership.ts":{"bytesInOutput":1209}},"bytes":21720}}}
@@ -1,6 +1,7 @@
1
1
  import { type LogProcessor } from './context';
2
2
  /**
3
3
  * Standard levels.
4
+ * NOTE: Keep aligned with LogLevel in @dxos/protocols.
4
5
  */
5
6
  export declare enum LogLevel {
6
7
  TRACE = 5,
@@ -10,9 +11,7 @@ export declare enum LogLevel {
10
11
  WARN = 13,
11
12
  ERROR = 14
12
13
  }
13
- export declare const levels: {
14
- [index: string]: LogLevel;
15
- };
14
+ export declare const levels: Record<string, LogLevel>;
16
15
  export declare const shortLevelName: {
17
16
  5: string;
18
17
  10: string;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C;;GAEG;AAGH,oBAAY,QAAQ;IAClB,KAAK,IAAI;IACT,KAAK,KAAK;IACV,OAAO,KAAK;IACZ,IAAI,KAAK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QAAQ;IAClB,KAAK,IAAI;IACT,KAAK,KAAK;IACV,OAAO,KAAK;IACZ,IAAI,KAAK;IACT,IAAI,KAAK;IACT,KAAK,KAAK;CACX;AAED,eAAO,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAO3C,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;CAO1B,CAAC;AAEF,oBAAY,gBAAgB;IAC1B,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,KAAK,UAAU;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE,QAAQ,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,QAAQ,CAAC;IACtC,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,QAAQ,CAAC;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC;IACtC,SAAS,CAAC,EAAE;QACV,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,OAAO,CAAC;QACnB,cAAc,EAAE,OAAO,CAAC;KACzB,CAAC;IACF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,UAAU,CAAC;IACpB,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,cAAc,CAAC,EAAE,SAAS,EAAE,CAAC;IAC7B,UAAU,EAAE,YAAY,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
@@ -9,7 +9,7 @@ export type LogContext = Record<string, any> | Error | any;
9
9
  */
10
10
  export interface LogEntry {
11
11
  level: LogLevel;
12
- message: string;
12
+ message?: string;
13
13
  context?: LogContext;
14
14
  meta?: CallMetadata;
15
15
  error?: Error;
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/context.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,QAAQ,CAAC;AAG3C;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,KAAK,GAAG,GAAG,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,QAAQ,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;AAMxE;;GAEG;AACH,eAAO,MAAM,SAAS,GAAI,OAAO,QAAQ,EAAE,UAAU,SAAS,EAAE,KAAG,OAMlE,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,OAAO,QAAQ,KAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SA2B3E,CAAC"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/context.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,QAAQ,CAAC;AAG3C;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,KAAK,GAAG,GAAG,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,QAAQ,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;AAMxE;;GAEG;AACH,eAAO,MAAM,SAAS,GAAI,OAAO,QAAQ,EAAE,UAAU,SAAS,EAAE,KAAG,OAMlE,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,OAAO,QAAQ,KAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SA0B3E,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../../src/decorators.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,QAAQ,CAAC;AAI3C,eAAO,MAAM,wBAAwB,GAClC,KAAK,UAAU,MACf,OAAO,KAAK,EAAE,OAAO,KAAK,EAAE,OAAO,YAAY,KAAG,eAwClD,CAAC;AAEJ,eAAO,MAAM,0BAA0B,GACpC,KAAK,UAAU,MACf,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAChC,MAAM,MAAM,EACZ,IAAI,CAAC,EACL,OAAM;IAAE,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,CAAA;CAAO,KAC7E,CA6CF,CAAC"}
1
+ {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../../src/decorators.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,QAAQ,CAAC;AAI3C,eAAO,MAAM,wBAAwB,GAClC,KAAK,UAAU,MACf,OAAO,KAAK,EAAE,OAAO,KAAK,EAAE,OAAO,YAAY,KAAG,eAwClD,CAAC;AAEJ,eAAO,MAAM,0BAA0B,GACpC,KAAK,UAAU,MACf,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAChC,MAAM,MAAM,EACZ,IAAI,CAAC,EACL,OAAM;IAAE,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,CAAA;CAAO,KAC7E,CA6CF,CAAC"}