@dxos/log 0.3.7 → 0.3.8-main.0ab6c73

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.
@@ -87,6 +87,30 @@ var getContextFromEntry = (entry) => {
87
87
  return context && Object.keys(context).length > 0 ? context : void 0;
88
88
  };
89
89
 
90
+ // packages/common/log/src/decorators.ts
91
+ import { inspect } from "@dxos/node-std/util";
92
+ var createMethodLogDecorator = (log2) => (arg0, arg1, meta) => (target, propertyKey, descriptor) => {
93
+ const method = descriptor.value;
94
+ descriptor.value = function(...args) {
95
+ const combinedMeta = {
96
+ ...meta ?? {},
97
+ S: this
98
+ };
99
+ const formattedArgs = args.map((arg) => inspect(arg, false, 1, true)).join(", ");
100
+ try {
101
+ const result = method.apply(this, args);
102
+ log2.info(`${propertyKey}(${formattedArgs}) => ${inspect(result, false, 1, true)}`, {}, combinedMeta);
103
+ return result;
104
+ } catch (err) {
105
+ log2.error(`${propertyKey}(${formattedArgs}) \u{1F525} ${err}`, {}, combinedMeta);
106
+ throw err;
107
+ }
108
+ };
109
+ Object.defineProperty(descriptor.value, "name", {
110
+ value: propertyKey + "$log"
111
+ });
112
+ };
113
+
90
114
  // packages/common/log/src/options.ts
91
115
  import defaultsDeep from "lodash.defaultsdeep";
92
116
 
@@ -104,9 +128,9 @@ var CONSOLE_PROCESSOR = () => {
104
128
  };
105
129
 
106
130
  // packages/common/log/src/processors/debug-processor.ts
107
- import { inspect } from "@dxos/node-std/util";
131
+ import { inspect as inspect2 } from "@dxos/node-std/util";
108
132
  var DEBUG_PROCESSOR = (config, entry) => {
109
- console.log(inspect(entry, false, null, true));
133
+ console.log(inspect2(entry, false, null, true));
110
134
  };
111
135
 
112
136
  // packages/common/log/src/processors/browser-processor.ts
@@ -323,6 +347,7 @@ var createLog = () => {
323
347
  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");
324
348
  log2.stack = (message, context, meta) => processLog(LogLevel.INFO, `${message ?? "Stack Dump"}
325
349
  ${getFormattedStackTrace()}`, context, meta);
350
+ log2.method = createMethodLogDecorator(log2);
326
351
  const processLog = (level, message, context = {}, meta, error) => {
327
352
  log2._config.processors.forEach((processor) => processor(log2._config, {
328
353
  level,
@@ -338,7 +363,7 @@ var log = globalThis.dx_log ??= createLog();
338
363
  var getFormattedStackTrace = () => new Error().stack.split("\n").slice(3).join("\n");
339
364
 
340
365
  // packages/common/log/src/experimental/ownership.ts
341
- import { inspect as inspect2 } from "@dxos/node-std/util";
366
+ import { inspect as inspect3 } from "@dxos/node-std/util";
342
367
  var kOwnershipScope = Symbol("kOwnershipScope");
343
368
  var kCurrentOwnershipScope = Symbol("kCurrentOwnershipScope");
344
369
  var kDebugInfoProperties = Symbol("kDebugInfoProperties");
@@ -358,7 +383,7 @@ var OwnershipScope = class {
358
383
  }
359
384
  return info;
360
385
  }
361
- [inspect2.custom]() {
386
+ [inspect3.custom]() {
362
387
  return {
363
388
  className: this.constr.name,
364
389
  info: this.getInfo(),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/index.ts", "../../../src/config.ts", "../../../src/scope.ts", "../../../src/context.ts", "../../../src/options.ts", "../../../src/platform/browser/index.ts", "../../../src/processors/console-stub.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\n// Message helpers.\nimport omit from 'lodash.omit';\nimport pick from 'lodash.pick';\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 INFO = 11,\n WARN = 12,\n ERROR = 13,\n}\n\nexport const levels: { [index: string]: LogLevel } = {\n trace: LogLevel.TRACE,\n debug: LogLevel.DEBUG,\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.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 if (entry.context) {\n if (entry.context instanceof Error) {\n // Additional context from Error.\n const c = (entry.context as any).context;\n // If ERROR then show stacktrace.\n context = Object.assign(context ?? {}, { error: entry.context.stack, ...c });\n } else if (typeof entry.context === 'object') {\n context = Object.assign(context ?? {}, entry.context);\n }\n }\n\n return context && Object.keys(context).length > 0 ? context : undefined;\n};\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(\n {},\n options,\n nodeOptions && loadOptions(nodeOptions.file),\n nodeOptions,\n );\n\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 { type LogOptions } from '../../config';\n\n// NOTE: Implementation for the browser. See `package.json`.\nexport const loadOptions = (filepath?: string): LogOptions | undefined => {\n try {\n return JSON.parse(localStorage.getItem('dxlog')!);\n } catch (err) {\n return undefined;\n }\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\n// TODO(wittjosiah): Consider mapping console processor directly to browser processor in the browser.\nexport const CONSOLE_PROCESSOR = () => {};\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 { 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 typeof mochaExecutor !== 'undefined'\n ? {\n useTestProcessor: true,\n printFileLinks: true,\n }\n : {\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 args.push(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 // 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 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\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 args.push(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 { jsonify } from '@dxos/util';\n\nimport { LogLevel } from '../config';\nimport { type LogProcessor, getContextFromEntry } from '../context';\n\nexport const createFileProcessor = ({ path, levels }: { path: string; levels: LogLevel[] }): LogProcessor => {\n let fd: number | undefined;\n\n return (config, entry) => {\n if (!levels.includes(entry.level)) {\n return;\n }\n if (!fd) {\n try {\n mkdirSync(dirname(path));\n } catch {}\n fd = openSync(path, 'w');\n }\n\n const record = {\n ...entry,\n timestamp: Date.now(),\n meta: {\n file: entry.meta?.F,\n line: entry.meta?.L,\n },\n context: jsonify(getContextFromEntry(entry)),\n };\n appendFileSync(fd, JSON.stringify(record) + '\\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 path: 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 { 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 */\ninterface LogMethods {\n trace: LogFunction;\n debug: 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}\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.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, error.stack, context, meta);\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 /**\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\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(public constr: any, public parent?: OwnershipScope) {}\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": ";AAKA,OAAOA,UAAU;AACjB,OAAOC,UAAU;;;ICKV;UAAKC,WAAQ;AAARA,EAAAA,UAAAA,UACVC,OAAAA,IAAQ,CAAA,IAARA;AADUD,EAAAA,UAAAA,UAEVE,OAAAA,IAAQ,EAAA,IAARA;AAFUF,EAAAA,UAAAA,UAGVG,MAAAA,IAAO,EAAA,IAAPA;AAHUH,EAAAA,UAAAA,UAIVI,MAAAA,IAAO,EAAA,IAAPA;AAJUJ,EAAAA,UAAAA,UAKVK,OAAAA,IAAQ,EAAA,IAARA;GALUL,aAAAA,WAAAA,CAAAA,EAAAA;AAQL,IAAMM,SAAwC;EACnDC,OAAOP,SAASC;EAChBO,OAAOR,SAASE;EAChBO,MAAMT,SAASG;EACfO,MAAMV,SAASI;EACfO,OAAOX,SAASK;AAClB;AAEO,IAAMO,iBAAiB;EAC5B,CAACZ,SAASC,KAAK,GAAG;EAClB,CAACD,SAASE,KAAK,GAAG;EAClB,CAACF,SAASG,IAAI,GAAG;EACjB,CAACH,SAASI,IAAI,GAAG;EACjB,CAACJ,SAASK,KAAK,GAAG;AACpB;IAEO;UAAKQ,mBAAgB;AAAhBA,EAAAA,kBACVC,SAAAA,IAAU;AADAD,EAAAA,kBAEVE,SAAAA,IAAU;AAFAF,EAAAA,kBAGVX,OAAAA,IAAQ;GAHEW,qBAAAA,mBAAAA,CAAAA,EAAAA;;;AC/BZ,IAAMG,oBAAoBC,OAAO,mBAAA;AAc1B,IAAMC,UAAU,CAACC,Q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AAQ,KAAKA;IACf;EACF;AACF;AA+CO,IAAMW,2BAA2B,CAACC,YAAiBA;",
6
- "names": ["omit", "pick", "LogLevel", "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "levels", "trace", "debug", "info", "warn", "error", "shortLevelName", "LogProcessorType", "CONSOLE", "BROWSER", "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", "Error", "c", "error", "stack", "defaultsDeep", "loadOptions", "filepath", "JSON", "parse", "localStorage", "getItem", "err", "undefined", "CONSOLE_PROCESSOR", "inspect", "DEBUG_PROCESSOR", "config", "entry", "console", "log", "inspect", "safariCheck", "getRelativeFilename", "filename", "match", "filePath", "CONFIG", "mochaExecutor", "useTestProcessor", "printFileLinks", "APP_BROWSER_PROCESSOR", "config", "entry", "shouldLog", "filters", "LOG_BROWSER_PREFIX", "prefix", "LOG_BROWSER_CSS", "link", "meta", "F", "filepath", "replace", "L", "args", "push", "message", "context", "getContextFromEntry", "levels", "LogLevel", "ERROR", "console", "error", "WARN", "warn", "DEBUG", "log", "safariCheck", "length", "join", "level", "C", "TEST_BROWSER_PROCESSOR", "path", "BROWSER_PROCESSOR", "appendFileSync", "mkdirSync", "openSync", "dirname", "jsonify", "createFileProcessor", "path", "levels", "fd", "config", "entry", "includes", "level", "mkdirSync", "dirname", "openSync", "record", "timestamp", "Date", "now", "meta", "file", "F", "line", "L", "context", "jsonify", "getContextFromEntry", "appendFileSync", "JSON", "stringify", "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", "info", "INFO", "warn", "WARN", "error", "ERROR", "catch", "context", "meta", "stack", "break", "message", "getFormattedStackTrace", "level", "forEach", "globalThis", "dx_log", "Error", "split", "slice", "join", "inspect", "kOwnershipScope", "Symbol", "kCurrentOwnershipScope", "kDebugInfoProperties", "OwnershipScope", "constructor", "constr", "parent", "getInfo", "instance", "props", "prototype", "info", "prop", "inspect", "custom", "className", "name", "getCurrentOwnershipScope", "thisRef"]
3
+ "sources": ["../../../src/index.ts", "../../../src/config.ts", "../../../src/scope.ts", "../../../src/context.ts", "../../../src/decorators.ts", "../../../src/options.ts", "../../../src/platform/browser/index.ts", "../../../src/processors/console-stub.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\n// Message helpers.\nimport omit from 'lodash.omit';\nimport pick from 'lodash.pick';\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 INFO = 11,\n WARN = 12,\n ERROR = 13,\n}\n\nexport const levels: { [index: string]: LogLevel } = {\n trace: LogLevel.TRACE,\n debug: LogLevel.DEBUG,\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.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 if (entry.context) {\n if (entry.context instanceof Error) {\n // Additional context from Error.\n const c = (entry.context as any).context;\n // If ERROR then show stacktrace.\n context = Object.assign(context ?? {}, { error: entry.context.stack, ...c });\n } else if (typeof entry.context === 'object') {\n context = Object.assign(context ?? {}, entry.context);\n }\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 type { LogMethods } from './log';\nimport { type CallMetadata } from './meta';\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 descriptor.value = function (this: any, ...args: any) {\n const combinedMeta = {\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 result = method.apply(this, args);\n log.info(`${propertyKey as string}(${formattedArgs}) => ${inspect(result, false, 1, true)}`, {}, combinedMeta);\n return result;\n } catch (err) {\n log.error(`${propertyKey as string}(${formattedArgs}) 🔥 ${err}`, {}, combinedMeta);\n throw err;\n }\n };\n Object.defineProperty(descriptor.value, 'name', { value: (propertyKey as string) + '$log' });\n };\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(\n {},\n options,\n nodeOptions && loadOptions(nodeOptions.file),\n nodeOptions,\n );\n\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 { type LogOptions } from '../../config';\n\n// NOTE: Implementation for the browser. See `package.json`.\nexport const loadOptions = (filepath?: string): LogOptions | undefined => {\n try {\n return JSON.parse(localStorage.getItem('dxlog')!);\n } catch (err) {\n return undefined;\n }\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\n// TODO(wittjosiah): Consider mapping console processor directly to browser processor in the browser.\nexport const CONSOLE_PROCESSOR = () => {};\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 { 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 typeof mochaExecutor !== 'undefined'\n ? {\n useTestProcessor: true,\n printFileLinks: true,\n }\n : {\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 args.push(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 // 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 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\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 args.push(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 { jsonify } from '@dxos/util';\n\nimport { LogLevel } from '../config';\nimport { type LogProcessor, getContextFromEntry } from '../context';\n\nexport const createFileProcessor = ({ path, levels }: { path: string; levels: LogLevel[] }): LogProcessor => {\n let fd: number | undefined;\n\n return (config, entry) => {\n if (!levels.includes(entry.level)) {\n return;\n }\n if (!fd) {\n try {\n mkdirSync(dirname(path));\n } catch {}\n fd = openSync(path, 'w');\n }\n\n const record = {\n ...entry,\n timestamp: Date.now(),\n meta: {\n file: entry.meta?.F,\n line: entry.meta?.L,\n },\n context: jsonify(getContextFromEntry(entry)),\n };\n appendFileSync(fd, JSON.stringify(record) + '\\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 path: 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 { 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 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}\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.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, error.stack, context, meta);\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\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\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(public constr: any, public parent?: OwnershipScope) {}\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": ";AAKA,OAAOA,UAAU;AACjB,OAAOC,UAAU;;;ICKV;UAAKC,WAAQ;AAARA,EAAAA,UAAAA,UACVC,OAAAA,IAAQ,CAAA,IAARA;AADUD,EAAAA,UAAAA,UAEVE,OAAAA,IAAQ,EAAA,IAARA;AAFUF,EAAAA,UAAAA,UAGVG,MAAAA,IAAO,EAAA,IAAPA;AAHUH,EAAAA,UAAAA,UAIVI,MAAAA,IAAO,EAAA,IAAPA;AAJUJ,EAAAA,UAAAA,UAKVK,OAAAA,IAAQ,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AAQH,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", "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "levels", "trace", "debug", "info", "warn", "error", "shortLevelName", "LogProcessorType", "CONSOLE", "BROWSER", "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", "Error", "c", "error", "stack", "inspect", "createMethodLogDecorator", "log", "arg0", "arg1", "meta", "target", "propertyKey", "descriptor", "method", "value", "args", "combinedMeta", "S", "formattedArgs", "map", "arg", "inspect", "join", "result", "apply", "info", "err", "error", "Object", "defineProperty", "defaultsDeep", "loadOptions", "filepath", "JSON", "parse", "localStorage", "getItem", "err", "undefined", "CONSOLE_PROCESSOR", "inspect", "DEBUG_PROCESSOR", "config", "entry", "console", "log", "inspect", "safariCheck", "getRelativeFilename", "filename", "match", "filePath", "CONFIG", "mochaExecutor", "useTestProcessor", "printFileLinks", "APP_BROWSER_PROCESSOR", "config", "entry", "shouldLog", "filters", "LOG_BROWSER_PREFIX", "prefix", "LOG_BROWSER_CSS", "link", "meta", "F", "filepath", "replace", "L", "args", "push", "message", "context", "getContextFromEntry", "levels", "LogLevel", "ERROR", "console", "error", "WARN", "warn", "DEBUG", "log", "safariCheck", "length", "join", "level", "C", "TEST_BROWSER_PROCESSOR", "path", "BROWSER_PROCESSOR", "appendFileSync", "mkdirSync", "openSync", "dirname", "jsonify", "createFileProcessor", "path", "levels", "fd", "config", "entry", "includes", "level", "mkdirSync", "dirname", "openSync", "record", "timestamp", "Date", "now", "meta", "file", "F", "line", "L", "context", "jsonify", "getContextFromEntry", "appendFileSync", "JSON", "stringify", "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", "info", "INFO", "warn", "WARN", "error", "ERROR", "catch", "context", "meta", "stack", "break", "message", "getFormattedStackTrace", "method", "createMethodLogDecorator", "level", "forEach", "globalThis", "dx_log", "Error", "split", "slice", "join", "inspect", "kOwnershipScope", "Symbol", "kCurrentOwnershipScope", "kDebugInfoProperties", "OwnershipScope", "constructor", "constr", "parent", "getInfo", "instance", "props", "prototype", "info", "prop", "inspect", "custom", "className", "name", "getCurrentOwnershipScope", "thisRef"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"packages/common/log/src/config.ts":{"bytes":4200,"imports":[],"format":"esm"},"packages/common/log/src/scope.ts":{"bytes":3842,"imports":[],"format":"esm"},"packages/common/log/src/context.ts":{"bytes":5932,"imports":[{"path":"packages/common/log/src/scope.ts","kind":"import-statement","original":"./scope"}],"format":"esm"},"packages/common/log/src/platform/browser/index.ts":{"bytes":1315,"imports":[],"format":"esm"},"packages/common/log/src/platform/index.ts":{"bytes":450,"imports":[{"path":"packages/common/log/src/platform/browser/index.ts","kind":"import-statement","original":"./node"}],"format":"esm"},"packages/common/log/src/processors/console-stub.ts":{"bytes":818,"imports":[],"format":"esm"},"packages/common/log/src/processors/debug-processor.ts":{"bytes":1060,"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true}],"format":"esm"},"packages/common/log/src/processors/browser-processor.ts":{"bytes":13071,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/common/log/src/config.ts","kind":"import-statement","original":"../config"},{"path":"packages/common/log/src/context.ts","kind":"import-statement","original":"../context"}],"format":"esm"},"packages/common/log/src/processors/file-processor.ts":{"bytes":5316,"imports":[{"path":"@dxos/node-std/fs","kind":"import-statement","external":true},{"path":"@dxos/node-std/path","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/common/log/src/config.ts","kind":"import-statement","original":"../config"},{"path":"packages/common/log/src/context.ts","kind":"import-statement","original":"../context"}],"format":"esm"},"packages/common/log/src/processors/index.ts":{"bytes":807,"imports":[{"path":"packages/common/log/src/processors/console-stub.ts","kind":"import-statement","original":"./console-processor"},{"path":"packages/common/log/src/processors/debug-processor.ts","kind":"import-statement","original":"./debug-processor"},{"path":"packages/common/log/src/processors/browser-processor.ts","kind":"import-statement","original":"./browser-processor"},{"path":"packages/common/log/src/processors/file-processor.ts","kind":"import-statement","original":"./file-processor"}],"format":"esm"},"packages/common/log/src/options.ts":{"bytes":7634,"imports":[{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"packages/common/log/src/config.ts","kind":"import-statement","original":"./config"},{"path":"packages/common/log/src/platform/index.ts","kind":"import-statement","original":"./platform"},{"path":"packages/common/log/src/processors/index.ts","kind":"import-statement","original":"./processors"}],"format":"esm"},"packages/common/log/src/log.ts":{"bytes":9777,"imports":[{"path":"packages/common/log/src/config.ts","kind":"import-statement","original":"./config"},{"path":"packages/common/log/src/options.ts","kind":"import-statement","original":"./options"}],"format":"esm"},"packages/common/log/src/meta.ts":{"bytes":1615,"imports":[],"format":"esm"},"packages/common/log/src/experimental/ownership.ts":{"bytes":9236,"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true}],"format":"esm"},"packages/common/log/src/index.ts":{"bytes":1653,"imports":[{"path":"lodash.omit","kind":"import-statement","external":true},{"path":"lodash.pick","kind":"import-statement","external":true},{"path":"packages/common/log/src/config.ts","kind":"import-statement","original":"./config"},{"path":"packages/common/log/src/context.ts","kind":"import-statement","original":"./context"},{"path":"packages/common/log/src/log.ts","kind":"import-statement","original":"./log"},{"path":"packages/common/log/src/options.ts","kind":"import-statement","original":"./options"},{"path":"packages/common/log/src/processors/index.ts","kind":"import-statement","original":"./processors"},{"path":"packages/common/log/src/scope.ts","kind":"import-statement","original":"./scope"},{"path":"packages/common/log/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/common/log/src/experimental/ownership.ts","kind":"import-statement","original":"./experimental/ownership"}],"format":"esm"}},"outputs":{"packages/common/log/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":31172},"packages/common/log/dist/lib/browser/index.mjs":{"imports":[{"path":"lodash.omit","kind":"import-statement","external":true},{"path":"lodash.pick","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/node-std/fs","kind":"import-statement","external":true},{"path":"@dxos/node-std/path","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/node-std/util","kind":"import-statement","external":true}],"exports":["BROWSER_PROCESSOR","CONSOLE_PROCESSOR","DEBUG_PROCESSOR","FILE_PROCESSOR","LogLevel","LogProcessorType","createFileProcessor","gatherLogInfoFromScope","getContextFromEntry","getCurrentOwnershipScope","levels","log","logInfo","omit","parseFilter","pick","shortLevelName","shouldLog"],"entryPoint":"packages/common/log/src/index.ts","inputs":{"packages/common/log/src/index.ts":{"bytesInOutput":64},"packages/common/log/src/config.ts":{"bytesInOutput":821},"packages/common/log/src/scope.ts":{"bytesInOutput":571},"packages/common/log/src/context.ts":{"bytesInOutput":981},"packages/common/log/src/options.ts":{"bytesInOutput":1556},"packages/common/log/src/platform/browser/index.ts":{"bytesInOutput":140},"packages/common/log/src/platform/index.ts":{"bytesInOutput":0},"packages/common/log/src/processors/console-stub.ts":{"bytesInOutput":35},"packages/common/log/src/processors/index.ts":{"bytesInOutput":0},"packages/common/log/src/processors/debug-processor.ts":{"bytesInOutput":143},"packages/common/log/src/processors/browser-processor.ts":{"bytesInOutput":2377},"packages/common/log/src/processors/file-processor.ts":{"bytesInOutput":1098},"packages/common/log/src/log.ts":{"bytesInOutput":1873},"packages/common/log/src/experimental/ownership.ts":{"bytesInOutput":792}},"bytes":11399}}}
1
+ {"inputs":{"packages/common/log/src/config.ts":{"bytes":4210,"imports":[],"format":"esm"},"packages/common/log/src/scope.ts":{"bytes":3852,"imports":[],"format":"esm"},"packages/common/log/src/context.ts":{"bytes":5942,"imports":[{"path":"packages/common/log/src/scope.ts","kind":"import-statement","original":"./scope"}],"format":"esm"},"packages/common/log/src/decorators.ts":{"bytes":4216,"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true}],"format":"esm"},"packages/common/log/src/platform/browser/index.ts":{"bytes":1325,"imports":[],"format":"esm"},"packages/common/log/src/platform/index.ts":{"bytes":460,"imports":[{"path":"packages/common/log/src/platform/browser/index.ts","kind":"import-statement","original":"./node"}],"format":"esm"},"packages/common/log/src/processors/console-stub.ts":{"bytes":828,"imports":[],"format":"esm"},"packages/common/log/src/processors/debug-processor.ts":{"bytes":1070,"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true}],"format":"esm"},"packages/common/log/src/processors/browser-processor.ts":{"bytes":13081,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/common/log/src/config.ts","kind":"import-statement","original":"../config"},{"path":"packages/common/log/src/context.ts","kind":"import-statement","original":"../context"}],"format":"esm"},"packages/common/log/src/processors/file-processor.ts":{"bytes":5326,"imports":[{"path":"@dxos/node-std/fs","kind":"import-statement","external":true},{"path":"@dxos/node-std/path","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/common/log/src/config.ts","kind":"import-statement","original":"../config"},{"path":"packages/common/log/src/context.ts","kind":"import-statement","original":"../context"}],"format":"esm"},"packages/common/log/src/processors/index.ts":{"bytes":817,"imports":[{"path":"packages/common/log/src/processors/console-stub.ts","kind":"import-statement","original":"./console-processor"},{"path":"packages/common/log/src/processors/debug-processor.ts","kind":"import-statement","original":"./debug-processor"},{"path":"packages/common/log/src/processors/browser-processor.ts","kind":"import-statement","original":"./browser-processor"},{"path":"packages/common/log/src/processors/file-processor.ts","kind":"import-statement","original":"./file-processor"}],"format":"esm"},"packages/common/log/src/options.ts":{"bytes":7644,"imports":[{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"packages/common/log/src/config.ts","kind":"import-statement","original":"./config"},{"path":"packages/common/log/src/platform/index.ts","kind":"import-statement","original":"./platform"},{"path":"packages/common/log/src/processors/index.ts","kind":"import-statement","original":"./processors"}],"format":"esm"},"packages/common/log/src/log.ts":{"bytes":10284,"imports":[{"path":"packages/common/log/src/config.ts","kind":"import-statement","original":"./config"},{"path":"packages/common/log/src/decorators.ts","kind":"import-statement","original":"./decorators"},{"path":"packages/common/log/src/options.ts","kind":"import-statement","original":"./options"}],"format":"esm"},"packages/common/log/src/meta.ts":{"bytes":1625,"imports":[],"format":"esm"},"packages/common/log/src/experimental/ownership.ts":{"bytes":9246,"imports":[{"path":"@dxos/node-std/util","kind":"import-statement","external":true}],"format":"esm"},"packages/common/log/src/index.ts":{"bytes":1663,"imports":[{"path":"lodash.omit","kind":"import-statement","external":true},{"path":"lodash.pick","kind":"import-statement","external":true},{"path":"packages/common/log/src/config.ts","kind":"import-statement","original":"./config"},{"path":"packages/common/log/src/context.ts","kind":"import-statement","original":"./context"},{"path":"packages/common/log/src/log.ts","kind":"import-statement","original":"./log"},{"path":"packages/common/log/src/options.ts","kind":"import-statement","original":"./options"},{"path":"packages/common/log/src/processors/index.ts","kind":"import-statement","original":"./processors"},{"path":"packages/common/log/src/scope.ts","kind":"import-statement","original":"./scope"},{"path":"packages/common/log/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/common/log/src/experimental/ownership.ts","kind":"import-statement","original":"./experimental/ownership"}],"format":"esm"}},"outputs":{"packages/common/log/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":33590},"packages/common/log/dist/lib/browser/index.mjs":{"imports":[{"path":"lodash.omit","kind":"import-statement","external":true},{"path":"lodash.pick","kind":"import-statement","external":true},{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"@dxos/node-std/util","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/node-std/fs","kind":"import-statement","external":true},{"path":"@dxos/node-std/path","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@dxos/node-std/util","kind":"import-statement","external":true}],"exports":["BROWSER_PROCESSOR","CONSOLE_PROCESSOR","DEBUG_PROCESSOR","FILE_PROCESSOR","LogLevel","LogProcessorType","createFileProcessor","gatherLogInfoFromScope","getContextFromEntry","getCurrentOwnershipScope","levels","log","logInfo","omit","parseFilter","pick","shortLevelName","shouldLog"],"entryPoint":"packages/common/log/src/index.ts","inputs":{"packages/common/log/src/index.ts":{"bytesInOutput":64},"packages/common/log/src/config.ts":{"bytesInOutput":821},"packages/common/log/src/scope.ts":{"bytesInOutput":571},"packages/common/log/src/context.ts":{"bytesInOutput":981},"packages/common/log/src/decorators.ts":{"bytesInOutput":797},"packages/common/log/src/options.ts":{"bytesInOutput":1556},"packages/common/log/src/platform/browser/index.ts":{"bytesInOutput":140},"packages/common/log/src/platform/index.ts":{"bytesInOutput":0},"packages/common/log/src/processors/console-stub.ts":{"bytesInOutput":35},"packages/common/log/src/processors/index.ts":{"bytesInOutput":0},"packages/common/log/src/processors/debug-processor.ts":{"bytesInOutput":156},"packages/common/log/src/processors/browser-processor.ts":{"bytesInOutput":2377},"packages/common/log/src/processors/file-processor.ts":{"bytesInOutput":1098},"packages/common/log/src/log.ts":{"bytesInOutput":1921},"packages/common/log/src/experimental/ownership.ts":{"bytesInOutput":792}},"bytes":12299}}}
@@ -26,10 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // packages/common/log/src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
29
+ var node_exports = {};
30
+ __export(node_exports, {
33
31
  BROWSER_PROCESSOR: () => BROWSER_PROCESSOR,
34
32
  CONSOLE_PROCESSOR: () => CONSOLE_PROCESSOR,
35
33
  DEBUG_PROCESSOR: () => DEBUG_PROCESSOR,
@@ -45,18 +43,30 @@ __export(src_exports, {
45
43
  levels: () => levels,
46
44
  log: () => log,
47
45
  logInfo: () => logInfo,
48
- omit: () => import_lodash3.default,
46
+ omit: () => import_lodash.default,
49
47
  parseFilter: () => parseFilter,
50
- pick: () => import_lodash4.default,
48
+ pick: () => import_lodash2.default,
51
49
  shortLevelName: () => shortLevelName,
52
50
  shouldLog: () => shouldLog,
53
51
  truncate: () => truncate
54
52
  });
55
- module.exports = __toCommonJS(src_exports);
56
- var import_lodash3 = __toESM(require("lodash.omit"));
57
- var import_lodash4 = __toESM(require("lodash.pick"));
58
-
59
- // packages/common/log/src/config.ts
53
+ module.exports = __toCommonJS(node_exports);
54
+ var import_lodash = __toESM(require("lodash.omit"));
55
+ var import_lodash2 = __toESM(require("lodash.pick"));
56
+ var import_node_util = require("node:util");
57
+ var import_lodash3 = __toESM(require("lodash.defaultsdeep"));
58
+ var import_js_yaml = __toESM(require("js-yaml"));
59
+ var import_node_fs = __toESM(require("node:fs"));
60
+ var import_chalk = __toESM(require("chalk"));
61
+ var import_lodash4 = __toESM(require("lodash.pickby"));
62
+ var import_node_util2 = require("node:util");
63
+ var import_util = require("@dxos/util");
64
+ var import_node_util3 = require("node:util");
65
+ var import_util2 = require("@dxos/util");
66
+ var import_node_fs2 = require("node:fs");
67
+ var import_node_path = require("node:path");
68
+ var import_util3 = require("@dxos/util");
69
+ var import_node_util4 = require("node:util");
60
70
  var LogLevel;
61
71
  (function(LogLevel2) {
62
72
  LogLevel2[LogLevel2["TRACE"] = 5] = "TRACE";
@@ -85,8 +95,6 @@ var LogProcessorType;
85
95
  LogProcessorType2["BROWSER"] = "browser";
86
96
  LogProcessorType2["DEBUG"] = "debug";
87
97
  })(LogProcessorType || (LogProcessorType = {}));
88
-
89
- // packages/common/log/src/scope.ts
90
98
  var logInfoProperties = Symbol("logInfoProperties");
91
99
  var logInfo = (target, propertyKey, descriptor) => {
92
100
  (target[logInfoProperties] ??= []).push(propertyKey);
@@ -107,8 +115,6 @@ var gatherLogInfoFromScope = (scope) => {
107
115
  }
108
116
  return res;
109
117
  };
110
-
111
- // packages/common/log/src/context.ts
112
118
  var matchFilter = (filter, level, path) => {
113
119
  return level >= filter.level && (!filter.pattern || path.includes(filter.pattern));
114
120
  };
@@ -140,13 +146,27 @@ var getContextFromEntry = (entry) => {
140
146
  }
141
147
  return context && Object.keys(context).length > 0 ? context : void 0;
142
148
  };
143
-
144
- // packages/common/log/src/options.ts
145
- var import_lodash2 = __toESM(require("lodash.defaultsdeep"));
146
-
147
- // packages/common/log/src/platform/node/index.ts
148
- var import_js_yaml = __toESM(require("js-yaml"));
149
- var import_node_fs = __toESM(require("node:fs"));
149
+ var createMethodLogDecorator = (log2) => (arg0, arg1, meta) => (target, propertyKey, descriptor) => {
150
+ const method = descriptor.value;
151
+ descriptor.value = function(...args) {
152
+ const combinedMeta = {
153
+ ...meta ?? {},
154
+ S: this
155
+ };
156
+ const formattedArgs = args.map((arg) => (0, import_node_util.inspect)(arg, false, 1, true)).join(", ");
157
+ try {
158
+ const result = method.apply(this, args);
159
+ log2.info(`${propertyKey}(${formattedArgs}) => ${(0, import_node_util.inspect)(result, false, 1, true)}`, {}, combinedMeta);
160
+ return result;
161
+ } catch (err) {
162
+ log2.error(`${propertyKey}(${formattedArgs}) \u{1F525} ${err}`, {}, combinedMeta);
163
+ throw err;
164
+ }
165
+ };
166
+ Object.defineProperty(descriptor.value, "name", {
167
+ value: propertyKey + "$log"
168
+ });
169
+ };
150
170
  var loadOptions = (filepath) => {
151
171
  if (filepath) {
152
172
  try {
@@ -159,12 +179,6 @@ var loadOptions = (filepath) => {
159
179
  }
160
180
  }
161
181
  };
162
-
163
- // packages/common/log/src/processors/console-processor.ts
164
- var import_chalk = __toESM(require("chalk"));
165
- var import_lodash = __toESM(require("lodash.pickby"));
166
- var import_node_util = require("node:util");
167
- var import_util = require("@dxos/util");
168
182
  var LEVEL_COLORS = {
169
183
  [LogLevel.TRACE]: "gray",
170
184
  [LogLevel.DEBUG]: "gray",
@@ -245,7 +259,7 @@ var CONSOLE_PROCESSOR = (config, entry) => {
245
259
  }
246
260
  const context = getContextFromEntry(entry);
247
261
  if (context) {
248
- parts.context = (0, import_node_util.inspect)((0, import_lodash.default)(context, (value) => value !== void 0), {
262
+ parts.context = (0, import_node_util2.inspect)((0, import_lodash4.default)(context, (value) => value !== void 0), {
249
263
  depth: config.options.depth,
250
264
  colors: true,
251
265
  maxArrayLength: 8,
@@ -255,15 +269,9 @@ var CONSOLE_PROCESSOR = (config, entry) => {
255
269
  const line = formatter(config, parts).filter(Boolean).join(" ");
256
270
  console.log(line);
257
271
  };
258
-
259
- // packages/common/log/src/processors/debug-processor.ts
260
- var import_node_util2 = require("node:util");
261
272
  var DEBUG_PROCESSOR = (config, entry) => {
262
- console.log((0, import_node_util2.inspect)(entry, false, null, true));
273
+ console.log((0, import_node_util3.inspect)(entry, false, null, true));
263
274
  };
264
-
265
- // packages/common/log/src/processors/browser-processor.ts
266
- var import_util2 = require("@dxos/util");
267
275
  var getRelativeFilename2 = (filename) => {
268
276
  const match = filename.match(/.+\/(packages\/.+\/.+)/);
269
277
  if (match) {
@@ -356,11 +364,6 @@ var TEST_BROWSER_PROCESSOR = (config, entry) => {
356
364
  }
357
365
  };
358
366
  var BROWSER_PROCESSOR = CONFIG.useTestProcessor ? TEST_BROWSER_PROCESSOR : APP_BROWSER_PROCESSOR;
359
-
360
- // packages/common/log/src/processors/file-processor.ts
361
- var import_node_fs2 = require("node:fs");
362
- var import_node_path = require("node:path");
363
- var import_util3 = require("@dxos/util");
364
367
  var createFileProcessor = ({ path, levels: levels2 }) => {
365
368
  let fd;
366
369
  return (config, entry) => {
@@ -400,8 +403,6 @@ var FILE_PROCESSOR = createFileProcessor({
400
403
  LogLevel.TRACE
401
404
  ]
402
405
  });
403
-
404
- // packages/common/log/src/options.ts
405
406
  var processors = {
406
407
  [LogProcessorType.CONSOLE]: CONSOLE_PROCESSOR,
407
408
  [LogProcessorType.BROWSER]: BROWSER_PROCESSOR,
@@ -437,7 +438,7 @@ var getConfig = (options) => {
437
438
  filter: process.env.LOG_FILTER,
438
439
  processor: process.env.LOG_PROCESSOR
439
440
  } : void 0;
440
- const mergedOptions = (0, import_lodash2.default)({}, options, nodeOptions && loadOptions(nodeOptions.file), nodeOptions);
441
+ const mergedOptions = (0, import_lodash3.default)({}, options, nodeOptions && loadOptions(nodeOptions.file), nodeOptions);
441
442
  return {
442
443
  options: mergedOptions,
443
444
  filters: parseFilter(mergedOptions.filter ?? LogLevel.INFO),
@@ -448,8 +449,6 @@ var getConfig = (options) => {
448
449
  prefix: mergedOptions.prefix
449
450
  };
450
451
  };
451
-
452
- // packages/common/log/src/log.ts
453
452
  var createLog = () => {
454
453
  const log2 = (...params) => processLog(LogLevel.DEBUG, ...params);
455
454
  log2._config = getConfig();
@@ -476,6 +475,7 @@ var createLog = () => {
476
475
  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");
477
476
  log2.stack = (message, context, meta) => processLog(LogLevel.INFO, `${message ?? "Stack Dump"}
478
477
  ${getFormattedStackTrace()}`, context, meta);
478
+ log2.method = createMethodLogDecorator(log2);
479
479
  const processLog = (level, message, context = {}, meta, error) => {
480
480
  log2._config.processors.forEach((processor) => processor(log2._config, {
481
481
  level,
@@ -489,9 +489,6 @@ ${getFormattedStackTrace()}`, context, meta);
489
489
  };
490
490
  var log = globalThis.dx_log ??= createLog();
491
491
  var getFormattedStackTrace = () => new Error().stack.split("\n").slice(3).join("\n");
492
-
493
- // packages/common/log/src/experimental/ownership.ts
494
- var import_node_util3 = require("node:util");
495
492
  var kOwnershipScope = Symbol("kOwnershipScope");
496
493
  var kCurrentOwnershipScope = Symbol("kCurrentOwnershipScope");
497
494
  var kDebugInfoProperties = Symbol("kDebugInfoProperties");
@@ -511,7 +508,7 @@ var OwnershipScope = class {
511
508
  }
512
509
  return info;
513
510
  }
514
- [import_node_util3.inspect.custom]() {
511
+ [import_node_util4.inspect.custom]() {
515
512
  return {
516
513
  className: this.constr.name,
517
514
  info: this.getInfo(),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/index.ts", "../../../src/config.ts", "../../../src/scope.ts", "../../../src/context.ts", "../../../src/options.ts", "../../../src/platform/node/index.ts", "../../../src/processors/console-processor.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\n// Message helpers.\nimport omit from 'lodash.omit';\nimport pick from 'lodash.pick';\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 INFO = 11,\n WARN = 12,\n ERROR = 13,\n}\n\nexport const levels: { [index: string]: LogLevel } = {\n trace: LogLevel.TRACE,\n debug: LogLevel.DEBUG,\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.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 if (entry.context) {\n if (entry.context instanceof Error) {\n // Additional context from Error.\n const c = (entry.context as any).context;\n // If ERROR then show stacktrace.\n context = Object.assign(context ?? {}, { error: entry.context.stack, ...c });\n } else if (typeof entry.context === 'object') {\n context = Object.assign(context ?? {}, entry.context);\n }\n }\n\n return context && Object.keys(context).length > 0 ? context : undefined;\n};\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(\n {},\n options,\n nodeOptions && loadOptions(nodeOptions.file),\n nodeOptions,\n );\n\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 pickBy from 'lodash.pickby';\nimport { inspect } from 'node:util';\n\nimport { getPrototypeSpecificInstanceId } from '@dxos/util';\n\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.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\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\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, timestamp, level, message, context, error, scope },\n) => {\n const column = config.options?.formatter?.column;\n\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 chalk.grey(truncate(path, 16, true)), // NOTE: Breaks terminal linking.\n chalk[LEVEL_COLORS[level]](shortLevelName[level]),\n message,\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 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 { 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 typeof mochaExecutor !== 'undefined'\n ? {\n useTestProcessor: true,\n printFileLinks: true,\n }\n : {\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 args.push(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 // 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 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\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 args.push(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 { jsonify } from '@dxos/util';\n\nimport { LogLevel } from '../config';\nimport { type LogProcessor, getContextFromEntry } from '../context';\n\nexport const createFileProcessor = ({ path, levels }: { path: string; levels: LogLevel[] }): LogProcessor => {\n let fd: number | undefined;\n\n return (config, entry) => {\n if (!levels.includes(entry.level)) {\n return;\n }\n if (!fd) {\n try {\n mkdirSync(dirname(path));\n } catch {}\n fd = openSync(path, 'w');\n }\n\n const record = {\n ...entry,\n timestamp: Date.now(),\n meta: {\n file: entry.meta?.F,\n line: entry.meta?.L,\n },\n context: jsonify(getContextFromEntry(entry)),\n };\n appendFileSync(fd, JSON.stringify(record) + '\\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 path: 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 { 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 */\ninterface LogMethods {\n trace: LogFunction;\n debug: 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}\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.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, error.stack, context, meta);\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 /**\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\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(public constr: any, public parent?: OwnershipScope) {}\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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;6BAAAA;EAAA;6BAAAC;EAAA;;;;;AAKA,IAAAC,iBAAiB;AACjB,IAAAA,iBAAiB;;;ICKV;UAAKC,WAAQ;AAARA,EAAAA,UAAAA,UACVC,OAAAA,IAAQ,CAAA,IAARA;AADUD,EAAAA,UAAAA,UAEVE,OAAAA,IAAQ,EAAA,IAARA;AAFUF,EAAAA,UAAAA,UAGVG,MAAAA,IAAO,EAAA,IAAPA;AAHUH,EAAAA,UAAAA,UAIVI,MAAAA,IAAO,EAAA,IAAPA;AAJUJ,EAAAA,UAAAA,UAKVK,OAAAA,IAAQ,EAAA,IAARA;GALUL,aAAAA,WAAAA,CAAAA,EAAAA;AAQL,IAAMM,SAAwC;EACnDC,OAAOP,SAASC;EAChBO,OAAOR,SAASE;EAChBO,MAAMT,SAASG;EACfO,MAAMV,SAASI;EACfO,OAAOX,SAASK;AAClB;AAEO,IAAMO,iBAAiB;EAC5B,CAACZ,SAASC,KAAK,GAAG;EAClB,CAACD,SAASE,KAAK,GAAG;EAClB,CAACF,SAASG,IAAI,GAAG;EACjB,CAACH,SAASI,IAAI,GAAG;EACjB,CAACJ,SAASK,KAAK,GAAG;AACpB;IAEO;UAAKQ,mBAAgB;AAAhBA,EAAAA,kBACVC,SAAAA,IAAU;AADAD,EAAAA,kBAEVE,SAAAA,IAAU;AAFAF,EAAAA,kBAGVX,OAAAA,IAAQ;GAHEW,qBAAAA,mBAAAA,CAAAA,EAAAA;;;AC/BZ,IAAMG,oBAAoBC,OAAO,mBAA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KJ,OAAOK,UAAUR,oBAAAA,KAAyB,CAAA;AAC7D,UAAMS,OAAY,CAAC;AACnB,eAAWC,QAAQH,OAAO;AACxBE,WAAKC,IAAAA,IAAQ,KAAKJ,SAASI,IAAAA;IAC7B;AACA,WAAOD;EACT;EAEA,CAACE,0BAAQC,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", "import_lodash", "LogLevel", "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "levels", "trace", "debug", "info", "warn", "error", "shortLevelName", "LogProcessorType", "CONSOLE", "BROWSER", "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", "Error", "c", "error", "stack", "import_lodash", "loadOptions", "filepath", "text", "fs", "readFileSync", "yaml", "load", "err", "console", "warn", "LEVEL_COLORS", "LogLevel", "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "truncate", "text", "length", "right", "str", "slice", "substring", "padStart", "padEnd", "getRelativeFilename", "filename", "match", "filePath", "DEFAULT_FORMATTER", "config", "path", "line", "timestamp", "level", "message", "context", "error", "scope", "column", "options", "formatter", "filepath", "undefined", "chalk", "grey", "instance", "prototype", "Object", "getPrototypeOf", "id", "getPrototypeSpecificInstanceId", "magentaBright", "constructor", "name", "formattedTimestamp", "Date", "toISOString", "formattedLevel", "shortLevelName", "padding", "timestampFirst", "SHORT_FORMATTER", "CONSOLE_PROCESSOR", "entry", "meta", "shouldLog", "filters", "parts", "F", "L", "S", "getContextFromEntry", "inspect", "pickBy", "value", "depth", "colors", "maxArrayLength", "sorted", "filter", "Boolean", "join", "console", "log", "import_node_util", "DEBUG_PROCESSOR", "config", "entry", "console", "log", "inspect", "import_util", "getRelativeFilename", "filename", "match", "filePath", "CONFIG", "mochaExecutor", "useTestProcessor", "printFileLinks", "APP_BROWSER_PROCESSOR", "config", "entry", "shouldLog", "filters", "LOG_BROWSER_PREFIX", "prefix", "LOG_BROWSER_CSS", "link", "meta", "F", "filepath", "replace", "L", "args", "push", "message", "context", "getContextFromEntry", "levels", "LogLevel", "ERROR", "console", "error", "WARN", "warn", "DEBUG", "log", "safariCheck", "length", "join", "level", "C", "TEST_BROWSER_PROCESSOR", "path", "BROWSER_PROCESSOR", "import_node_fs", "import_util", "createFileProcessor", "path", "levels", "fd", "config", "entry", "includes", "level", "mkdirSync", "dirname", "openSync", "record", "timestamp", "Date", "now", "meta", "file", "F", "line", "L", "context", "jsonify", "getContextFromEntry", "appendFileSync", "JSON", "stringify", "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", "info", "INFO", "warn", "WARN", "error", "ERROR", "catch", "context", "meta", "stack", "break", "message", "getFormattedStackTrace", "level", "forEach", "globalThis", "dx_log", "Error", "split", "slice", "join", "import_node_util", "kOwnershipScope", "Symbol", "kCurrentOwnershipScope", "kDebugInfoProperties", "OwnershipScope", "constructor", "constr", "parent", "getInfo", "instance", "props", "prototype", "info", "prop", "inspect", "custom", "className", "name", "getCurrentOwnershipScope", "thisRef"]
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/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\n// Message helpers.\nimport omit from 'lodash.omit';\nimport pick from 'lodash.pick';\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 INFO = 11,\n WARN = 12,\n ERROR = 13,\n}\n\nexport const levels: { [index: string]: LogLevel } = {\n trace: LogLevel.TRACE,\n debug: LogLevel.DEBUG,\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.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 if (entry.context) {\n if (entry.context instanceof Error) {\n // Additional context from Error.\n const c = (entry.context as any).context;\n // If ERROR then show stacktrace.\n context = Object.assign(context ?? {}, { error: entry.context.stack, ...c });\n } else if (typeof entry.context === 'object') {\n context = Object.assign(context ?? {}, entry.context);\n }\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 type { LogMethods } from './log';\nimport { type CallMetadata } from './meta';\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 descriptor.value = function (this: any, ...args: any) {\n const combinedMeta = {\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 result = method.apply(this, args);\n log.info(`${propertyKey as string}(${formattedArgs}) => ${inspect(result, false, 1, true)}`, {}, combinedMeta);\n return result;\n } catch (err) {\n log.error(`${propertyKey as string}(${formattedArgs}) 🔥 ${err}`, {}, combinedMeta);\n throw err;\n }\n };\n Object.defineProperty(descriptor.value, 'name', { value: (propertyKey as string) + '$log' });\n };\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(\n {},\n options,\n nodeOptions && loadOptions(nodeOptions.file),\n nodeOptions,\n );\n\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 pickBy from 'lodash.pickby';\nimport { inspect } from 'node:util';\n\nimport { getPrototypeSpecificInstanceId } from '@dxos/util';\n\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.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\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\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, timestamp, level, message, context, error, scope },\n) => {\n const column = config.options?.formatter?.column;\n\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 chalk.grey(truncate(path, 16, true)), // NOTE: Breaks terminal linking.\n chalk[LEVEL_COLORS[level]](shortLevelName[level]),\n message,\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 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 { 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 typeof mochaExecutor !== 'undefined'\n ? {\n useTestProcessor: true,\n printFileLinks: true,\n }\n : {\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 args.push(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 // 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 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\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 args.push(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 { jsonify } from '@dxos/util';\n\nimport { LogLevel } from '../config';\nimport { type LogProcessor, getContextFromEntry } from '../context';\n\nexport const createFileProcessor = ({ path, levels }: { path: string; levels: LogLevel[] }): LogProcessor => {\n let fd: number | undefined;\n\n return (config, entry) => {\n if (!levels.includes(entry.level)) {\n return;\n }\n if (!fd) {\n try {\n mkdirSync(dirname(path));\n } catch {}\n fd = openSync(path, 'w');\n }\n\n const record = {\n ...entry,\n timestamp: Date.now(),\n meta: {\n file: entry.meta?.F,\n line: entry.meta?.L,\n },\n context: jsonify(getContextFromEntry(entry)),\n };\n appendFileSync(fd, JSON.stringify(record) + '\\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 path: 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 { 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 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}\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.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, error.stack, context, meta);\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\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\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(public constr: any, public parent?: OwnershipScope) {}\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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,oBAAiB;AACjB,IAAAA,iBAAiB;AIFjB,uBAAwB;ACAxB,IAAAA,iBAAyB;ACAzB,qBAAiB;AACjB,qBAAe;ACDf,mBAAkB;AAClB,IAAAA,iBAAmB;AACnB,IAAAC,oBAAwB;AAExB,kBAA+C;ACJ/C,IAAAA,oBAAwB;ACAxB,IAAAC,eAA4B;ACA5B,IAAAC,kBAAoD;AACpD,uBAAwB;AAExB,IAAAD,eAAwB;AEHxB,IAAAD,oBAAwB;IXOjB;UAAKG,WAAQ;AAARA,YAAAA,UACVC,OAAAA,IAAQ,CAAA,IAARA;AADUD,YAAAA,UAEVE,OAAAA,IAAQ,EAAA,IAARA;AAFUF,YAAAA,UAGVG,MAAAA,IAAO,EAAA,IAAPA;AAHUH,YAAAA,UAIVI,MAAAA,IAAO,EAAA,IAAPA;AAJUJ,YAAAA,UAKVK,OAAAA,IAAQ,EAAA,IAARA;GALUL,aAAAA,WAAAA,CAAAA,EAAAA;AAQL,IAAMM,SAAwC;EACnDC,OAAOP,SAASC;EAChBO,OAAOR,SAASE;EAChBO,MAAMT,SAASG;EACfO,MAAMV,SAASI;EACfO,OAAOX,SAASK;AAClB;AAEO,IAAMO,iBAAiB;EAC5B,CAACZ,SAASC,KAAK,GAAG;EAClB,CAACD,SAASE,KAAK,GAAG;EAClB,CAACF,SAASG,IAAI,GAAG;EACjB,CAACH,SAASI,IAAI,GAAG;EACjB,CAACJ,SAASK,KAAK,GAAG;AACpB;IAEO;UAAKQ,mBAAgB;AAAhBA,oBACVC,SAAAA,IAAU;AADAD,oBAEVE,SAAAA,IAAU;AAFAF,oBAGVX,OAAAA,IAAQ;GAHEW,qBAAAA,mBAAAA,CAAAA,E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BUG", "INFO", "WARN", "ERROR", "levels", "trace", "debug", "info", "warn", "error", "shortLevelName", "LogProcessorType", "CONSOLE", "BROWSER", "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", "S", "keys", "length", "assign", "Error", "c", "stack", "createMethodLogDecorator", "log", "arg0", "arg1", "method", "value", "args", "combinedMeta", "formattedArgs", "map", "arg", "inspect", "join", "result", "apply", "defineProperty", "loadOptions", "filepath", "text", "fs", "readFileSync", "yaml", "load", "console", "LEVEL_COLORS", "truncate", "right", "str", "slice", "substring", "padStart", "padEnd", "getRelativeFilename", "filename", "match", "filePath", "DEFAULT_FORMATTER", "config", "line", "timestamp", "column", "options", "formatter", "chalk", "grey", "instance", "id", "getPrototypeSpecificInstanceId", "magentaBright", "constructor", "name", "formattedTimestamp", "Date", "toISOString", "formattedLevel", "padding", "timestampFirst", "SHORT_FORMATTER", "CONSOLE_PROCESSOR", "parts", "L", "pickBy", "depth", "colors", "maxArrayLength", "sorted", "Boolean", "DEBUG_PROCESSOR", "CONFIG", "mochaExecutor", "useTestProcessor", "printFileLinks", "APP_BROWSER_PROCESSOR", "LOG_BROWSER_PREFIX", "prefix", "LOG_BROWSER_CSS", "link", "replace", "safariCheck", "C", "TEST_BROWSER_PROCESSOR", "BROWSER_PROCESSOR", "createFileProcessor", "fd", "mkdirSync", "dirname", "openSync", "record", "now", "file", "jsonify", "appendFileSync", "JSON", "stringify", "logFilePath", "getLogFilePath", "process", "env", "LOG_FILE", "HOME", "FILE_PROCESSOR", "processors", "IS_BROWSER", "window", "navigator", "DEFAULT_PROCESSORS", "parseFilter", "parseLogLevel", "defValue", "toLowerCase", "lines", "split", "getConfig", "nodeOptions", "globalThis", "LOG_CONFIG", "LOG_FILTER", "processor", "LOG_PROCESSOR", "mergedOptions", "defaultsDeep", "captureFilters", "captureFilter", "createLog", "params", "processLog", "_config", "get", "addProcessor", "p", "catch", "break", "getFormattedStackTrace", "forEach", "dx_log", "kOwnershipScope", "kCurrentOwnershipScope", "kDebugInfoProperties", "OwnershipScope", "constr", "parent", "getInfo", "props", "custom", "className", "getCurrentOwnershipScope", "thisRef"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"packages/common/log/src/config.ts":{"bytes":4200,"imports":[],"format":"esm"},"packages/common/log/src/scope.ts":{"bytes":3842,"imports":[],"format":"esm"},"packages/common/log/src/context.ts":{"bytes":5932,"imports":[{"path":"packages/common/log/src/scope.ts","kind":"import-statement","original":"./scope"}],"format":"esm"},"packages/common/log/src/platform/node/index.ts":{"bytes":2041,"imports":[{"path":"js-yaml","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true}],"format":"esm"},"packages/common/log/src/platform/index.ts":{"bytes":450,"imports":[{"path":"packages/common/log/src/platform/node/index.ts","kind":"import-statement","original":"./node"}],"format":"esm"},"packages/common/log/src/processors/console-processor.ts":{"bytes":14079,"imports":[{"path":"chalk","kind":"import-statement","external":true},{"path":"lodash.pickby","kind":"import-statement","external":true},{"path":"node:util","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/common/log/src/config.ts","kind":"import-statement","original":"../config"},{"path":"packages/common/log/src/context.ts","kind":"import-statement","original":"../context"}],"format":"esm"},"packages/common/log/src/processors/debug-processor.ts":{"bytes":1060,"imports":[{"path":"node:util","kind":"import-statement","external":true}],"format":"esm"},"packages/common/log/src/processors/browser-processor.ts":{"bytes":13071,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/common/log/src/config.ts","kind":"import-statement","original":"../config"},{"path":"packages/common/log/src/context.ts","kind":"import-statement","original":"../context"}],"format":"esm"},"packages/common/log/src/processors/file-processor.ts":{"bytes":5316,"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":"packages/common/log/src/config.ts","kind":"import-statement","original":"../config"},{"path":"packages/common/log/src/context.ts","kind":"import-statement","original":"../context"}],"format":"esm"},"packages/common/log/src/processors/index.ts":{"bytes":807,"imports":[{"path":"packages/common/log/src/processors/console-processor.ts","kind":"import-statement","original":"./console-processor"},{"path":"packages/common/log/src/processors/debug-processor.ts","kind":"import-statement","original":"./debug-processor"},{"path":"packages/common/log/src/processors/browser-processor.ts","kind":"import-statement","original":"./browser-processor"},{"path":"packages/common/log/src/processors/file-processor.ts","kind":"import-statement","original":"./file-processor"}],"format":"esm"},"packages/common/log/src/options.ts":{"bytes":7634,"imports":[{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"packages/common/log/src/config.ts","kind":"import-statement","original":"./config"},{"path":"packages/common/log/src/platform/index.ts","kind":"import-statement","original":"./platform"},{"path":"packages/common/log/src/processors/index.ts","kind":"import-statement","original":"./processors"}],"format":"esm"},"packages/common/log/src/log.ts":{"bytes":9777,"imports":[{"path":"packages/common/log/src/config.ts","kind":"import-statement","original":"./config"},{"path":"packages/common/log/src/options.ts","kind":"import-statement","original":"./options"}],"format":"esm"},"packages/common/log/src/meta.ts":{"bytes":1615,"imports":[],"format":"esm"},"packages/common/log/src/experimental/ownership.ts":{"bytes":9236,"imports":[{"path":"node:util","kind":"import-statement","external":true}],"format":"esm"},"packages/common/log/src/index.ts":{"bytes":1653,"imports":[{"path":"lodash.omit","kind":"import-statement","external":true},{"path":"lodash.pick","kind":"import-statement","external":true},{"path":"packages/common/log/src/config.ts","kind":"import-statement","original":"./config"},{"path":"packages/common/log/src/context.ts","kind":"import-statement","original":"./context"},{"path":"packages/common/log/src/log.ts","kind":"import-statement","original":"./log"},{"path":"packages/common/log/src/options.ts","kind":"import-statement","original":"./options"},{"path":"packages/common/log/src/processors/index.ts","kind":"import-statement","original":"./processors"},{"path":"packages/common/log/src/scope.ts","kind":"import-statement","original":"./scope"},{"path":"packages/common/log/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/common/log/src/experimental/ownership.ts","kind":"import-statement","original":"./experimental/ownership"}],"format":"esm"}},"outputs":{"packages/common/log/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":38624},"packages/common/log/dist/lib/node/index.cjs":{"imports":[{"path":"lodash.omit","kind":"require-call","external":true},{"path":"lodash.pick","kind":"require-call","external":true},{"path":"lodash.defaultsdeep","kind":"require-call","external":true},{"path":"js-yaml","kind":"require-call","external":true},{"path":"node:fs","kind":"require-call","external":true},{"path":"chalk","kind":"require-call","external":true},{"path":"lodash.pickby","kind":"require-call","external":true},{"path":"node:util","kind":"require-call","external":true},{"path":"@dxos/util","kind":"require-call","external":true},{"path":"node:util","kind":"require-call","external":true},{"path":"@dxos/util","kind":"require-call","external":true},{"path":"node:fs","kind":"require-call","external":true},{"path":"node:path","kind":"require-call","external":true},{"path":"@dxos/util","kind":"require-call","external":true},{"path":"node:util","kind":"require-call","external":true}],"exports":[],"entryPoint":"packages/common/log/src/index.ts","inputs":{"packages/common/log/src/index.ts":{"bytesInOutput":1027},"packages/common/log/src/config.ts":{"bytesInOutput":821},"packages/common/log/src/scope.ts":{"bytesInOutput":571},"packages/common/log/src/context.ts":{"bytesInOutput":981},"packages/common/log/src/options.ts":{"bytesInOutput":1585},"packages/common/log/src/platform/node/index.ts":{"bytesInOutput":399},"packages/common/log/src/platform/index.ts":{"bytesInOutput":0},"packages/common/log/src/processors/console-processor.ts":{"bytesInOutput":3052},"packages/common/log/src/processors/index.ts":{"bytesInOutput":0},"packages/common/log/src/processors/debug-processor.ts":{"bytesInOutput":165},"packages/common/log/src/processors/browser-processor.ts":{"bytesInOutput":2398},"packages/common/log/src/processors/file-processor.ts":{"bytesInOutput":1172},"packages/common/log/src/log.ts":{"bytesInOutput":1873},"packages/common/log/src/experimental/ownership.ts":{"bytesInOutput":796}},"bytes":17318}}}
1
+ {"inputs":{"packages/common/log/src/config.ts":{"bytes":4210,"imports":[],"format":"esm"},"packages/common/log/src/scope.ts":{"bytes":3852,"imports":[],"format":"esm"},"packages/common/log/src/context.ts":{"bytes":5942,"imports":[{"path":"packages/common/log/src/scope.ts","kind":"import-statement","original":"./scope"}],"format":"esm"},"packages/common/log/src/decorators.ts":{"bytes":4216,"imports":[{"path":"node:util","kind":"import-statement","external":true}],"format":"esm"},"packages/common/log/src/platform/node/index.ts":{"bytes":2051,"imports":[{"path":"js-yaml","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true}],"format":"esm"},"packages/common/log/src/platform/index.ts":{"bytes":460,"imports":[{"path":"packages/common/log/src/platform/node/index.ts","kind":"import-statement","original":"./node"}],"format":"esm"},"packages/common/log/src/processors/console-processor.ts":{"bytes":14089,"imports":[{"path":"chalk","kind":"import-statement","external":true},{"path":"lodash.pickby","kind":"import-statement","external":true},{"path":"node:util","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/common/log/src/config.ts","kind":"import-statement","original":"../config"},{"path":"packages/common/log/src/context.ts","kind":"import-statement","original":"../context"}],"format":"esm"},"packages/common/log/src/processors/debug-processor.ts":{"bytes":1070,"imports":[{"path":"node:util","kind":"import-statement","external":true}],"format":"esm"},"packages/common/log/src/processors/browser-processor.ts":{"bytes":13081,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/common/log/src/config.ts","kind":"import-statement","original":"../config"},{"path":"packages/common/log/src/context.ts","kind":"import-statement","original":"../context"}],"format":"esm"},"packages/common/log/src/processors/file-processor.ts":{"bytes":5326,"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":"packages/common/log/src/config.ts","kind":"import-statement","original":"../config"},{"path":"packages/common/log/src/context.ts","kind":"import-statement","original":"../context"}],"format":"esm"},"packages/common/log/src/processors/index.ts":{"bytes":817,"imports":[{"path":"packages/common/log/src/processors/console-processor.ts","kind":"import-statement","original":"./console-processor"},{"path":"packages/common/log/src/processors/debug-processor.ts","kind":"import-statement","original":"./debug-processor"},{"path":"packages/common/log/src/processors/browser-processor.ts","kind":"import-statement","original":"./browser-processor"},{"path":"packages/common/log/src/processors/file-processor.ts","kind":"import-statement","original":"./file-processor"}],"format":"esm"},"packages/common/log/src/options.ts":{"bytes":7644,"imports":[{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"packages/common/log/src/config.ts","kind":"import-statement","original":"./config"},{"path":"packages/common/log/src/platform/index.ts","kind":"import-statement","original":"./platform"},{"path":"packages/common/log/src/processors/index.ts","kind":"import-statement","original":"./processors"}],"format":"esm"},"packages/common/log/src/log.ts":{"bytes":10284,"imports":[{"path":"packages/common/log/src/config.ts","kind":"import-statement","original":"./config"},{"path":"packages/common/log/src/decorators.ts","kind":"import-statement","original":"./decorators"},{"path":"packages/common/log/src/options.ts","kind":"import-statement","original":"./options"}],"format":"esm"},"packages/common/log/src/meta.ts":{"bytes":1625,"imports":[],"format":"esm"},"packages/common/log/src/experimental/ownership.ts":{"bytes":9246,"imports":[{"path":"node:util","kind":"import-statement","external":true}],"format":"esm"},"packages/common/log/src/index.ts":{"bytes":1663,"imports":[{"path":"lodash.omit","kind":"import-statement","external":true},{"path":"lodash.pick","kind":"import-statement","external":true},{"path":"packages/common/log/src/config.ts","kind":"import-statement","original":"./config"},{"path":"packages/common/log/src/context.ts","kind":"import-statement","original":"./context"},{"path":"packages/common/log/src/log.ts","kind":"import-statement","original":"./log"},{"path":"packages/common/log/src/options.ts","kind":"import-statement","original":"./options"},{"path":"packages/common/log/src/processors/index.ts","kind":"import-statement","original":"./processors"},{"path":"packages/common/log/src/scope.ts","kind":"import-statement","original":"./scope"},{"path":"packages/common/log/src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/common/log/src/experimental/ownership.ts","kind":"import-statement","original":"./experimental/ownership"}],"format":"esm"}},"outputs":{"packages/common/log/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":41028},"packages/common/log/dist/lib/node/index.cjs":{"imports":[{"path":"lodash.omit","kind":"import-statement","external":true},{"path":"lodash.pick","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":"lodash.pickby","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","gatherLogInfoFromScope","getContextFromEntry","getCurrentOwnershipScope","levels","log","logInfo","omit","parseFilter","pick","shortLevelName","shouldLog","truncate"],"entryPoint":"packages/common/log/src/index.ts","inputs":{"packages/common/log/src/index.ts":{"bytesInOutput":64},"packages/common/log/src/config.ts":{"bytesInOutput":821},"packages/common/log/src/scope.ts":{"bytesInOutput":571},"packages/common/log/src/context.ts":{"bytesInOutput":981},"packages/common/log/src/decorators.ts":{"bytesInOutput":787},"packages/common/log/src/options.ts":{"bytesInOutput":1556},"packages/common/log/src/platform/node/index.ts":{"bytesInOutput":315},"packages/common/log/src/platform/index.ts":{"bytesInOutput":0},"packages/common/log/src/processors/console-processor.ts":{"bytesInOutput":2905},"packages/common/log/src/processors/index.ts":{"bytesInOutput":0},"packages/common/log/src/processors/debug-processor.ts":{"bytesInOutput":146},"packages/common/log/src/processors/browser-processor.ts":{"bytesInOutput":2380},"packages/common/log/src/processors/file-processor.ts":{"bytesInOutput":1078},"packages/common/log/src/log.ts":{"bytesInOutput":1921},"packages/common/log/src/experimental/ownership.ts":{"bytesInOutput":782}},"bytes":15351}}}
@@ -0,0 +1,4 @@
1
+ import type { LogMethods } from './log';
2
+ import { type CallMetadata } from './meta';
3
+ export declare const createMethodLogDecorator: (log: LogMethods) => (arg0?: never, arg1?: never, meta?: CallMetadata) => MethodDecorator;
4
+ //# sourceMappingURL=decorators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../../src/decorators.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,QAAQ,CAAC;AAE3C,eAAO,MAAM,wBAAwB,QAC7B,UAAU,aACR,KAAK,SAAS,KAAK,SAAS,YAAY,KAAG,eAqBlD,CAAC"}
@@ -8,7 +8,7 @@ type LogFunction = (message: string, context?: LogContext, meta?: CallMetadata)
8
8
  /**
9
9
  * Logging methods.
10
10
  */
11
- interface LogMethods {
11
+ export interface LogMethods {
12
12
  trace: LogFunction;
13
13
  debug: LogFunction;
14
14
  info: LogFunction;
@@ -17,6 +17,7 @@ interface LogMethods {
17
17
  catch: (error: Error | any, context?: LogContext, meta?: CallMetadata) => void;
18
18
  break: () => void;
19
19
  stack: (message?: string, context?: never, meta?: CallMetadata) => void;
20
+ method: (arg0?: never, arg1?: never, meta?: CallMetadata) => MethodDecorator;
20
21
  }
21
22
  /**
22
23
  * Properties accessible on the logging function.
@@ -1 +1 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/log.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAY,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AACrE,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAC/D,O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log",
3
- "version": "0.3.7",
3
+ "version": "0.3.8-main.0ab6c73",
4
4
  "description": "Logger",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -24,8 +24,8 @@
24
24
  "lodash.omit": "^4.5.0",
25
25
  "lodash.pick": "^4.4.0",
26
26
  "lodash.pickby": "^4.6.0",
27
- "@dxos/node-std": "0.3.7",
28
- "@dxos/util": "0.3.7"
27
+ "@dxos/util": "0.3.8-main.0ab6c73",
28
+ "@dxos/node-std": "0.3.8-main.0ab6c73"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@swc-node/sourcemap-support": "^0.2.0",
@@ -0,0 +1,33 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { inspect } from 'node:util';
6
+
7
+ import type { LogMethods } from './log';
8
+ import { type CallMetadata } from './meta';
9
+
10
+ export const createMethodLogDecorator =
11
+ (log: LogMethods) =>
12
+ (arg0?: never, arg1?: never, meta?: CallMetadata): MethodDecorator =>
13
+ (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {
14
+ const method = descriptor.value!;
15
+ descriptor.value = function (this: any, ...args: any) {
16
+ const combinedMeta = {
17
+ ...(meta ?? {}),
18
+ S: this as any,
19
+ } as CallMetadata;
20
+
21
+ const formattedArgs = args.map((arg: any) => inspect(arg, false, 1, true)).join(', ');
22
+
23
+ try {
24
+ const result = method.apply(this, args);
25
+ log.info(`${propertyKey as string}(${formattedArgs}) => ${inspect(result, false, 1, true)}`, {}, combinedMeta);
26
+ return result;
27
+ } catch (err) {
28
+ log.error(`${propertyKey as string}(${formattedArgs}) 🔥 ${err}`, {}, combinedMeta);
29
+ throw err;
30
+ }
31
+ };
32
+ Object.defineProperty(descriptor.value, 'name', { value: (propertyKey as string) + '$log' });
33
+ };
package/src/log.ts CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  import { type LogConfig, LogLevel, type LogOptions } from './config';
6
6
  import { type LogContext, type LogProcessor } from './context';
7
+ import { createMethodLogDecorator } from './decorators';
7
8
  import { type CallMetadata } from './meta';
8
9
  import { getConfig, DEFAULT_PROCESSORS } from './options';
9
10
 
@@ -15,7 +16,7 @@ type LogFunction = (message: string, context?: LogContext, meta?: CallMetadata)
15
16
  /**
16
17
  * Logging methods.
17
18
  */
18
- interface LogMethods {
19
+ export interface LogMethods {
19
20
  trace: LogFunction;
20
21
  debug: LogFunction;
21
22
  info: LogFunction;
@@ -24,6 +25,7 @@ interface LogMethods {
24
25
  catch: (error: Error | any, context?: LogContext, meta?: CallMetadata) => void;
25
26
  break: () => void;
26
27
  stack: (message?: string, context?: never, meta?: CallMetadata) => void;
28
+ method: (arg0?: never, arg1?: never, meta?: CallMetadata) => MethodDecorator;
27
29
  }
28
30
 
29
31
  /**
@@ -77,6 +79,8 @@ const createLog = (): LogImp => {
77
79
  log.stack = (message, context, meta) =>
78
80
  processLog(LogLevel.INFO, `${message ?? 'Stack Dump'}\n${getFormattedStackTrace()}`, context, meta);
79
81
 
82
+ log.method = createMethodLogDecorator(log);
83
+
80
84
  /**
81
85
  * Process the current log call.
82
86
  */