@dxos/log 0.8.4-main.fbb7a13 → 0.8.4-main.fcc0d83b33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/chunk-V7FYKT4H.mjs +311 -0
- package/dist/lib/browser/chunk-V7FYKT4H.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +236 -43
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/platform/node/index.mjs +1 -1
- package/dist/lib/browser/platform/node/index.mjs.map +3 -3
- package/dist/lib/browser/processors/console-processor.mjs +6 -11
- package/dist/lib/browser/processors/console-processor.mjs.map +3 -3
- package/dist/lib/node-esm/chunk-5TBDXMQF.mjs +313 -0
- package/dist/lib/node-esm/chunk-5TBDXMQF.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +236 -43
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/platform/node/index.mjs +1 -1
- package/dist/lib/node-esm/platform/node/index.mjs.map +3 -3
- package/dist/lib/node-esm/processors/console-processor.mjs +6 -11
- package/dist/lib/node-esm/processors/console-processor.mjs.map +3 -3
- package/dist/types/src/context.d.ts +78 -2
- package/dist/types/src/context.d.ts.map +1 -1
- package/dist/types/src/dbg.d.ts +23 -0
- package/dist/types/src/dbg.d.ts.map +1 -0
- package/dist/types/src/decorators.d.ts.map +1 -1
- package/dist/types/src/environment.d.ts +24 -0
- package/dist/types/src/environment.d.ts.map +1 -0
- package/dist/types/src/environment.test.d.ts +2 -0
- package/dist/types/src/environment.test.d.ts.map +1 -0
- package/dist/types/src/experimental/ownership.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +7 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/jsonl.d.ts +53 -0
- package/dist/types/src/jsonl.d.ts.map +1 -0
- package/dist/types/src/jsonl.test.d.ts +2 -0
- package/dist/types/src/jsonl.test.d.ts.map +1 -0
- package/dist/types/src/log-buffer.d.ts +20 -0
- package/dist/types/src/log-buffer.d.ts.map +1 -0
- package/dist/types/src/log-buffer.test.d.ts +2 -0
- package/dist/types/src/log-buffer.test.d.ts.map +1 -0
- package/dist/types/src/log.d.ts +44 -1
- package/dist/types/src/log.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +20 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/platform/browser/index.d.ts.map +1 -1
- package/dist/types/src/platform/node/index.d.ts.map +1 -1
- package/dist/types/src/processors/browser-processor.d.ts.map +1 -1
- package/dist/types/src/processors/common.d.ts.map +1 -1
- package/dist/types/src/processors/console-processor.d.ts.map +1 -1
- package/dist/types/src/processors/file-processor.d.ts.map +1 -1
- package/dist/types/src/scope.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -9
- package/src/context.ts +242 -2
- package/src/dbg.ts +34 -0
- package/src/decorators.ts +1 -2
- package/src/environment.test.ts +222 -0
- package/src/environment.ts +129 -0
- package/src/experimental/classes.test.ts +0 -1
- package/src/index.ts +7 -4
- package/src/jsonl.test.ts +121 -0
- package/src/jsonl.ts +104 -0
- package/src/log-buffer.test.ts +158 -0
- package/src/log-buffer.ts +89 -0
- package/src/log.test.ts +0 -1
- package/src/log.ts +56 -12
- package/src/meta.ts +29 -1
- package/src/platform/node/index.ts +1 -2
- package/src/processors/browser-processor.ts +27 -28
- package/src/processors/console-processor.ts +5 -13
- package/src/processors/file-processor.ts +7 -9
- package/dist/lib/browser/chunk-GPOFUMLO.mjs +0 -133
- package/dist/lib/browser/chunk-GPOFUMLO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QPYJZ4SO.mjs +0 -135
- package/dist/lib/node-esm/chunk-QPYJZ4SO.mjs.map +0 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/index.ts", "../../../src/decorators.ts", "../../../src/options.ts", "../../../src/platform/index.ts", "../../../src/processors/index.ts", "../../../src/processors/browser-processor.ts", "../../../src/processors/debug-processor.ts", "../../../src/processors/file-processor.ts", "../../../src/log.ts", "../../../src/experimental/ownership.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nimport omit from 'lodash.omit';\n\nimport { pick } from '@dxos/util';\n\nexport { omit, pick };\n\nexport * from './config';\nexport * from './context';\nexport * from './log';\nexport { parseFilter } from './options';\nexport * from './processors';\nexport * from './scope';\nexport type * from './meta';\n\nexport { getCurrentOwnershipScope } from './experimental/ownership';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { inspect } from 'node:util';\n\nimport chalk from 'chalk';\n\nimport { type LogMethods } from './log';\nimport { type CallMetadata } from './meta';\n\nlet nextPromiseId = 0;\n\nexport const createMethodLogDecorator =\n (log: LogMethods) =>\n (arg0?: never, arg1?: never, meta?: CallMetadata): MethodDecorator =>\n (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n const method = descriptor.value!;\n const methodName = propertyKey as string;\n descriptor.value = function (this: any, ...args: any) {\n const combinedMeta = {\n F: '',\n L: 0,\n ...(meta ?? {}),\n S: this as any,\n } as CallMetadata;\n\n const formattedArgs = args.map((arg: any) => inspect(arg, false, 1, true)).join(', ');\n\n try {\n const startTime = performance.now();\n const result = method.apply(this, args);\n\n if (isThenable(result)) {\n const id = nextPromiseId++;\n logAsyncBegin(log, methodName, formattedArgs, id, combinedMeta);\n result.then(\n (resolvedValue) => {\n logAsyncResolved(log, methodName, resolvedValue, id, startTime, combinedMeta);\n },\n (err) => {\n logAsyncRejected(log, methodName, err, id, startTime, combinedMeta);\n },\n );\n } else {\n logSyncCall(log, methodName, formattedArgs, result, combinedMeta);\n }\n\n return result;\n } catch (err: any) {\n logSyncError(log, methodName, formattedArgs, err, combinedMeta);\n throw err;\n }\n };\n Object.defineProperty(descriptor.value, 'name', { value: methodName + '$log' });\n };\n\nexport const createFunctionLogDecorator =\n (log: LogMethods) =>\n <F extends (...args: any[]) => any>(\n name: string,\n fn: F,\n opts: { transformOutput?: (result: ReturnType<F>) => Promise<any> | any } = {},\n ): F => {\n const decoratedFn = function (this: any, ...args: any) {\n const combinedMeta = {\n F: '',\n L: 0,\n } as CallMetadata;\n\n const formattedArgs = args.map((arg: any) => inspect(arg, false, 1, true)).join(', ');\n\n try {\n const startTime = performance.now();\n const result = fn.apply(this, args);\n\n let transformedResult = result;\n if (opts.transformOutput) {\n if (isThenable(result)) {\n transformedResult = result.then(opts.transformOutput as any);\n } else {\n transformedResult = opts.transformOutput(result);\n }\n }\n\n if (isThenable(transformedResult)) {\n const id = nextPromiseId++;\n logAsyncBegin(log, name, formattedArgs, id, combinedMeta);\n transformedResult.then(\n (resolvedValue) => {\n logAsyncResolved(log, name, resolvedValue, id, startTime, combinedMeta);\n },\n (err) => {\n logAsyncRejected(log, name, err, id, startTime, combinedMeta);\n },\n );\n } else {\n logSyncCall(log, name, formattedArgs, transformedResult, combinedMeta);\n }\n\n return result;\n } catch (err: any) {\n logSyncError(log, name, formattedArgs, err, combinedMeta);\n throw err;\n }\n };\n Object.defineProperty(decoratedFn, 'name', { value: name + '$log' });\n return decoratedFn as F;\n };\n\nconst isThenable = (obj: any): obj is Promise<unknown> => obj && typeof obj.then === 'function';\n\nconst logSyncCall = (\n log: LogMethods,\n methodName: string,\n formattedArgs: string,\n result: unknown,\n combinedMeta: CallMetadata,\n) => {\n log.info(\n `.${formatFunction(methodName)} (${formattedArgs}) ${chalk.gray('=>')} ${inspect(result, false, 1, true)}`,\n {},\n combinedMeta,\n );\n};\n\nconst logSyncError = (\n log: LogMethods,\n methodName: string,\n formattedArgs: string,\n err: Error,\n combinedMeta: CallMetadata,\n) => {\n log.error(`.${formatFunction(methodName)} (${formattedArgs}) 🔥 ${err}`, {}, combinedMeta);\n};\n\nconst logAsyncBegin = (\n log: LogMethods,\n methodName: string,\n formattedArgs: string,\n promiseId: number,\n combinedMeta: CallMetadata,\n) => {\n log.info(\n `.${formatFunction(methodName)} ↴ (${formattedArgs}) ${chalk.gray('=>')} ${formatPromise(promiseId)}`,\n {},\n combinedMeta,\n );\n};\n\nconst logAsyncResolved = (\n log: LogMethods,\n methodName: string,\n resolvedValue: unknown | undefined,\n promiseId: number,\n startTime: number,\n combinedMeta: CallMetadata,\n) => {\n if (resolvedValue !== undefined) {\n log.info(\n `.${formatFunction(methodName)} ↲ ${greenCheck} ${chalk.gray('resolve')} ${formatPromise(promiseId)} ${formatTimeElapsed(startTime)} ${chalk.gray('=>')} ${inspect(\n resolvedValue,\n false,\n 1,\n true,\n )}`,\n {},\n combinedMeta,\n );\n } else {\n log.info(\n `.${formatFunction(methodName)} ↲ ${greenCheck} ${chalk.gray('resolve')} ${formatPromise(promiseId)} ${formatTimeElapsed(startTime)}`,\n {},\n combinedMeta,\n );\n }\n};\n\nconst logAsyncRejected = (\n log: LogMethods,\n methodName: string,\n err: Error,\n promiseId: number,\n startTime: number,\n combinedMeta: CallMetadata,\n) => {\n log.info(\n `.${formatFunction(methodName)} ↲ 🔥 ${chalk.gray('reject')} ${formatPromise(promiseId)} ${formatTimeElapsed(startTime)} ${chalk.gray('=>')} ${err}`,\n {},\n combinedMeta,\n );\n};\n\nconst COLOR_FUNCTION = [220, 220, 170] as const;\n\n// https://github.com/dxos/dxos/issues/7286\nconst greenCheck = typeof chalk.green === 'function' ? chalk.green('✔') : '✔';\n\nconst formatTimeElapsed = (startTime: number) => chalk.gray(`${(performance.now() - startTime).toFixed(0)}ms`);\n\nconst formatFunction = (name: string) => chalk.bold(chalk.rgb(...COLOR_FUNCTION)(name));\n\nconst formatPromise = (id: number) => chalk.blue(`Promise#${id}`);\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport defaultsDeep from 'lodash.defaultsdeep';\n\nimport { type LogConfig, type LogFilter, LogLevel, type LogOptions, LogProcessorType, levels } from './config';\nimport { type LogProcessor } from './context';\nimport { loadOptions } from './platform';\nimport { BROWSER_PROCESSOR, CONSOLE_PROCESSOR, DEBUG_PROCESSOR } from './processors';\n\n/**\n * Processor variants.\n */\nexport const processors: Record<string, LogProcessor> = {\n [LogProcessorType.CONSOLE]: CONSOLE_PROCESSOR,\n [LogProcessorType.BROWSER]: BROWSER_PROCESSOR,\n [LogProcessorType.DEBUG]: DEBUG_PROCESSOR,\n};\n\nconst browser =\n (typeof window !== 'undefined' || typeof navigator !== 'undefined') &&\n !(typeof process !== 'undefined' && process?.env?.VITEST);\n\nexport const DEFAULT_PROCESSORS = [browser ? BROWSER_PROCESSOR : CONSOLE_PROCESSOR];\n\nconst parseLogLevel = (level: string, defValue = LogLevel.WARN) => levels[level.toLowerCase()] ?? defValue;\n\n/**\n * @internal\n */\nexport const parseFilter = (filter: string | string[] | LogLevel): LogFilter[] => {\n if (typeof filter === 'number') {\n return [{ level: filter }];\n }\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\n ? {\n level: parseLogLevel(level),\n pattern,\n }\n : {\n level: parseLogLevel(pattern),\n };\n });\n};\n\n/**\n * @internal\n */\nexport const createConfig = (options?: LogOptions): LogConfig => {\n // Node only.\n const envOptions: LogOptions | undefined =\n 'process' in globalThis\n ? {\n file: process!.env.LOG_CONFIG,\n filter: process!.env.LOG_FILTER,\n processor: process!.env.LOG_PROCESSOR,\n }\n : undefined;\n\n const mergedOptions: LogOptions = defaultsDeep({}, loadOptions(envOptions?.file), envOptions, options);\n return {\n options: mergedOptions,\n filters: parseFilter(mergedOptions.filter ?? LogLevel.INFO),\n captureFilters: parseFilter(mergedOptions.captureFilter ?? LogLevel.WARN),\n processors: mergedOptions.processor ? [processors[mergedOptions.processor]] : [...DEFAULT_PROCESSORS],\n prefix: mergedOptions.prefix,\n };\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nexport * from '#platform';\n", "//\n// Copyright 2022 DXOS.org\n//\n\nexport * from './browser-processor';\nexport * from './common';\nexport * from '#console-processor';\nexport * from './debug-processor';\nexport * from './file-processor';\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { getDebugName, safariCheck } from '@dxos/util';\n\nimport { LogLevel } from '../config';\nimport { type LogProcessor, getContextFromEntry, shouldLog } from '../context';\n\nconst getRelativeFilename = (filename: string) => {\n // TODO(burdon): Hack uses \"packages\" as an anchor (pre-parse NX?)\n // Including `packages/` part of the path so that excluded paths (e.g. from dist) are clickable in vscode.\n const match = filename.match(/.+\\/(packages\\/.+\\/.+)/);\n if (match) {\n const [, filePath] = match;\n return filePath;\n }\n\n return filename;\n};\n\ntype Config = {\n useTestProcessor: boolean;\n printFileLinks: boolean;\n};\n\nconst CONFIG: Config = {\n useTestProcessor: false,\n printFileLinks: false,\n};\n\n/**\n * For running apps in the browser normally.\n */\nconst APP_BROWSER_PROCESSOR: LogProcessor = (config, entry) => {\n if (!shouldLog(entry, config.filters)) {\n return;\n }\n\n // Example local editor prefix: 'vscode://file/Users/burdon/Code/dxos/dxos/'.\n const LOG_BROWSER_PREFIX = config.prefix ?? 'https://vscode.dev/github.com/dxos/dxos/blob/main/';\n\n // TODO(burdon): CSS breaks formatting (e.g., [Object] rather than expandable property).\n // TODO(burdon): Consider custom formatters.\n // https://www.mattzeunert.com/2016/02/19/custom-chrome-devtools-object-formatters.html\n // NOTE: Cannot change color of link (from bright white).\n // const LOG_BROWSER_CSS = ['color:gray; font-size:10px; padding-bottom: 4px', 'color:#B97852; font-size:14px;'];\n const LOG_BROWSER_CSS: string[] = [];\n\n let link = '';\n if (entry.meta) {\n const filename = getRelativeFilename(entry.meta.F);\n const filepath = `${LOG_BROWSER_PREFIX.replace(/\\/$/, '')}/${filename}`;\n // TODO(burdon): Line numbers not working for app link, even with colons.\n // https://stackoverflow.com/a/54459820/2804332\n link = `${filepath}#L${entry.meta.L}`;\n }\n\n let args = [];\n\n if (entry.meta?.S) {\n const scope = entry.meta?.S;\n const scopeName = scope.name || getDebugName(scope);\n const processPrefix = entry.meta.S?.hostSessionId ? '[worker] ' : '';\n // TODO(dmaretskyi): Those can be made clickable with a custom formatter.\n args.push(`%c${processPrefix}${scopeName}`, 'color:#C026D3;font-weight:bold');\n }\n\n if (entry.message) {\n args.push(entry.message);\n }\n\n const context = getContextFromEntry(entry);\n if (context) {\n if (Object.keys(context).length === 1 && 'error' in context) {\n args.push(context.error);\n } else if (Object.keys(context).length === 1 && 'err' in context) {\n args.push(context.err);\n } else {\n args.push(context);\n }\n }\n\n // https://github.com/cloudflare/workers-sdk/issues/5591\n const levels: any = {\n [LogLevel.ERROR]: console.error.bind(console),\n [LogLevel.WARN]: console.warn.bind(console),\n [LogLevel.DEBUG]: console.log.bind(console),\n };\n\n // Safari prints source code location as this file, not the caller.\n if (CONFIG.printFileLinks || safariCheck()) {\n if (LOG_BROWSER_CSS?.length) {\n args = [`%c${link}\\n%c${args.join(' ')}`, ...LOG_BROWSER_CSS];\n } else {\n args = [link + '\\n', ...args];\n }\n }\n\n // https://github.com/cloudflare/workers-sdk/issues/5591\n const level = levels[entry.level] ?? console.log.bind(console);\n if (typeof entry.meta?.C === 'function') {\n entry.meta.C(level, args);\n } else {\n level(...args);\n }\n};\n\n/**\n * For running unit tests in the headless browser.\n */\nconst TEST_BROWSER_PROCESSOR: LogProcessor = (config, entry) => {\n if (!shouldLog(entry, config.filters)) {\n return;\n }\n\n let path = '';\n if (entry.meta) {\n path = `${getRelativeFilename(entry.meta.F)}:${entry.meta.L}`;\n }\n\n let args = [];\n\n const processPrefix = entry.meta?.S?.hostSessionId ? '[worker] ' : '';\n args.push(`${processPrefix}${entry.message}`);\n\n const context = getContextFromEntry(entry);\n if (context) {\n args.push(context);\n }\n\n const levels: any = {\n [LogLevel.ERROR]: console.error,\n [LogLevel.WARN]: console.warn,\n [LogLevel.DEBUG]: console.log,\n };\n\n if (CONFIG.printFileLinks) {\n args = [path, ...args];\n }\n\n const level = levels[entry.level] ?? console.log;\n if (typeof entry.meta?.C === 'function') {\n entry.meta.C(level, args);\n } else {\n level(...args);\n }\n};\n\nexport const BROWSER_PROCESSOR: LogProcessor = CONFIG.useTestProcessor ? TEST_BROWSER_PROCESSOR : APP_BROWSER_PROCESSOR;\n", "//\n// Copyright 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 2023 DXOS.org\n//\n\nimport { appendFileSync, mkdirSync, openSync } from 'node:fs';\nimport { dirname } from 'node:path';\n\nimport { jsonlogify } from '@dxos/util';\n\nimport { type LogFilter, LogLevel } from '../config';\nimport { type LogProcessor, getContextFromEntry, shouldLog } from '../context';\n\nimport { getRelativeFilename } from './common';\n\n// Amount of time to retry writing after encountering EAGAIN before giving up.\nconst EAGAIN_MAX_DURATION = 1000;\n\n/**\n * Create a file processor.\n * @param path - Path to log file to create or append to, or existing open file descriptor e.g. stdout.\n * @param levels - Log levels to process. Takes preference over Filters.\n * @param filters - Filters to apply.\n */\nexport const createFileProcessor = ({\n pathOrFd,\n levels,\n filters,\n}: {\n pathOrFd: string | number;\n levels: LogLevel[];\n filters?: LogFilter[];\n}): LogProcessor => {\n let fd: number | undefined;\n\n return (config, entry) => {\n if (levels.length > 0 && !levels.includes(entry.level)) {\n return;\n }\n if (!shouldLog(entry, filters)) {\n return;\n }\n\n if (typeof pathOrFd === 'number') {\n fd = pathOrFd;\n } else {\n try {\n mkdirSync(dirname(pathOrFd));\n } catch {}\n fd = openSync(pathOrFd, 'a');\n }\n\n const record = {\n ...entry,\n timestamp: Date.now(),\n ...(entry.meta ? { meta: { file: getRelativeFilename(entry.meta.F), line: entry.meta.L } } : {}),\n context: jsonlogify(getContextFromEntry(entry)),\n };\n let retryTS: number = 0;\n\n // Retry writing if EAGAIN is encountered.\n //\n // Node may set stdout and stderr to non-blocking. https://github.com/nodejs/node/issues/42826\n // This can cause EAGAIN errors when writing to them.\n // In order to not drop logs, make log methods asynchronous, or deal with buffering/delayed writes, spin until write succeeds.\n\n while (true) {\n try {\n return appendFileSync(fd, JSON.stringify(record) + '\\n');\n } catch (err: any) {\n if (err.code !== 'EAGAIN') {\n throw err;\n }\n if (retryTS === 0) {\n retryTS = performance.now();\n } else {\n if (performance.now() - retryTS > EAGAIN_MAX_DURATION) {\n console.log(`could not write after ${EAGAIN_MAX_DURATION}ms of EAGAIN failures, giving up`);\n throw err;\n }\n }\n }\n }\n };\n};\n\nlet logFilePath: string | undefined;\nconst getLogFilePath = () => {\n logFilePath ??=\n process.env.LOG_FILE ??\n (process.env.HOME ? `${process.env.HOME}/.dxlog/${new Date().toISOString()}.log` : undefined);\n\n return logFilePath!;\n};\n\nexport const FILE_PROCESSOR: LogProcessor = createFileProcessor({\n pathOrFd: getLogFilePath(),\n levels: [LogLevel.ERROR, LogLevel.WARN, LogLevel.INFO, LogLevel.TRACE],\n});\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { type LogConfig, LogLevel, type LogOptions } from './config';\nimport { type LogContext, type LogProcessor } from './context';\nimport { createFunctionLogDecorator, createMethodLogDecorator } from './decorators';\nimport { type CallMetadata } from './meta';\nimport { createConfig } from './options';\n\n/**\n * Accessible from browser console.\n */\ndeclare global {\n const DX_LOG: Log;\n}\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 config: (options: LogOptions) => Log;\n addProcessor: (processor: LogProcessor, addDefault?: boolean) => () => void;\n\n trace: LogFunction;\n debug: LogFunction;\n verbose: LogFunction;\n info: LogFunction;\n warn: LogFunction;\n error: LogFunction;\n catch: (error: Error | any, context?: LogContext, meta?: CallMetadata) => void;\n\n method: (arg0?: never, arg1?: never, meta?: CallMetadata) => MethodDecorator;\n function: <F extends (...args: any[]) => any>(\n name: string,\n fn: F,\n opts?: {\n transformOutput?: (result: ReturnType<F>) => Promise<any> | any;\n },\n ) => F;\n\n break: () => void;\n stack: (message?: string, context?: never, meta?: CallMetadata) => void;\n}\n\n/**\n * Properties accessible on the logging function.\n * @internal\n */\nexport interface Log extends LogFunction, LogMethods {\n readonly runtimeConfig: LogConfig;\n}\n\n/**\n * @internal\n */\ninterface LogImp extends Log {\n _id: string;\n _config: LogConfig;\n}\n\nlet logCount = 0;\n\n/**\n * Create a logging function with properties.\n * @internal\n */\nexport const createLog = (): LogImp => {\n // Default function.\n const log: LogImp = ((...params) => processLog(LogLevel.DEBUG, ...params)) as LogImp;\n\n // Add private properties.\n Object.assign<LogImp, Partial<LogImp>>(log, {\n _id: `log-${++logCount}`,\n _config: createConfig(),\n });\n\n // TODO(burdon): Document.\n Object.defineProperty(log, 'runtimeConfig', {\n get: () => log._config,\n });\n\n /**\n * Process the current log call.\n */\n const processLog = (\n level: LogLevel,\n message: string | undefined,\n context: LogContext = {},\n meta?: CallMetadata,\n error?: Error,\n ) => {\n // TODO(burdon): Do the filter matching upstream (here) rather than in each processor?\n log._config.processors.forEach((processor) =>\n processor(log._config, {\n level,\n message,\n context,\n meta,\n error,\n }),\n );\n };\n\n /**\n * API.\n */\n Object.assign<Log, LogMethods>(log, {\n /**\n * Update config.\n * NOTE: Preserves any processors that were already added to this logger instance\n * unless an explicit processor option is provided.\n */\n config: ({ processor, ...options }) => {\n const config = createConfig(options);\n // TODO(burdon): This could be buggy since the behavior is not reentrant.\n const processors = processor ? config.processors : log._config.processors;\n log._config = { ...config, processors };\n return log;\n },\n\n /**\n * Adds a processor to the logger.\n */\n addProcessor: (processor) => {\n if (log._config.processors.filter((p) => p === processor).length === 0) {\n log._config.processors.push(processor);\n }\n\n return () => {\n log._config.processors = log._config.processors.filter((p) => p !== processor);\n };\n },\n\n trace: (...params) => processLog(LogLevel.TRACE, ...params),\n debug: (...params) => processLog(LogLevel.DEBUG, ...params),\n verbose: (...params) => processLog(LogLevel.VERBOSE, ...params),\n info: (...params) => processLog(LogLevel.INFO, ...params),\n warn: (...params) => processLog(LogLevel.WARN, ...params),\n error: (...params) => processLog(LogLevel.ERROR, ...params),\n catch: (error, context, meta) => processLog(LogLevel.ERROR, undefined, context, meta, error),\n\n method: createMethodLogDecorator(log),\n function: createFunctionLogDecorator(log),\n\n break: () => log.info('-'.repeat(80)),\n stack: (message, context, meta) => {\n return processLog(LogLevel.INFO, `${message ?? 'Stack Dump'}\\n${getFormattedStackTrace()}`, context, meta);\n },\n });\n\n return log;\n};\n\n/**\n * Global logging function.\n */\nexport const log: Log = ((globalThis as any).DX_LOG ??= createLog());\n\nconst start = Date.now();\nlet last = start;\n\n/**\n * Log debug stack.\n */\nexport const debug = (label?: any, args?: any) => {\n const now = Date.now();\n const err = new Error();\n console.group(\n `DEBUG[${label}]`,\n JSON.stringify({ t: Number(now - start).toLocaleString(), dt: Number(now - last).toLocaleString(), ...args }),\n );\n console.warn(err.stack);\n console.groupEnd();\n last = Date.now();\n};\n\nconst getFormattedStackTrace = () => new Error().stack!.split('\\n').slice(3).join('\\n');\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { inspect } from 'node:util';\n\nconst kOwnershipScope = Symbol('kOwnershipScope');\nconst kCurrentOwnershipScope = Symbol('kCurrentOwnershipScope');\nconst kDebugInfoProperties = Symbol('kDebugInfoProperties');\n\n/**\n *\n */\n// TODO(burdon): Document.\nexport class OwnershipScope {\n public instance: any;\n\n constructor(\n public constr: any,\n public parent?: OwnershipScope,\n ) {}\n\n getInfo() {\n if (!this.instance) {\n return {};\n }\n const props = this.constr.prototype[kDebugInfoProperties] ?? [];\n const info: any = {};\n for (const prop of props) {\n info[prop] = this.instance[prop];\n }\n return info;\n }\n\n [inspect.custom]() {\n return {\n className: this.constr.name,\n info: this.getInfo(),\n parent: this.parent,\n };\n }\n}\n\nfunction decorateMethodWeakReturnOwnership(prototype: any, key: string) {\n const original = prototype[key];\n prototype[key] = function (...args: any) {\n const res = original.apply(this, ...args);\n\n if (res && typeof res.then === 'function') {\n res.then((value: any) => {\n if (kOwnershipScope in value) {\n value[kOwnershipScope].parent ??= this[kOwnershipScope];\n }\n });\n } else {\n if (res && kOwnershipScope in res) {\n res[kOwnershipScope].parent ??= this[kOwnershipScope];\n }\n }\n\n return res;\n };\n}\n\nexport function ownershipClass<T extends { new (...args: any[]): {} }>(constr: T) {\n for (const key of Object.getOwnPropertyNames(constr.prototype)) {\n if (key !== 'constructor' && typeof constr.prototype[key] === 'function') {\n decorateMethodWeakReturnOwnership(constr.prototype, key);\n }\n }\n\n return class extends constr {\n constructor(...args: any[]) {\n const currentCausality = (globalThis as any)[kCurrentOwnershipScope];\n (globalThis as any)[kCurrentOwnershipScope] = new OwnershipScope(constr, currentCausality);\n super(...args);\n (this as any)[kOwnershipScope] = (globalThis as any)[kCurrentOwnershipScope];\n (this as any)[kOwnershipScope].instance = this;\n (globalThis as any)[kCurrentOwnershipScope] = currentCausality;\n }\n };\n}\n\nexport const debugInfo = (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {\n // console.log(target, propertyKey, descriptor);\n (target[kDebugInfoProperties] ??= []).push(propertyKey);\n};\n\nexport const getCurrentOwnershipScope = (thisRef: any) => thisRef;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;AAIA,OAAOA,UAAU;AAEjB,SAASC,YAAY;;;ACFrB,SAASC,eAAe;AAExB,OAAOC,WAAW;AAKlB,IAAIC,gBAAgB;AAEb,IAAMC,2BACX,CAACC,SACD,CAACC,MAAcC,MAAcC,SAC7B,CAACC,QAAaC,aAA8BC,eAAAA;AAC1C,QAAMC,SAASD,WAAWE;AAC1B,QAAMC,aAAaJ;AACnBC,aAAWE,QAAQ,YAAwBE,MAAS;AAClD,UAAMC,eAAe;MACnBC,GAAG;MACHC,GAAG;MACH,GAAIV,QAAQ,CAAC;MACbW,GAAG;IACL;AAEA,UAAMC,gBAAgBL,KAAKM,IAAI,CAACC,QAAaC,QAAQD,KAAK,OAAO,GAAG,IAAA,CAAA,EAAOE,K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AAMC,kBAAkBC,OAAO,iBAAA;AAC/B,IAAMC,yBAAyBD,OAAO,wBAAA;AACtC,IAAME,uBAAuBF,OAAO,sBAAA;AAM7B,IAAMG,iBAAN,MAAMA;;;EACJC;EAEP,YACSC,QACAC,QACP;SAFOD,SAAAA;SACAC,SAAAA;EACN;EAEHC,UAAU;AACR,QAAI,CAAC,KAAKH,UAAU;AAClB,aAAO,CAAC;IACV;AACA,UAAMI,QAAQ,KAAKH,OAAOI,UAAUP,oBAAAA,KAAyB,CAAA;AAC7D,UAAMQ,OAAY,CAAC;AACnB,eAAWC,QAAQH,OAAO;AACxBE,WAAKC,IAAAA,IAAQ,KAAKP,SAASO,IAAAA;IAC7B;AACA,WAAOD;EACT;EAEA,CAACE,SAAQC,MAAM,IAAI;AACjB,WAAO;MACLC,WAAW,KAAKT,OAAOU;MACvBL,MAAM,KAAKH,QAAO;MAClBD,QAAQ,KAAKA;IACf;EACF;AACF;AA+CO,IAAMU,2BAA2B,CAACC,YAAiBA;",
|
|
6
|
-
"names": ["omit", "pick", "
|
|
3
|
+
"sources": ["../../../src/index.ts", "../../../src/environment.ts", "../../../src/jsonl.ts", "../../../src/decorators.ts", "../../../src/options.ts", "../../../src/platform/index.ts", "../../../src/processors/index.ts", "../../../src/processors/browser-processor.ts", "../../../src/processors/debug-processor.ts", "../../../src/processors/file-processor.ts", "../../../src/log.ts", "../../../src/meta.ts", "../../../src/dbg.ts", "../../../src/log-buffer.ts", "../../../src/experimental/ownership.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nimport { omit, pick } from '@dxos/util';\n\nexport { omit, pick };\n\nexport * from './config';\nexport * from './context';\nexport * from './environment';\nexport * from './jsonl';\nexport * from './log';\nexport { parseFilter } from './options';\nexport * from './processors';\nexport * from './scope';\nexport type { CallMetadata } from './meta';\nexport { LOG_META_MARKER, isLogMeta } from './meta';\nexport { dbg } from './dbg';\nexport * from './log-buffer';\n\nexport { getCurrentOwnershipScope } from './experimental/ownership';\n", "//\n// Copyright 2026 DXOS.org\n//\n\n/**\n * Per-tab session-storage key used to stabilize the random suffix for the main thread.\n * `sessionStorage` is per-tab and survives reloads of the same tab.\n */\nconst TAB_SUFFIX_STORAGE_KEY = '@dxos/log:env-suffix';\n\nconst SUFFIX_LENGTH = 6;\n\n/**\n * Generate a 6-character lowercase-alphanumeric suffix.\n * Cryptographically random when `crypto` is available; falls back to `Math.random`.\n */\nconst randomSuffix = (): string => {\n const cryptoRef = (globalThis as any).crypto as Crypto | undefined;\n if (cryptoRef?.getRandomValues) {\n const bytes = new Uint8Array(SUFFIX_LENGTH);\n cryptoRef.getRandomValues(bytes);\n // Each byte mod 36 maps to one base-36 char; mild modulo bias is acceptable for IDs.\n let suffix = '';\n for (const byte of bytes) {\n suffix += (byte % 36).toString(36);\n }\n return suffix;\n }\n return Math.random()\n .toString(36)\n .slice(2, 2 + SUFFIX_LENGTH)\n .padEnd(SUFFIX_LENGTH, '0');\n};\n\n/**\n * Look up (or create) a stable per-tab suffix in `sessionStorage`.\n * Same browser tab keeps the same suffix across reloads; different tabs get\n * different suffixes; private/blocked storage falls back to a fresh random.\n */\nconst getOrCreateTabSuffix = (session: Storage | undefined): string => {\n if (!session) {\n return randomSuffix();\n }\n try {\n const existing = session.getItem(TAB_SUFFIX_STORAGE_KEY);\n if (existing && existing.length > 0) {\n return existing;\n }\n const suffix = randomSuffix();\n session.setItem(TAB_SUFFIX_STORAGE_KEY, suffix);\n return suffix;\n } catch {\n return randomSuffix();\n }\n};\n\nconst isInstanceOf = (scope: unknown, ctorName: string): boolean => {\n const ctor = (scope as any)?.[ctorName];\n return typeof ctor === 'function' && scope instanceof ctor;\n};\n\n/**\n * Cloudflare Workers set `navigator.userAgent` to this exact string, regardless of\n * whether the worker is using modules or service-worker syntax. This is the most\n * stable signal and is checked before browser worker scopes because CF workers in\n * service-worker syntax also expose a `ServiceWorkerGlobalScope`.\n */\nconst CF_WORKER_USER_AGENT = 'Cloudflare-Workers';\n\n/**\n * Options for {@link inferEnvironmentName}.\n * Tests pass a custom `scope` to simulate worker / window globals.\n */\nexport type InferEnvironmentNameOptions = {\n scope?: unknown;\n};\n\n/**\n * Infer a writer/environment identifier from the current execution context.\n *\n * Safe to invoke in any JS runtime — never throws. Falls back to `unknown::<suffix>`\n * when the runtime can't be classified.\n *\n * Format is always three colon-separated segments: `<scope>:<name>:<suffix>`.\n * - `scope` — `tab | dedicated-worker | shared-worker | service-worker | cf-worker | node | unknown`.\n * - `name` — `location.origin` for tabs, `self.name` for browser workers, `process.pid`\n * for node, empty for cf-workers / service workers / anonymous workers.\n * Note that `name` may itself contain `:` (e.g. `http://localhost:5173`); when parsing,\n * take the first segment as scope and the last as suffix, and treat everything in\n * between as the name.\n * - `suffix` — 6-char random; stable per-tab via `sessionStorage`, fresh per worker / process instance.\n */\nexport const inferEnvironmentName = (options: InferEnvironmentNameOptions = {}): string => {\n const scope: any = options.scope ?? globalThis;\n\n // Cloudflare Workers — checked first because in service-worker syntax mode CF\n // workers also report as `ServiceWorkerGlobalScope`.\n if (scope.navigator?.userAgent === CF_WORKER_USER_AGENT) {\n return `cf-worker::${randomSuffix()}`;\n }\n\n if (isInstanceOf(scope, 'SharedWorkerGlobalScope')) {\n return `shared-worker:${scope.name ?? ''}:${randomSuffix()}`;\n }\n\n if (isInstanceOf(scope, 'ServiceWorkerGlobalScope')) {\n return `service-worker::${randomSuffix()}`;\n }\n\n if (isInstanceOf(scope, 'DedicatedWorkerGlobalScope')) {\n return `dedicated-worker:${scope.name ?? ''}:${randomSuffix()}`;\n }\n\n if (scope.window !== undefined && scope.window === scope) {\n const origin = scope.location?.origin ?? '';\n return `tab:${origin}:${getOrCreateTabSuffix(scope.sessionStorage)}`;\n }\n\n // Node.js — `process.versions.node` is the canonical signal.\n // Avoid touching the real `process` global directly so tests passing `scope: {}`\n // can opt out of node detection.\n const proc = scope.process;\n if (proc && typeof proc === 'object' && proc.versions?.node) {\n const pid = typeof proc.pid === 'number' ? String(proc.pid) : '';\n return `node:${pid}:${randomSuffix()}`;\n }\n\n return `unknown::${randomSuffix()}`;\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { LogLevel, shortLevelName } from './config';\nimport { type LogEntry } from './context';\n\n/**\n * Compact JSONL log record with short property names for small serialized size.\n *\n * Field names are intentionally one character to keep on-disk / on-wire size minimal —\n * a single record can be emitted thousands of times per session.\n */\nexport type LogRecord = {\n /** ISO timestamp. */\n t: string;\n /** Level letter (D, V, I, W, E). */\n l: string;\n /** Message. */\n m: string;\n /** File path. */\n f?: string;\n /** Line number. */\n n?: number;\n /** Object/scope from which the log was emitted. */\n o?: string;\n /** Error stack. */\n e?: string;\n /** Context JSON (already a string of pre-stringified flat key/values). */\n c?: string;\n /** Environment identifier (see {@link inferEnvironmentName}). */\n i?: string;\n};\n\n/**\n * Options for {@link serializeToJsonl}.\n */\nexport type SerializeToJsonlOptions = {\n /**\n * Environment identifier embedded in the record's `i` field.\n * Use {@link inferEnvironmentName} for a default that disambiguates tabs and workers.\n */\n env?: string;\n};\n\n/**\n * Serialize a {@link LogEntry} to a single compact JSON line (no trailing newline).\n *\n * Returns `undefined` for entries at TRACE level — callers can use this to skip them.\n *\n * The output is compatible with newline-delimited JSON (NDJSON / JSONL): join multiple\n * results with `\\n` for a stream / file representation.\n *\n * Context is taken from {@link LogEntry.computedContext}, which has already flattened\n * nested objects to strings (see `stringifyOneLevel` in `context.ts`), so the resulting\n * `c` field is a JSON string of a flat `Record<string, primitive>` map. The function\n * does **not** truncate context — callers that care about line size should set their own\n * cap before calling, or trim post-hoc.\n */\nexport const serializeToJsonl = (entry: LogEntry, opts: SerializeToJsonlOptions = {}): string | undefined => {\n if (entry.level <= LogLevel.TRACE) {\n return undefined;\n }\n\n const { filename, line, context: scopeName } = entry.computedMeta;\n\n const record: LogRecord = {\n t: new Date(entry.timestamp).toISOString(),\n l: shortLevelName[entry.level] ?? '?',\n m: entry.message ?? '',\n };\n\n if (filename !== undefined) {\n record.f = filename;\n }\n if (line !== undefined) {\n record.n = line;\n }\n if (scopeName !== undefined) {\n record.o = scopeName;\n }\n if (entry.computedError !== undefined) {\n record.e = entry.computedError;\n }\n if (opts.env !== undefined) {\n record.i = opts.env;\n }\n\n const computedContext = entry.computedContext;\n if (Object.keys(computedContext).length > 0) {\n try {\n record.c = JSON.stringify(computedContext);\n } catch {\n // Skip context that throws during serialization. `computedContext` is already flattened\n // via `stringifyOneLevel`, so this is best-effort belt-and-suspenders.\n }\n }\n\n try {\n return JSON.stringify(record);\n } catch {\n return undefined;\n }\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport chalk from 'chalk';\nimport { inspect } from 'node:util';\n\nimport { type LogMethods } from './log';\nimport { type CallMetadata } from './meta';\n\nlet nextPromiseId = 0;\n\nexport const createMethodLogDecorator =\n (log: LogMethods) =>\n (arg0?: never, arg1?: never, meta?: CallMetadata): MethodDecorator =>\n (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {\n const method = descriptor.value!;\n const methodName = propertyKey as string;\n descriptor.value = function (this: any, ...args: any) {\n const combinedMeta = {\n F: '',\n L: 0,\n ...(meta ?? {}),\n S: this as any,\n } as CallMetadata;\n\n const formattedArgs = args.map((arg: any) => inspect(arg, false, 1, true)).join(', ');\n\n try {\n const startTime = performance.now();\n const result = method.apply(this, args);\n\n if (isThenable(result)) {\n const id = nextPromiseId++;\n logAsyncBegin(log, methodName, formattedArgs, id, combinedMeta);\n result.then(\n (resolvedValue) => {\n logAsyncResolved(log, methodName, resolvedValue, id, startTime, combinedMeta);\n },\n (err) => {\n logAsyncRejected(log, methodName, err, id, startTime, combinedMeta);\n },\n );\n } else {\n logSyncCall(log, methodName, formattedArgs, result, combinedMeta);\n }\n\n return result;\n } catch (err: any) {\n logSyncError(log, methodName, formattedArgs, err, combinedMeta);\n throw err;\n }\n };\n Object.defineProperty(descriptor.value, 'name', { value: methodName + '$log' });\n };\n\nexport const createFunctionLogDecorator =\n (log: LogMethods) =>\n <F extends (...args: any[]) => any>(\n name: string,\n fn: F,\n opts: { transformOutput?: (result: ReturnType<F>) => Promise<any> | any } = {},\n ): F => {\n const decoratedFn = function (this: any, ...args: any) {\n const combinedMeta = {\n F: '',\n L: 0,\n } as CallMetadata;\n\n const formattedArgs = args.map((arg: any) => inspect(arg, false, 1, true)).join(', ');\n\n try {\n const startTime = performance.now();\n const result = fn.apply(this, args);\n\n let transformedResult = result;\n if (opts.transformOutput) {\n if (isThenable(result)) {\n transformedResult = result.then(opts.transformOutput as any);\n } else {\n transformedResult = opts.transformOutput(result);\n }\n }\n\n if (isThenable(transformedResult)) {\n const id = nextPromiseId++;\n logAsyncBegin(log, name, formattedArgs, id, combinedMeta);\n transformedResult.then(\n (resolvedValue) => {\n logAsyncResolved(log, name, resolvedValue, id, startTime, combinedMeta);\n },\n (err) => {\n logAsyncRejected(log, name, err, id, startTime, combinedMeta);\n },\n );\n } else {\n logSyncCall(log, name, formattedArgs, transformedResult, combinedMeta);\n }\n\n return result;\n } catch (err: any) {\n logSyncError(log, name, formattedArgs, err, combinedMeta);\n throw err;\n }\n };\n Object.defineProperty(decoratedFn, 'name', { value: name + '$log' });\n return decoratedFn as F;\n };\n\nconst isThenable = (obj: any): obj is Promise<unknown> => obj && typeof obj.then === 'function';\n\nconst logSyncCall = (\n log: LogMethods,\n methodName: string,\n formattedArgs: string,\n result: unknown,\n combinedMeta: CallMetadata,\n) => {\n log.info(\n `.${formatFunction(methodName)} (${formattedArgs}) ${chalk.gray('=>')} ${inspect(result, false, 1, true)}`,\n {},\n combinedMeta,\n );\n};\n\nconst logSyncError = (\n log: LogMethods,\n methodName: string,\n formattedArgs: string,\n err: Error,\n combinedMeta: CallMetadata,\n) => {\n log.error(`.${formatFunction(methodName)} (${formattedArgs}) 🔥 ${err}`, {}, combinedMeta);\n};\n\nconst logAsyncBegin = (\n log: LogMethods,\n methodName: string,\n formattedArgs: string,\n promiseId: number,\n combinedMeta: CallMetadata,\n) => {\n log.info(\n `.${formatFunction(methodName)} ↴ (${formattedArgs}) ${chalk.gray('=>')} ${formatPromise(promiseId)}`,\n {},\n combinedMeta,\n );\n};\n\nconst logAsyncResolved = (\n log: LogMethods,\n methodName: string,\n resolvedValue: unknown | undefined,\n promiseId: number,\n startTime: number,\n combinedMeta: CallMetadata,\n) => {\n if (resolvedValue !== undefined) {\n log.info(\n `.${formatFunction(methodName)} ↲ ${greenCheck} ${chalk.gray('resolve')} ${formatPromise(promiseId)} ${formatTimeElapsed(startTime)} ${chalk.gray('=>')} ${inspect(\n resolvedValue,\n false,\n 1,\n true,\n )}`,\n {},\n combinedMeta,\n );\n } else {\n log.info(\n `.${formatFunction(methodName)} ↲ ${greenCheck} ${chalk.gray('resolve')} ${formatPromise(promiseId)} ${formatTimeElapsed(startTime)}`,\n {},\n combinedMeta,\n );\n }\n};\n\nconst logAsyncRejected = (\n log: LogMethods,\n methodName: string,\n err: Error,\n promiseId: number,\n startTime: number,\n combinedMeta: CallMetadata,\n) => {\n log.info(\n `.${formatFunction(methodName)} ↲ 🔥 ${chalk.gray('reject')} ${formatPromise(promiseId)} ${formatTimeElapsed(startTime)} ${chalk.gray('=>')} ${err}`,\n {},\n combinedMeta,\n );\n};\n\nconst COLOR_FUNCTION = [220, 220, 170] as const;\n\n// https://github.com/dxos/dxos/issues/7286\nconst greenCheck = typeof chalk.green === 'function' ? chalk.green('✔') : '✔';\n\nconst formatTimeElapsed = (startTime: number) => chalk.gray(`${(performance.now() - startTime).toFixed(0)}ms`);\n\nconst formatFunction = (name: string) => chalk.bold(chalk.rgb(...COLOR_FUNCTION)(name));\n\nconst formatPromise = (id: number) => chalk.blue(`Promise#${id}`);\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport defaultsDeep from 'lodash.defaultsdeep';\n\nimport { type LogConfig, type LogFilter, LogLevel, type LogOptions, LogProcessorType, levels } from './config';\nimport { type LogProcessor } from './context';\nimport { loadOptions } from './platform';\nimport { BROWSER_PROCESSOR, CONSOLE_PROCESSOR, DEBUG_PROCESSOR } from './processors';\n\n/**\n * Processor variants.\n */\nexport const processors: Record<string, LogProcessor> = {\n [LogProcessorType.CONSOLE]: CONSOLE_PROCESSOR,\n [LogProcessorType.BROWSER]: BROWSER_PROCESSOR,\n [LogProcessorType.DEBUG]: DEBUG_PROCESSOR,\n};\n\nconst browser =\n (typeof window !== 'undefined' || typeof navigator !== 'undefined') &&\n !(typeof process !== 'undefined' && process?.env?.VITEST);\n\nexport const DEFAULT_PROCESSORS = [browser ? BROWSER_PROCESSOR : CONSOLE_PROCESSOR];\n\nconst parseLogLevel = (level: string, defValue = LogLevel.WARN) => levels[level.toLowerCase()] ?? defValue;\n\n/**\n * @internal\n */\nexport const parseFilter = (filter: string | string[] | LogLevel): LogFilter[] => {\n if (typeof filter === 'number') {\n return [{ level: filter }];\n }\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\n ? {\n level: parseLogLevel(level),\n pattern,\n }\n : {\n level: parseLogLevel(pattern),\n };\n });\n};\n\n/**\n * @internal\n */\nexport const createConfig = (options?: LogOptions): LogConfig => {\n // Node only.\n const envOptions: LogOptions | undefined =\n 'process' in globalThis\n ? {\n file: process!.env.LOG_CONFIG,\n filter: process!.env.LOG_FILTER,\n processor: process!.env.LOG_PROCESSOR,\n }\n : undefined;\n\n const mergedOptions: LogOptions = defaultsDeep({}, loadOptions(envOptions?.file), envOptions, options);\n return {\n options: mergedOptions,\n filters: parseFilter(mergedOptions.filter ?? LogLevel.INFO),\n captureFilters: parseFilter(mergedOptions.captureFilter ?? LogLevel.WARN),\n processors: mergedOptions.processor ? [processors[mergedOptions.processor]] : [...DEFAULT_PROCESSORS],\n prefix: mergedOptions.prefix,\n };\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nexport * from '#platform';\n", "//\n// Copyright 2022 DXOS.org\n//\n\nexport * from './browser-processor';\nexport * from './common';\nexport * from '#console-processor';\nexport * from './debug-processor';\nexport * from './file-processor';\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { safariCheck } from '@dxos/util';\n\nimport { LogLevel } from '../config';\nimport { type LogProcessor, getContextFromEntry, shouldLog } from '../context';\n\ntype Config = {\n useTestProcessor: boolean;\n printFileLinks: boolean;\n};\n\nconst CONFIG: Config = {\n useTestProcessor: false,\n printFileLinks: false,\n};\n\n/**\n * For running apps in the browser normally.\n */\nconst APP_BROWSER_PROCESSOR: LogProcessor = (config, entry) => {\n if (!shouldLog(entry, config.filters)) {\n return;\n }\n\n // Example local editor prefix: 'vscode://file/Users/burdon/Code/dxos/dxos/'.\n const LOG_BROWSER_PREFIX = config.prefix ?? 'https://vscode.dev/github.com/dxos/dxos/blob/main/';\n\n // TODO(burdon): CSS breaks formatting (e.g., [Object] rather than expandable property).\n // TODO(burdon): Consider custom formatters.\n // https://www.mattzeunert.com/2016/02/19/custom-chrome-devtools-object-formatters.html\n // NOTE: Cannot change color of link (from bright white).\n // const LOG_BROWSER_CSS = ['color:gray; font-size:10px; padding-bottom: 4px', 'color:#B97852; font-size:14px;'];\n const LOG_BROWSER_CSS: string[] = [];\n\n const { filename, line: lineNumber, context: scopeDebugName } = entry.computedMeta;\n\n let link = '';\n if (filename !== undefined && lineNumber !== undefined) {\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${lineNumber}`;\n }\n\n let args = [];\n\n const scope = entry.meta?.S;\n if (scope) {\n const scopeName = scope.name || scopeDebugName;\n if (scopeName) {\n const processPrefix = scope.hostSessionId ? '[worker] ' : '';\n // TODO(dmaretskyi): Those can be made clickable with a custom formatter.\n args.push(`%c${processPrefix}${scopeName}`, 'color:#C026D3;font-weight:bold');\n }\n }\n\n if (entry.message) {\n args.push(entry.message);\n }\n\n const context = getContextFromEntry(entry);\n if (context) {\n if (Object.keys(context).length === 1 && 'error' in context) {\n args.push(unwrapEffectError(context.error));\n } else if (Object.keys(context).length === 1 && 'err' in context) {\n args.push(unwrapEffectError(context.err));\n } else {\n args.push(context);\n }\n }\n\n // https://github.com/cloudflare/workers-sdk/issues/5591\n const levels: any = {\n [LogLevel.ERROR]: console.error.bind(console),\n [LogLevel.WARN]: console.warn.bind(console),\n [LogLevel.DEBUG]: console.log.bind(console),\n };\n\n // Safari prints source code location as this file, not the caller.\n if (CONFIG.printFileLinks || safariCheck()) {\n if (LOG_BROWSER_CSS?.length) {\n args = [`%c${link}\\n%c${args.join(' ')}`, ...LOG_BROWSER_CSS];\n } else {\n args = [link + '\\n', ...args];\n }\n }\n\n // https://github.com/cloudflare/workers-sdk/issues/5591\n const level = levels[entry.level] ?? console.log.bind(console);\n if (typeof entry.meta?.C === 'function') {\n entry.meta.C(level, args);\n } else {\n level(...args);\n }\n};\n\n/**\n * For running unit tests in the headless browser.\n */\nconst TEST_BROWSER_PROCESSOR: LogProcessor = (config, entry) => {\n if (!shouldLog(entry, config.filters)) {\n return;\n }\n\n const { filename, line: lineNumber } = entry.computedMeta;\n const path = filename !== undefined && lineNumber !== undefined ? `${filename}:${lineNumber}` : '';\n\n let args = [];\n\n const processPrefix = entry.meta?.S?.hostSessionId ? '[worker] ' : '';\n args.push(`${processPrefix}${entry.message}`);\n\n const context = getContextFromEntry(entry);\n if (context) {\n args.push(context);\n }\n\n const levels: any = {\n [LogLevel.ERROR]: console.error,\n [LogLevel.WARN]: console.warn,\n [LogLevel.DEBUG]: console.log,\n };\n\n if (CONFIG.printFileLinks) {\n args = [path, ...args];\n }\n\n const level = levels[entry.level] ?? console.log;\n if (typeof entry.meta?.C === 'function') {\n entry.meta.C(level, args);\n } else {\n level(...args);\n }\n};\n\nexport const BROWSER_PROCESSOR: LogProcessor = CONFIG.useTestProcessor ? TEST_BROWSER_PROCESSOR : APP_BROWSER_PROCESSOR;\n\n// effect-specific\nconst originalSymbol = Symbol.for('effect/OriginalAnnotation');\n\nconst unwrapEffectError = (error: any) => {\n if (typeof error === 'object' && error !== null && originalSymbol in error) {\n return error[originalSymbol];\n }\n return error;\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 2023 DXOS.org\n//\n\nimport { appendFileSync, mkdirSync, openSync } from 'node:fs';\nimport { dirname } from 'node:path';\n\nimport { type LogFilter, LogLevel } from '../config';\nimport { type LogProcessor, shouldLog } from '../context';\n\n// Amount of time to retry writing after encountering EAGAIN before giving up.\nconst EAGAIN_MAX_DURATION = 1000;\n\n/**\n * Create a file processor.\n * @param path - Path to log file to create or append to, or existing open file descriptor e.g. stdout.\n * @param levels - Log levels to process. Takes preference over Filters.\n * @param filters - Filters to apply.\n */\nexport const createFileProcessor = ({\n pathOrFd,\n levels,\n filters,\n}: {\n pathOrFd: string | number;\n levels: LogLevel[];\n filters?: LogFilter[];\n}): LogProcessor => {\n let fd: number | undefined;\n\n return (config, entry) => {\n if (levels.length > 0 && !levels.includes(entry.level)) {\n return;\n }\n if (!shouldLog(entry, filters)) {\n return;\n }\n\n if (typeof pathOrFd === 'number') {\n fd = pathOrFd;\n } else {\n try {\n mkdirSync(dirname(pathOrFd));\n } catch {}\n fd = openSync(pathOrFd, 'a');\n }\n\n const record = {\n level: entry.level,\n message: entry.message,\n timestamp: entry.timestamp,\n meta: entry.computedMeta,\n context: entry.computedContext,\n error: entry.computedError,\n };\n let retryTS: number = 0;\n\n // Retry writing if EAGAIN is encountered.\n //\n // Node may set stdout and stderr to non-blocking. https://github.com/nodejs/node/issues/42826\n // This can cause EAGAIN errors when writing to them.\n // In order to not drop logs, make log methods asynchronous, or deal with buffering/delayed writes, spin until write succeeds.\n\n while (true) {\n try {\n return appendFileSync(fd, JSON.stringify(record) + '\\n');\n } catch (err: any) {\n if (err.code !== 'EAGAIN') {\n throw err;\n }\n if (retryTS === 0) {\n retryTS = performance.now();\n } else {\n if (performance.now() - retryTS > EAGAIN_MAX_DURATION) {\n console.log(`could not write after ${EAGAIN_MAX_DURATION}ms of EAGAIN failures, giving up`);\n throw err;\n }\n }\n }\n }\n };\n};\n\nlet logFilePath: string | undefined;\nconst getLogFilePath = () => {\n logFilePath ??=\n process.env.LOG_FILE ??\n (process.env.HOME ? `${process.env.HOME}/.dxlog/${new Date().toISOString()}.log` : undefined);\n\n return logFilePath!;\n};\n\nexport const FILE_PROCESSOR: LogProcessor = createFileProcessor({\n pathOrFd: getLogFilePath(),\n levels: [LogLevel.ERROR, LogLevel.WARN, LogLevel.INFO, LogLevel.TRACE],\n});\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { type LogConfig, LogLevel, type LogOptions } from './config';\nimport { type LogContext, LogEntry, type LogProcessor } from './context';\nimport { createFunctionLogDecorator, createMethodLogDecorator } from './decorators';\nimport { type CallMetadata } from './meta';\nimport { createConfig } from './options';\n\n/**\n * Accessible from browser console.\n * Example: `DX_LOG.config({ filter: 'ERROR' })`\n * NOTE: File level filtering isn't supported in storybooks.\n */\ndeclare global {\n const DX_LOG: Log;\n}\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 config: (options?: LogOptions) => Log;\n addProcessor: (processor: LogProcessor, addDefault?: boolean) => () => void;\n\n /**\n * Log at `trace` level.\n *\n * Generally not surfaced to the developer and not captured in a log file.\n */\n trace: LogFunction;\n\n /**\n * Log at `debug` level.\n * Generally not surfaced to the developer and captured in a log file.\n */\n debug: LogFunction;\n\n /**\n * Log at `verbose` level.\n * Generally not surfaced to the developer and not captured in a log file.\n */\n verbose: LogFunction;\n\n /**\n * Log at `info` level.\n * Generally surfaced to the developer and captured in a log file.\n */\n info: LogFunction;\n\n /**\n * Log at `warn` level.\n * Generally surfaced to the developer and captured in a log file.\n */\n warn: LogFunction;\n\n /**\n * Log at `error` level.\n * Generally surfaced to the developer and captured in a log file.\n */\n error: LogFunction;\n\n /**\n * Log an error and its stack trace at an `error` level.\n * Generally surfaced to the developer and captured in a log file.\n */\n catch: (error: Error | any, context?: LogContext, meta?: CallMetadata) => void;\n\n /**\n * Decorator to log method parameters and return value at the `info` level.\n */\n method: (arg0?: never, arg1?: never, meta?: CallMetadata) => MethodDecorator;\n\n /**\n * Wrapper to log function parameters and return value at the `info` level.\n */\n function: <F extends (...args: any[]) => any>(\n name: string,\n fn: F,\n opts?: {\n transformOutput?: (result: ReturnType<F>) => Promise<any> | any;\n },\n ) => F;\n\n /**\n * Log a horizontal rule at the `info` level.\n */\n break: () => void;\n\n /**\n * Log a stack trace at the `info` level.\n */\n stack: (message?: string, context?: never, meta?: CallMetadata) => void;\n}\n\n/**\n * Properties accessible on the logging function.\n * @internal\n */\nexport interface Log extends LogFunction, LogMethods {\n readonly runtimeConfig: LogConfig;\n}\n\n/**\n * @internal\n */\ninterface LogImp extends Log {\n _id: string;\n _config: LogConfig;\n}\n\nlet logCount = 0;\n\n/**\n * Create a logging function with properties.\n * @internal\n */\nexport const createLog = (): LogImp => {\n // Default function.\n const log: LogImp = ((...params) => processLog(LogLevel.DEBUG, ...params)) as LogImp;\n\n // Add private properties.\n Object.assign<LogImp, Partial<LogImp>>(log, {\n _id: `log-${++logCount}`,\n _config: createConfig(),\n });\n\n // TODO(burdon): Document.\n Object.defineProperty(log, 'runtimeConfig', {\n get: () => log._config,\n });\n\n /**\n * Process the current log call.\n */\n const processLog = (\n level: LogLevel,\n message: string | undefined,\n context: LogContext = {},\n meta?: CallMetadata,\n error?: Error,\n ) => {\n // TODO(burdon): Do the filter matching upstream (here) rather than in each processor?\n const entry = new LogEntry({ level, message, context, meta, error });\n log._config.processors.forEach((processor) => processor(log._config, entry));\n };\n\n /**\n * API.\n */\n Object.assign<Log, LogMethods>(log, {\n /**\n * Update config.\n * NOTE: Preserves any processors that were already added to this logger instance\n * unless an explicit processor option is provided.\n */\n config: ({ processor, ...options } = {}) => {\n const config = createConfig(options);\n // TODO(burdon): This could be buggy since the behavior is not reentrant.\n const processors = processor ? config.processors : log._config.processors;\n log._config = { ...config, processors };\n return log;\n },\n\n /**\n * Adds a processor to the logger.\n */\n addProcessor: (processor) => {\n if (log._config.processors.filter((p) => p === processor).length === 0) {\n log._config.processors.push(processor);\n }\n\n return () => {\n log._config.processors = log._config.processors.filter((p) => p !== processor);\n };\n },\n\n trace: (...params) => processLog(LogLevel.TRACE, ...params),\n debug: (...params) => processLog(LogLevel.DEBUG, ...params),\n verbose: (...params) => processLog(LogLevel.VERBOSE, ...params),\n info: (...params) => processLog(LogLevel.INFO, ...params),\n warn: (...params) => processLog(LogLevel.WARN, ...params),\n error: (...params) => processLog(LogLevel.ERROR, ...params),\n catch: (error, context, meta) => processLog(LogLevel.ERROR, undefined, context, meta, error),\n\n method: createMethodLogDecorator(log),\n function: createFunctionLogDecorator(log),\n\n break: () => log.info('-'.repeat(80)),\n stack: (message, context, meta) => {\n return processLog(LogLevel.INFO, `${message ?? 'Stack Dump'}\\n${getFormattedStackTrace()}`, context, meta);\n },\n });\n\n return log;\n};\n\n/**\n * Global logging function.\n */\nexport const log: Log = ((globalThis as any).DX_LOG ??= createLog());\n\nconst start = Date.now();\nlet last = start;\n\n/**\n * Log debug stack.\n */\nexport const debug = (label?: any, args?: any) => {\n const now = Date.now();\n const err = new Error();\n console.group(\n `DEBUG[${label}]`,\n JSON.stringify({ t: Number(now - start).toLocaleString(), dt: Number(now - last).toLocaleString(), ...args }),\n );\n console.warn(err.stack);\n console.groupEnd();\n last = Date.now();\n};\n\nconst getFormattedStackTrace = () => new Error().stack!.split('\\n').slice(3).join('\\n');\n", "//\n// Copyright 2023 DXOS.org\n//\n\n/**\n * Marker key + value injected on every {@link CallMetadata} object by the log transform plugin.\n * Used by {@link isLogMeta} to detect a log-meta argument at runtime (e.g. for variadic\n * `param_index: 'last'` callees that don't have a fixed meta slot).\n */\nexport const LOG_META_MARKER = '~LogMeta';\n\n/**\n * Metadata injected by the log transform plugin.\n *\n * Field names are intentionally short to reduce the size of the generated code.\n */\nexport interface CallMetadata {\n /**\n * Marker tag — when present, equal to {@link LOG_META_MARKER} ({@link `'~LogMeta'`}).\n * Injected by the log transform plugin on every emitted meta object so that {@link isLogMeta}\n * can distinguish a meta argument from a regular user-supplied value at runtime.\n * Optional because hand-written `CallMetadata` literals (decorators, RPC mappers, tests)\n * don't need the marker — they are recognized by position in the call signature.\n */\n '~LogMeta'?: typeof LOG_META_MARKER;\n\n /**\n * File name.\n */\n F: string;\n\n /**\n * Line number.\n */\n L: number;\n\n /**\n * Value of `this` at the site of the log call.\n * Will be set to the class instance if the call is inside a method, or to the `globalThis` (`window` or `global`) otherwise.\n */\n S: any | undefined;\n\n /**\n * A callback that will invoke the provided function with provided arguments.\n * Useful in the browser to force a `console.log` call to have a certain stack-trace.\n */\n C?: (fn: Function, args: any[]) => void;\n\n /**\n * Source code of the argument list.\n */\n A?: string[];\n}\n\n/**\n * Type guard: `true` when `value` is a {@link CallMetadata} object emitted by the log transform plugin.\n * Detection is based on the presence of the {@link LOG_META_MARKER} marker key/value.\n */\nexport const isLogMeta = (value: unknown): value is CallMetadata => {\n return (\n value != null &&\n typeof value === 'object' &&\n (value as Record<string, unknown>)[LOG_META_MARKER] === LOG_META_MARKER\n );\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { type CallMetadata } from './meta';\n/**\n * Debug-log value to console.\n * Log's the expression being evaluated.\n *\n * If only one argument is provided, it will also be returned.\n *\n * @example\n * ```ts\n * dbg(foo, bar);\n * // foo = 1\n * // bar = 2\n *\n * bar = dbg(foo * 2);\n * // foo * 2 = 2\n * ```\n *\n * NOTE: The second argument is injected by the log transform plugin.\n */\nexport const dbg: {\n <T>(value: T, _meta?: CallMetadata): T;\n} = <T>(arg: T, meta?: CallMetadata): T => {\n if (meta?.A) {\n console.log(`${meta.A[0]} =`, arg);\n } else {\n console.log(arg);\n }\n\n return arg;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { CircularBuffer } from '@dxos/util';\n\nimport { type LogConfig, LogLevel, shortLevelName } from './config';\nimport { type LogEntry, type LogProcessor } from './context';\nimport { type LogRecord } from './jsonl';\n\nconst DEFAULT_BUFFER_SIZE = 2_000;\nconst MAX_CONTEXT_LENGTH = 500;\n\n/**\n * Captures recent log entries in a circular buffer for debug log dump.\n */\nexport class LogBuffer {\n private readonly _buffer: CircularBuffer<LogRecord>;\n\n constructor(size = DEFAULT_BUFFER_SIZE) {\n this._buffer = new CircularBuffer<LogRecord>(size);\n }\n\n /**\n * Log processor that can be registered with `log.runtimeConfig.processors`.\n * Captures every level except TRACE (does not apply `shouldLog` / filter; use for full debug dumps).\n */\n readonly logProcessor: LogProcessor = (_config: LogConfig, entry: LogEntry) => {\n if (entry.level <= LogLevel.TRACE) {\n return;\n }\n\n const { filename, line, context: scopeName } = entry.computedMeta;\n\n const record: LogRecord = {\n t: new Date(entry.timestamp).toISOString(),\n l: shortLevelName[entry.level] ?? '?',\n m: entry.message ?? '',\n };\n\n if (filename !== undefined) {\n record.f = filename;\n }\n if (line !== undefined) {\n record.n = line;\n }\n if (scopeName !== undefined) {\n record.o = scopeName;\n }\n\n if (entry.computedError !== undefined) {\n record.e = entry.computedError;\n }\n\n const computedContext = entry.computedContext;\n if (Object.keys(computedContext).length > 0) {\n try {\n let json = JSON.stringify(computedContext);\n if (json.length > MAX_CONTEXT_LENGTH) {\n json = json.slice(0, MAX_CONTEXT_LENGTH);\n }\n record.c = json;\n } catch {\n // Skip context that throws or is non-serializable.\n }\n }\n\n this._buffer.push(record);\n };\n\n /** Number of entries currently in the buffer. */\n get size(): number {\n return this._buffer.elementCount;\n }\n\n /** Discard all buffered entries. */\n clear(): void {\n this._buffer.clear();\n }\n\n /** Serialize buffer contents as NDJSON (newline-delimited JSON). */\n serialize(): string {\n const lines: string[] = [];\n for (const record of this._buffer) {\n lines.push(JSON.stringify(record));\n }\n return lines.join('\\n');\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { inspect } from 'node:util';\n\nconst kOwnershipScope = Symbol('kOwnershipScope');\nconst kCurrentOwnershipScope = Symbol('kCurrentOwnershipScope');\nconst kDebugInfoProperties = Symbol('kDebugInfoProperties');\n\n/**\n *\n */\n// TODO(burdon): Document.\nexport class OwnershipScope {\n public instance: any;\n\n constructor(\n public constr: any,\n public parent?: OwnershipScope,\n ) {}\n\n getInfo() {\n if (!this.instance) {\n return {};\n }\n const props = this.constr.prototype[kDebugInfoProperties] ?? [];\n const info: any = {};\n for (const prop of props) {\n info[prop] = this.instance[prop];\n }\n return info;\n }\n\n [inspect.custom]() {\n return {\n className: this.constr.name,\n info: this.getInfo(),\n parent: this.parent,\n };\n }\n}\n\nfunction decorateMethodWeakReturnOwnership(prototype: any, key: string) {\n const original = prototype[key];\n prototype[key] = function (...args: any) {\n const res = original.apply(this, ...args);\n\n if (res && typeof res.then === 'function') {\n res.then((value: any) => {\n if (kOwnershipScope in value) {\n value[kOwnershipScope].parent ??= this[kOwnershipScope];\n }\n });\n } else {\n if (res && kOwnershipScope in res) {\n res[kOwnershipScope].parent ??= this[kOwnershipScope];\n }\n }\n\n return res;\n };\n}\n\nexport function ownershipClass<T extends { new (...args: any[]): {} }>(constr: T) {\n for (const key of Object.getOwnPropertyNames(constr.prototype)) {\n if (key !== 'constructor' && typeof constr.prototype[key] === 'function') {\n decorateMethodWeakReturnOwnership(constr.prototype, key);\n }\n }\n\n return class extends constr {\n constructor(...args: any[]) {\n const currentCausality = (globalThis as any)[kCurrentOwnershipScope];\n (globalThis as any)[kCurrentOwnershipScope] = new OwnershipScope(constr, currentCausality);\n super(...args);\n (this as any)[kOwnershipScope] = (globalThis as any)[kCurrentOwnershipScope];\n (this as any)[kOwnershipScope].instance = this;\n (globalThis as any)[kCurrentOwnershipScope] = currentCausality;\n }\n };\n}\n\nexport const debugInfo = (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {\n // console.log(target, propertyKey, descriptor);\n (target[kDebugInfoProperties] ??= []).push(propertyKey);\n};\n\nexport const getCurrentOwnershipScope = (thisRef: any) => thisRef;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,SAASA,MAAMC,YAAY;;;ACI3B,IAAMC,yBAAyB;AAE/B,IAAMC,gBAAgB;AAMtB,IAAMC,eAAe,MAAA;AACnB,QAAMC,YAAaC,WAAmBC;AACtC,MAAIF,WAAWG,iBAAiB;AAC9B,UAAMC,QAAQ,IAAIC,WAAWP,aAAAA;AAC7BE,cAAUG,gBAAgBC,KAAAA;AAE1B,QAAIE,SAAS;AACb,eAAWC,QAAQH,OAAO;AACxBE,iBAAWC,OAAO,IAAIC,SAAS,EAAA;IACjC;AACA,WAAOF;EACT;AACA,SAAOG,KAAKC,OAAM,EACfF,SAAS,EAAA,EACTG,MAAM,GAAG,IAAIb,aAAAA,EACbc,OAAOd,eAAe,GAAA;AAC3B;AAOA,IAAMe,uBAAuB,CAACC,YAAAA;AAC5B,MAAI,CAACA,SAAS;AACZ,WAAOf,aAAAA;EACT;AACA,MAAI;AACF,UAAMgB,WAAWD,QAAQE,QAAQnB,sBAAAA;AACjC,QAAIkB,YAAYA,SAASE,SAAS,GAAG;AACnC,aAAOF;IACT;AACA,UAAMT,SAASP,aAAAA;AACfe,YAAQI,QAAQrB,wBAAwBS,MAAAA;AACxC,WAAOA;EACT,QAAQ;AACN,WAAOP,aAAAA;EACT;AACF;AAEA,IAAMoB,eAAe,CAACC,OAAgBC,aAAAA;AACpC,QAAMC,OAAQF,QAAgBC,QAAAA;AAC9B,SAAO,OAAOC,SAAS,cAAcF,iBAAiBE;AACxD;AAQA,IAAMC,uBAAuB;AAyBtB,IAAMC,uBAAuB,CAACC,UAAuC,CAAC,MAAC;AAC5E,QAAML,QAAaK,QAAQL,SAASnB;AAIpC,MAAImB,MAAMM,WAAWC,cAAcJ,sBAAsB;AACvD,WAAO,cAAcx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ACF;;;ACpFA,SAASC,WAAAA,gBAAe;AAIxB,IAAMC,uBAAuBC,uBAAO,sBAAA;AAM7B,IAAMC,iBAAN,MAAMA;;;EACJC;EAEP,YACSC,QACAC,QACP;SAFOD,SAAAA;SACAC,SAAAA;EACN;EAEHC,UAAU;AACR,QAAI,CAAC,KAAKH,UAAU;AAClB,aAAO,CAAC;IACV;AACA,UAAMI,QAAQ,KAAKH,OAAOI,UAAUR,oBAAAA,KAAyB,CAAA;AAC7D,UAAMS,OAAY,CAAC;AACnB,eAAWC,QAAQH,OAAO;AACxBE,WAAKC,IAAAA,IAAQ,KAAKP,SAASO,IAAAA;IAC7B;AACA,WAAOD;EACT;EAEA,CAACE,SAAQC,MAAM,IAAI;AACjB,WAAO;MACLC,WAAW,KAAKT,OAAOU;MACvBL,MAAM,KAAKH,QAAO;MAClBD,QAAQ,KAAKA;IACf;EACF;AACF;AA+CO,IAAMU,2BAA2B,CAACC,YAAiBA;",
|
|
6
|
+
"names": ["omit", "pick", "TAB_SUFFIX_STORAGE_KEY", "SUFFIX_LENGTH", "randomSuffix", "cryptoRef", "globalThis", "crypto", "getRandomValues", "bytes", "Uint8Array", "suffix", "byte", "toString", "Math", "random", "slice", "padEnd", "getOrCreateTabSuffix", "session", "existing", "getItem", "length", "setItem", "isInstanceOf", "scope", "ctorName", "ctor", "CF_WORKER_USER_AGENT", "inferEnvironmentName", "options", "navigator", "userAgent", "name", "window", "undefined", "origin", "location", "sessionStorage", "proc", "process", "versions", "node", "pid", "String", "serializeToJsonl", "entry", "opts", "level", "LogLevel", "TRACE", "undefined", "filename", "line", "context", "scopeName", "computedMeta", "record", "t", "Date", "timestamp", "toISOString", "l", "shortLevelName", "m", "message", "f", "n", "o", "computedError", "e", "env", "i", "computedContext", "Object", "keys", "length", "c", "JSON", "stringify", "chalk", "inspect", "nextPromiseId", "createMethodLogDecorator", "log", "arg0", "arg1", "meta", "target", "propertyKey", "descriptor", "method", "value", "methodName", "args", "combinedMeta", "F", "L", "S", "formattedArgs", "map", "arg", "join", "startTime", "performance", "now", "result", "apply", "isThenable", "id", "logAsyncBegin", "then", "resolvedValue", "logAsyncResolved", "err", "logAsyncRejected", "logSyncCall", "logSyncError", "Object", "defineProperty", "createFunctionLogDecorator", "name", "fn", "opts", "decoratedFn", "transformedResult", "transformOutput", "obj", "info", "formatFunction", "gray", "error", "promiseId", "formatPromise", "undefined", "greenCheck", "formatTimeElapsed", "COLOR_FUNCTION", "green", "toFixed", "bold", "rgb", "blue", "defaultsDeep", "safariCheck", "CONFIG", "useTestProcessor", "printFileLinks", "APP_BROWSER_PROCESSOR", "config", "entry", "shouldLog", "filters", "LOG_BROWSER_PREFIX", "prefix", "LOG_BROWSER_CSS", "filename", "line", "lineNumber", "context", "scopeDebugName", "computedMeta", "link", "undefined", "filepath", "replace", "args", "scope", "meta", "S", "scopeName", "name", "processPrefix", "hostSessionId", "push", "message", "getContextFromEntry", "Object", "keys", "length", "unwrapEffectError", "error", "err", "levels", "LogLevel", "ERROR", "console", "bind", "WARN", "warn", "DEBUG", "log", "safariCheck", "join", "level", "C", "TEST_BROWSER_PROCESSOR", "path", "BROWSER_PROCESSOR", "originalSymbol", "Symbol", "for", "inspect", "DEBUG_PROCESSOR", "config", "entry", "console", "log", "appendFileSync", "mkdirSync", "openSync", "dirname", "EAGAIN_MAX_DURATION", "createFileProcessor", "pathOrFd", "levels", "filters", "fd", "config", "entry", "length", "includes", "level", "shouldLog", "mkdirSync", "dirname", "openSync", "record", "message", "timestamp", "meta", "computedMeta", "context", "computedContext", "error", "computedError", "retryTS", "appendFileSync", "JSON", "stringify", "err", "code", "performance", "now", "console", "log", "logFilePath", "getLogFilePath", "process", "env", "LOG_FILE", "HOME", "Date", "toISOString", "undefined", "FILE_PROCESSOR", "LogLevel", "ERROR", "WARN", "INFO", "TRACE", "processors", "LogProcessorType", "CONSOLE", "CONSOLE_PROCESSOR", "BROWSER", "BROWSER_PROCESSOR", "DEBUG", "DEBUG_PROCESSOR", "browser", "window", "navigator", "process", "env", "VITEST", "DEFAULT_PROCESSORS", "parseLogLevel", "level", "defValue", "LogLevel", "WARN", "levels", "toLowerCase", "parseFilter", "filter", "lines", "split", "map", "pattern", "createConfig", "options", "envOptions", "globalThis", "file", "LOG_CONFIG", "LOG_FILTER", "processor", "LOG_PROCESSOR", "undefined", "mergedOptions", "defaultsDeep", "loadOptions", "filters", "INFO", "captureFilters", "captureFilter", "prefix", "logCount", "createLog", "log", "params", "processLog", "LogLevel", "DEBUG", "Object", "assign", "_id", "_config", "createConfig", "defineProperty", "get", "level", "message", "context", "meta", "error", "entry", "LogEntry", "processors", "forEach", "processor", "config", "options", "addProcessor", "filter", "p", "length", "push", "trace", "TRACE", "debug", "verbose", "VERBOSE", "info", "INFO", "warn", "WARN", "ERROR", "catch", "undefined", "method", "createMethodLogDecorator", "function", "createFunctionLogDecorator", "break", "repeat", "stack", "getFormattedStackTrace", "globalThis", "DX_LOG", "start", "Date", "now", "last", "label", "args", "err", "Error", "console", "group", "JSON", "stringify", "t", "Number", "toLocaleString", "dt", "groupEnd", "split", "slice", "join", "LOG_META_MARKER", "isLogMeta", "value", "dbg", "arg", "meta", "A", "console", "log", "CircularBuffer", "DEFAULT_BUFFER_SIZE", "MAX_CONTEXT_LENGTH", "LogBuffer", "_buffer", "size", "CircularBuffer", "logProcessor", "_config", "entry", "level", "LogLevel", "TRACE", "filename", "line", "context", "scopeName", "computedMeta", "record", "t", "Date", "timestamp", "toISOString", "l", "shortLevelName", "m", "message", "undefined", "f", "n", "o", "computedError", "e", "computedContext", "Object", "keys", "length", "json", "JSON", "stringify", "slice", "c", "push", "elementCount", "clear", "serialize", "lines", "join", "inspect", "kDebugInfoProperties", "Symbol", "OwnershipScope", "instance", "constr", "parent", "getInfo", "props", "prototype", "info", "prop", "inspect", "custom", "className", "name", "getCurrentOwnershipScope", "thisRef"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/config.ts":{"bytes":4022,"imports":[],"format":"esm"},"src/scope.ts":{"bytes":4052,"imports":[],"format":"esm"},"src/context.ts":{"bytes":9183,"imports":[{"path":"src/scope.ts","kind":"import-statement","original":"./scope"}],"format":"esm"},"src/decorators.ts":{"bytes":19783,"imports":[{"path":"node:util","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true}],"format":"esm"},"src/platform/index.ts":{"bytes":454,"imports":[{"path":"#platform","kind":"import-statement","external":true}],"format":"esm"},"src/processors/browser-processor.ts":{"bytes":15856,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"../config"},{"path":"src/context.ts","kind":"import-statement","original":"../context"}],"format":"esm"},"src/processors/common.ts":{"bytes":1609,"imports":[],"format":"esm"},"src/processors/debug-processor.ts":{"bytes":1057,"imports":[{"path":"node:util","kind":"import-statement","external":true}],"format":"esm"},"src/processors/file-processor.ts":{"bytes":10092,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"../config"},{"path":"src/context.ts","kind":"import-statement","original":"../context"},{"path":"src/processors/common.ts","kind":"import-statement","original":"./common"}],"format":"esm"},"src/processors/index.ts":{"bytes":885,"imports":[{"path":"src/processors/browser-processor.ts","kind":"import-statement","original":"./browser-processor"},{"path":"src/processors/common.ts","kind":"import-statement","original":"./common"},{"path":"#console-processor","kind":"import-statement","external":true},{"path":"src/processors/debug-processor.ts","kind":"import-statement","original":"./debug-processor"},{"path":"src/processors/file-processor.ts","kind":"import-statement","original":"./file-processor"}],"format":"esm"},"src/options.ts":{"bytes":8101,"imports":[{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"./config"},{"path":"src/platform/index.ts","kind":"import-statement","original":"./platform"},{"path":"src/processors/index.ts","kind":"import-statement","original":"./processors"}],"format":"esm"},"src/log.ts":{"bytes":14639,"imports":[{"path":"src/config.ts","kind":"import-statement","original":"./config"},{"path":"src/decorators.ts","kind":"import-statement","original":"./decorators"},{"path":"src/options.ts","kind":"import-statement","original":"./options"}],"format":"esm"},"src/experimental/ownership.ts":{"bytes":9249,"imports":[{"path":"node:util","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":1561,"imports":[{"path":"lodash.omit","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"./config"},{"path":"src/context.ts","kind":"import-statement","original":"./context"},{"path":"src/log.ts","kind":"import-statement","original":"./log"},{"path":"src/options.ts","kind":"import-statement","original":"./options"},{"path":"src/processors/index.ts","kind":"import-statement","original":"./processors"},{"path":"src/scope.ts","kind":"import-statement","original":"./scope"},{"path":"src/experimental/ownership.ts","kind":"import-statement","original":"./experimental/ownership"}],"format":"esm"},"src/platform/browser/index.ts":{"bytes":2923,"imports":[],"format":"esm"},"src/platform/node/index.ts":{"bytes":2034,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"js-yaml","kind":"import-statement","external":true}],"format":"esm"},"src/processors/console-stub.ts":{"bytes":815,"imports":[],"format":"esm"},"src/processors/console-processor.ts":{"bytes":13229,"imports":[{"path":"node:util","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"../config"},{"path":"src/context.ts","kind":"import-statement","original":"../context"},{"path":"src/processors/common.ts","kind":"import-statement","original":"./common"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":40324},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-QPYJZ4SO.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-2SZHAWBN.mjs","kind":"import-statement"},{"path":"lodash.omit","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"node:util","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"#platform","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"#console-processor","kind":"import-statement","external":true},{"path":"node: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","DEBUG_PROCESSOR","FILE_PROCESSOR","LogLevel","LogProcessorType","createFileProcessor","createLog","debug","gatherLogInfoFromScope","getContextFromEntry","getCurrentOwnershipScope","getRelativeFilename","levels","log","logInfo","omit","parseFilter","pick","shortLevelName","shouldLog"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":897},"src/decorators.ts":{"bytesInOutput":4556},"src/options.ts":{"bytesInOutput":1672},"src/platform/index.ts":{"bytesInOutput":116},"src/processors/index.ts":{"bytesInOutput":409},"src/processors/browser-processor.ts":{"bytesInOutput":2975},"src/processors/debug-processor.ts":{"bytesInOutput":146},"src/processors/file-processor.ts":{"bytesInOutput":1812},"src/log.ts":{"bytesInOutput":2640},"src/experimental/ownership.ts":{"bytesInOutput":814}},"bytes":17100},"dist/lib/node-esm/platform/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1471},"dist/lib/node-esm/platform/browser/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-2SZHAWBN.mjs","kind":"import-statement"}],"exports":["loadOptions"],"entryPoint":"src/platform/browser/index.ts","inputs":{"src/platform/browser/index.ts":{"bytesInOutput":446}},"bytes":668},"dist/lib/node-esm/platform/node/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1057},"dist/lib/node-esm/platform/node/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-2SZHAWBN.mjs","kind":"import-statement"},{"path":"node:fs","kind":"import-statement","external":true},{"path":"js-yaml","kind":"import-statement","external":true}],"exports":["loadOptions"],"entryPoint":"src/platform/node/index.ts","inputs":{"src/platform/node/index.ts":{"bytesInOutput":315}},"bytes":534},"dist/lib/node-esm/processors/console-stub.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":375},"dist/lib/node-esm/processors/console-stub.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-2SZHAWBN.mjs","kind":"import-statement"}],"exports":["CONSOLE_PROCESSOR"],"entryPoint":"src/processors/console-stub.ts","inputs":{"src/processors/console-stub.ts":{"bytesInOutput":35}},"bytes":268},"dist/lib/node-esm/processors/console-processor.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7039},"dist/lib/node-esm/processors/console-processor.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-QPYJZ4SO.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-2SZHAWBN.mjs","kind":"import-statement"},{"path":"node:util","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["CONSOLE_PROCESSOR","DEFAULT_FORMATTER","SHORT_FORMATTER","truncate"],"entryPoint":"src/processors/console-processor.ts","inputs":{"src/processors/console-processor.ts":{"bytesInOutput":2751}},"bytes":3175},"dist/lib/node-esm/chunk-QPYJZ4SO.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9507},"dist/lib/node-esm/chunk-QPYJZ4SO.mjs":{"imports":[],"exports":["LogLevel","LogProcessorType","gatherLogInfoFromScope","getContextFromEntry","getRelativeFilename","levels","logInfo","shortLevelName","shouldLog"],"inputs":{"src/config.ts":{"bytesInOutput":809},"src/scope.ts":{"bytesInOutput":632},"src/context.ts":{"bytesInOutput":1579},"src/processors/common.ts":{"bytesInOutput":194}},"bytes":3601},"dist/lib/node-esm/chunk-2SZHAWBN.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/node-esm/chunk-2SZHAWBN.mjs":{"imports":[],"exports":["__export","__reExport"],"inputs":{},"bytes":1013}}}
|
|
1
|
+
{"inputs":{"src/config.ts":{"bytes":3951,"imports":[],"format":"esm"},"src/processors/common.ts":{"bytes":1527,"imports":[],"format":"esm"},"src/scope.ts":{"bytes":3982,"imports":[],"format":"esm"},"src/context.ts":{"bytes":31025,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/processors/common.ts","kind":"import-statement","original":"./processors/common"},{"path":"src/scope.ts","kind":"import-statement","original":"./scope"}],"format":"esm"},"src/environment.ts":{"bytes":14073,"imports":[],"format":"esm"},"src/jsonl.ts":{"bytes":8140,"imports":[{"path":"src/config.ts","kind":"import-statement","original":"./config"}],"format":"esm"},"src/decorators.ts":{"bytes":19704,"imports":[{"path":"chalk","kind":"import-statement","external":true},{"path":"node:util","kind":"import-statement","external":true}],"format":"esm"},"src/platform/index.ts":{"bytes":375,"imports":[{"path":"#platform","kind":"import-statement","external":true}],"format":"esm"},"src/processors/browser-processor.ts":{"bytes":15947,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"../config"},{"path":"src/context.ts","kind":"import-statement","original":"../context"}],"format":"esm"},"src/processors/debug-processor.ts":{"bytes":966,"imports":[{"path":"node:util","kind":"import-statement","external":true}],"format":"esm"},"src/processors/file-processor.ts":{"bytes":9440,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"../config"},{"path":"src/context.ts","kind":"import-statement","original":"../context"}],"format":"esm"},"src/processors/index.ts":{"bytes":804,"imports":[{"path":"src/processors/browser-processor.ts","kind":"import-statement","original":"./browser-processor"},{"path":"src/processors/common.ts","kind":"import-statement","original":"./common"},{"path":"#console-processor","kind":"import-statement","external":true},{"path":"src/processors/debug-processor.ts","kind":"import-statement","original":"./debug-processor"},{"path":"src/processors/file-processor.ts","kind":"import-statement","original":"./file-processor"}],"format":"esm"},"src/options.ts":{"bytes":8029,"imports":[{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"./config"},{"path":"src/platform/index.ts","kind":"import-statement","original":"./platform"},{"path":"src/processors/index.ts","kind":"import-statement","original":"./processors"}],"format":"esm"},"src/log.ts":{"bytes":16445,"imports":[{"path":"src/config.ts","kind":"import-statement","original":"./config"},{"path":"src/context.ts","kind":"import-statement","original":"./context"},{"path":"src/decorators.ts","kind":"import-statement","original":"./decorators"},{"path":"src/options.ts","kind":"import-statement","original":"./options"}],"format":"esm"},"src/meta.ts":{"bytes":3942,"imports":[],"format":"esm"},"src/dbg.ts":{"bytes":1965,"imports":[],"format":"esm"},"src/log-buffer.ts":{"bytes":8231,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"./config"}],"format":"esm"},"src/experimental/ownership.ts":{"bytes":9162,"imports":[{"path":"node:util","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":2029,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"./config"},{"path":"src/context.ts","kind":"import-statement","original":"./context"},{"path":"src/environment.ts","kind":"import-statement","original":"./environment"},{"path":"src/jsonl.ts","kind":"import-statement","original":"./jsonl"},{"path":"src/log.ts","kind":"import-statement","original":"./log"},{"path":"src/options.ts","kind":"import-statement","original":"./options"},{"path":"src/processors/index.ts","kind":"import-statement","original":"./processors"},{"path":"src/scope.ts","kind":"import-statement","original":"./scope"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/dbg.ts","kind":"import-statement","original":"./dbg"},{"path":"src/log-buffer.ts","kind":"import-statement","original":"./log-buffer"},{"path":"src/experimental/ownership.ts","kind":"import-statement","original":"./experimental/ownership"}],"format":"esm"},"src/platform/browser/index.ts":{"bytes":2832,"imports":[],"format":"esm"},"src/platform/node/index.ts":{"bytes":1946,"imports":[{"path":"js-yaml","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true}],"format":"esm"},"src/processors/console-stub.ts":{"bytes":723,"imports":[],"format":"esm"},"src/processors/console-processor.ts":{"bytes":12746,"imports":[{"path":"chalk","kind":"import-statement","external":true},{"path":"node:util","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"../config"},{"path":"src/context.ts","kind":"import-statement","original":"../context"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":60096},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-5TBDXMQF.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-2SZHAWBN.mjs","kind":"import-statement"},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true},{"path":"node:util","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"#platform","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"#console-processor","kind":"import-statement","external":true},{"path":"node: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","DEBUG_PROCESSOR","FILE_PROCESSOR","LOG_META_MARKER","LogBuffer","LogEntry","LogLevel","LogProcessorType","createFileProcessor","createLog","dbg","debug","gatherLogInfoFromScope","getContextFromEntry","getCurrentOwnershipScope","getRelativeFilename","inferEnvironmentName","isLogMeta","levels","log","logInfo","omit","parseFilter","pick","serializeToJsonl","shortLevelName","shouldLog"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":1115},"src/environment.ts":{"bytesInOutput":2068},"src/jsonl.ts":{"bytesInOutput":889},"src/decorators.ts":{"bytesInOutput":4556},"src/options.ts":{"bytesInOutput":1672},"src/platform/index.ts":{"bytesInOutput":116},"src/processors/index.ts":{"bytesInOutput":409},"src/processors/browser-processor.ts":{"bytesInOutput":3173},"src/processors/debug-processor.ts":{"bytesInOutput":146},"src/processors/file-processor.ts":{"bytesInOutput":1721},"src/log.ts":{"bytesInOutput":2684},"src/meta.ts":{"bytesInOutput":165},"src/dbg.ts":{"bytesInOutput":138},"src/log-buffer.ts":{"bytesInOutput":1812},"src/experimental/ownership.ts":{"bytesInOutput":718}},"bytes":22658},"dist/lib/node-esm/platform/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1471},"dist/lib/node-esm/platform/browser/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-2SZHAWBN.mjs","kind":"import-statement"}],"exports":["loadOptions"],"entryPoint":"src/platform/browser/index.ts","inputs":{"src/platform/browser/index.ts":{"bytesInOutput":446}},"bytes":668},"dist/lib/node-esm/platform/node/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1042},"dist/lib/node-esm/platform/node/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-2SZHAWBN.mjs","kind":"import-statement"},{"path":"js-yaml","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true}],"exports":["loadOptions"],"entryPoint":"src/platform/node/index.ts","inputs":{"src/platform/node/index.ts":{"bytesInOutput":315}},"bytes":534},"dist/lib/node-esm/processors/console-stub.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":375},"dist/lib/node-esm/processors/console-stub.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-2SZHAWBN.mjs","kind":"import-statement"}],"exports":["CONSOLE_PROCESSOR"],"entryPoint":"src/processors/console-stub.ts","inputs":{"src/processors/console-stub.ts":{"bytesInOutput":35}},"bytes":268},"dist/lib/node-esm/processors/console-processor.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":6875},"dist/lib/node-esm/processors/console-processor.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-5TBDXMQF.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-2SZHAWBN.mjs","kind":"import-statement"},{"path":"chalk","kind":"import-statement","external":true},{"path":"node:util","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["CONSOLE_PROCESSOR","DEFAULT_FORMATTER","SHORT_FORMATTER","truncate"],"entryPoint":"src/processors/console-processor.ts","inputs":{"src/processors/console-processor.ts":{"bytesInOutput":2704}},"bytes":3105},"dist/lib/node-esm/chunk-5TBDXMQF.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":20284},"dist/lib/node-esm/chunk-5TBDXMQF.mjs":{"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["LogEntry","LogLevel","LogProcessorType","gatherLogInfoFromScope","getContextFromEntry","getRelativeFilename","levels","logInfo","shortLevelName","shouldLog"],"inputs":{"src/config.ts":{"bytesInOutput":809},"src/processors/common.ts":{"bytesInOutput":194},"src/scope.ts":{"bytesInOutput":648},"src/context.ts":{"bytesInOutput":6853}},"bytes":8903},"dist/lib/node-esm/chunk-2SZHAWBN.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/node-esm/chunk-2SZHAWBN.mjs":{"imports":[],"exports":["__export","__reExport"],"inputs":{},"bytes":1013}}}
|
|
@@ -2,8 +2,8 @@ import { createRequire } from 'node:module';const require = createRequire(import
|
|
|
2
2
|
import "../../chunk-2SZHAWBN.mjs";
|
|
3
3
|
|
|
4
4
|
// src/platform/node/index.ts
|
|
5
|
-
import fs from "node:fs";
|
|
6
5
|
import yaml from "js-yaml";
|
|
6
|
+
import fs from "node:fs";
|
|
7
7
|
var loadOptions = (filepath) => {
|
|
8
8
|
if (filepath) {
|
|
9
9
|
try {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/platform/node/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nimport
|
|
5
|
-
"mappings": ";;;;AAIA,OAAOA,
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["//\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"],
|
|
5
|
+
"mappings": ";;;;AAIA,OAAOA,UAAU;AACjB,OAAOC,QAAQ;AAOR,IAAMC,cAAc,CAACC,aAAAA;AAC1B,MAAIA,UAAU;AAEZ,QAAI;AACF,YAAMC,OAAOH,GAAGI,aAAaF,UAAU,OAAA;AACvC,UAAIC,MAAM;AACR,eAAOJ,KAAKM,KAAKF,IAAAA;MACnB;IACF,SAASG,KAAK;AACZC,cAAQC,KAAK,qBAAqBN,QAAAA,EAAU;IAC9C;EACF;AACF;",
|
|
6
|
+
"names": ["yaml", "fs", "loadOptions", "filepath", "text", "readFileSync", "load", "err", "console", "warn"]
|
|
7
7
|
}
|
|
@@ -2,15 +2,14 @@ import { createRequire } from 'node:module';const require = createRequire(import
|
|
|
2
2
|
import {
|
|
3
3
|
LogLevel,
|
|
4
4
|
getContextFromEntry,
|
|
5
|
-
getRelativeFilename,
|
|
6
5
|
shortLevelName,
|
|
7
6
|
shouldLog
|
|
8
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-5TBDXMQF.mjs";
|
|
9
8
|
import "../chunk-2SZHAWBN.mjs";
|
|
10
9
|
|
|
11
10
|
// src/processors/console-processor.ts
|
|
12
|
-
import { inspect } from "node:util";
|
|
13
11
|
import chalk from "chalk";
|
|
12
|
+
import { inspect } from "node:util";
|
|
14
13
|
import { getPrototypeSpecificInstanceId, pickBy } from "@dxos/util";
|
|
15
14
|
var LEVEL_COLORS = {
|
|
16
15
|
[LogLevel.TRACE]: "gray",
|
|
@@ -73,20 +72,16 @@ var CONSOLE_PROCESSOR = (config, entry) => {
|
|
|
73
72
|
if (!shouldLog(entry, config.filters)) {
|
|
74
73
|
return;
|
|
75
74
|
}
|
|
75
|
+
const { filename, line: lineNumber } = entry.computedMeta;
|
|
76
76
|
const parts = {
|
|
77
77
|
level,
|
|
78
78
|
message,
|
|
79
79
|
error,
|
|
80
|
-
path:
|
|
81
|
-
line:
|
|
82
|
-
scope:
|
|
80
|
+
path: filename,
|
|
81
|
+
line: lineNumber,
|
|
82
|
+
scope: meta?.S,
|
|
83
83
|
context: void 0
|
|
84
84
|
};
|
|
85
|
-
if (meta) {
|
|
86
|
-
parts.path = getRelativeFilename(meta.F);
|
|
87
|
-
parts.line = meta.L;
|
|
88
|
-
parts.scope = meta.S;
|
|
89
|
-
}
|
|
90
85
|
const context = getContextFromEntry(entry);
|
|
91
86
|
if (context) {
|
|
92
87
|
parts.context = inspect(pickBy(context, (value) => value !== void 0), {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/processors/console-processor.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nimport { inspect } from 'node:util';\n\nimport
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nimport chalk from 'chalk';\nimport { inspect } from 'node:util';\n\nimport { getPrototypeSpecificInstanceId, pickBy } from '@dxos/util';\n\nimport { type LogConfig, LogLevel, shortLevelName } from '../config';\nimport { type LogProcessor, getContextFromEntry, shouldLog } from '../context';\n\nconst LEVEL_COLORS: Record<LogLevel, typeof chalk.ForegroundColor> = {\n [LogLevel.TRACE]: 'gray',\n [LogLevel.DEBUG]: 'gray',\n [LogLevel.VERBOSE]: 'gray',\n [LogLevel.INFO]: 'white',\n [LogLevel.WARN]: 'yellow',\n [LogLevel.ERROR]: 'red',\n};\n\nexport const truncate = (text?: string, length = 0, right = false) => {\n const str = text && length ? (right ? text.slice(-length) : text.substring(0, length)) : (text ?? '');\n return right ? str.padStart(length, ' ') : str.padEnd(length, ' ');\n};\n\n// TODO(burdon): Optional package name.\n// TODO(burdon): Show exceptions on one line.\nexport type FormatParts = {\n path?: string;\n line?: number;\n timestamp?: string;\n level: LogLevel;\n message?: string;\n context?: any;\n error?: Error;\n scope?: any;\n};\n\nexport type Formatter = (config: LogConfig, parts: FormatParts) => (string | undefined)[];\n\nexport const DEFAULT_FORMATTER: Formatter = (\n config,\n { path, line, level, message, context, error, scope },\n): string[] => {\n const column = config.options?.formatter?.column;\n const filepath = path !== undefined && line !== undefined ? chalk.grey(`${path}:${line}`) : undefined;\n\n let instance;\n if (scope) {\n const prototype = Object.getPrototypeOf(scope);\n if (prototype !== null) {\n const id = getPrototypeSpecificInstanceId(scope);\n instance = chalk.magentaBright(`${prototype.constructor.name}#${id}`);\n }\n }\n\n const formattedTimestamp = config.options?.formatter?.timestamp ? new Date().toISOString() : undefined;\n const formattedLevel = chalk[LEVEL_COLORS[level]](column ? shortLevelName[level] : LogLevel[level]);\n const padding = column && filepath ? ''.padStart(column - filepath.length) : undefined;\n\n return config.options?.formatter?.timestampFirst\n ? [formattedTimestamp, filepath, padding, formattedLevel, instance, message, context, error]\n : [\n // NOTE: File path must come fist for console hyperlinks.\n // Must not truncate for terminal output.\n filepath,\n padding,\n formattedTimestamp,\n formattedLevel,\n instance,\n message,\n context,\n error,\n ];\n};\n\nexport const SHORT_FORMATTER: Formatter = (config, { path, level, message }) => {\n return [\n chalk.grey(truncate(path, 16, true)), // NOTE: Breaks terminal linking.\n chalk[LEVEL_COLORS[level]](shortLevelName[level]),\n message,\n ];\n};\n\n// TODO(burdon): Config option.\nconst formatter = DEFAULT_FORMATTER;\n\nexport const CONSOLE_PROCESSOR: LogProcessor = (config, entry) => {\n const { level, message, meta, error } = entry;\n if (!shouldLog(entry, config.filters)) {\n return;\n }\n\n const { filename, line: lineNumber } = entry.computedMeta;\n const parts: FormatParts = {\n level,\n message,\n error,\n path: filename,\n line: lineNumber,\n scope: meta?.S,\n context: undefined,\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"],
|
|
5
|
+
"mappings": ";;;;;;;;;;AAIA,OAAOA,WAAW;AAClB,SAASC,eAAe;AAExB,SAASC,gCAAgCC,cAAc;AAKvD,IAAMC,eAA+D;EACnE,CAACC,SAASC,KAAK,GAAG;EAClB,CAACD,SAASE,KAAK,GAAG;EAClB,CAACF,SAASG,OAAO,GAAG;EACpB,CAACH,SAASI,IAAI,GAAG;EACjB,CAACJ,SAASK,IAAI,GAAG;EACjB,CAACL,SAASM,KAAK,GAAG;AACpB;AAEO,IAAMC,WAAW,CAACC,MAAeC,SAAS,GAAGC,QAAQ,UAAK;AAC/D,QAAMC,MAAMH,QAAQC,SAAUC,QAAQF,KAAKI,MAAM,CAACH,MAAAA,IAAUD,KAAKK,UAAU,GAAGJ,MAAAA,IAAYD,QAAQ;AAClG,SAAOE,QAAQC,IAAIG,SAASL,QAAQ,GAAA,IAAOE,IAAII,OAAON,QAAQ,GAAA;AAChE;AAiBO,IAAMO,oBAA+B,CAC1CC,QACA,EAAEC,MAAMC,MAAMC,OAAOC,SAASC,SAASC,OAAOC,MAAK,MAAE;AAErD,QAAMC,SAASR,OAAOS,SAASC,WAAWF;AAC1C,QAAMG,WAAWV,SAASW,UAAaV,SAASU,SAAYC,MAAMC,KAAK,GAAGb,IAAAA,IAAQC,IAAAA,EAAM,IAAIU;AAE5F,MAAIG;AACJ,MAAIR,OAAO;AACT,UAAMS,YAAYC,OAAOC,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pC,MAAI5B,SAAS;AAGXmC,UAAMnC,UAAUsC,QACdC,OAAOvC,SAAS,CAACwC,UAAoBA,UAAUjC,MAAAA,GAC/C;MAAEkC,OAAO9C,OAAOS,QAAQqC;MAAOC,QAAQ;MAAMC,gBAAgB;MAAGC,QAAQ;IAAM,CAAA;EAElF;AAEA,QAAM/C,OAAOQ,UAAUV,QAAQwC,KAAAA,EAAOU,OAAOC,OAAAA,EAASC,KAAK,GAAA;AAC3DC,UAAQC,IAAIpD,IAAAA;AACd;",
|
|
6
|
+
"names": ["chalk", "inspect", "getPrototypeSpecificInstanceId", "pickBy", "LEVEL_COLORS", "LogLevel", "TRACE", "DEBUG", "VERBOSE", "INFO", "WARN", "ERROR", "truncate", "text", "length", "right", "str", "slice", "substring", "padStart", "padEnd", "DEFAULT_FORMATTER", "config", "path", "line", "level", "message", "context", "error", "scope", "column", "options", "formatter", "filepath", "undefined", "chalk", "grey", "instance", "prototype", "Object", "getPrototypeOf", "id", "getPrototypeSpecificInstanceId", "magentaBright", "name", "formattedTimestamp", "timestamp", "Date", "toISOString", "formattedLevel", "shortLevelName", "padding", "timestampFirst", "SHORT_FORMATTER", "CONSOLE_PROCESSOR", "entry", "meta", "shouldLog", "filters", "filename", "lineNumber", "computedMeta", "parts", "S", "getContextFromEntry", "inspect", "pickBy", "value", "depth", "colors", "maxArrayLength", "sorted", "filter", "Boolean", "join", "console", "log"]
|
|
7
7
|
}
|
|
@@ -5,14 +5,84 @@ import { type CallMetadata } from './meta';
|
|
|
5
5
|
*/
|
|
6
6
|
export type LogContext = Record<string, any> | Error | any;
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Normalized call-site metadata suitable for display and serialization.
|
|
9
9
|
*/
|
|
10
|
-
export interface
|
|
10
|
+
export interface ComputedLogMeta {
|
|
11
|
+
/** Relative filename (normalized via {@link getRelativeFilename}). */
|
|
12
|
+
filename?: string;
|
|
13
|
+
/** Line number within the file. */
|
|
14
|
+
line?: number;
|
|
15
|
+
/** Debug name of the enclosing scope (class instance), e.g. `MyClass#3`. */
|
|
16
|
+
context?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Fields required to construct a {@link LogEntry}.
|
|
20
|
+
*/
|
|
21
|
+
export interface LogEntryInit {
|
|
11
22
|
level: LogLevel;
|
|
12
23
|
message?: string;
|
|
13
24
|
context?: LogContext;
|
|
14
25
|
meta?: CallMetadata;
|
|
15
26
|
error?: Error;
|
|
27
|
+
/** Overrides the default timestamp ({@link Date.now}). */
|
|
28
|
+
timestamp?: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Record for a single log line processed by the logging pipeline.
|
|
32
|
+
*
|
|
33
|
+
* Raw fields (`level`, `message`, `context`, `meta`, `error`) are preserved so processors
|
|
34
|
+
* can access unmodified inputs. Derived, lazily computed getters
|
|
35
|
+
* ({@link computedContext}, {@link computedError}, {@link computedMeta}) centralize
|
|
36
|
+
* the formatting logic shared across processors that write to serialized stores.
|
|
37
|
+
*/
|
|
38
|
+
export declare class LogEntry {
|
|
39
|
+
#private;
|
|
40
|
+
/** Severity of this entry. */
|
|
41
|
+
readonly level: LogLevel;
|
|
42
|
+
/** Human-readable log message, if any. */
|
|
43
|
+
readonly message?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Raw context value passed at the call site. May be a record, an Error, a function
|
|
46
|
+
* returning either, or any other value. Processors that need the flattened /
|
|
47
|
+
* JSON-safe view should prefer {@link computedContext}.
|
|
48
|
+
*/
|
|
49
|
+
readonly context?: LogContext;
|
|
50
|
+
/** Raw call-site metadata injected by the log transform plugin. */
|
|
51
|
+
readonly meta?: CallMetadata;
|
|
52
|
+
/** Error passed to `log.catch()` / `log.error(err)`, if any. */
|
|
53
|
+
readonly error?: Error;
|
|
54
|
+
/** Unix timestamp in milliseconds of when the entry was created. */
|
|
55
|
+
readonly timestamp: number;
|
|
56
|
+
constructor(init: LogEntryInit);
|
|
57
|
+
/**
|
|
58
|
+
* Flattened, JSON-safe context intended for serialized stores.
|
|
59
|
+
*
|
|
60
|
+
* - Single-level key-value map.
|
|
61
|
+
* - Primitives (`boolean`, `number`, `string`, `null`, `undefined`) pass through.
|
|
62
|
+
* - Non-primitive values are stringified one level deep via `JSON.stringify` (no recursion).
|
|
63
|
+
* - The reserved `error` / `err` keys are stripped — use {@link computedError} instead.
|
|
64
|
+
* - Properties from `@logInfo`-decorated members of the scope (`meta.S`) are inlined.
|
|
65
|
+
*
|
|
66
|
+
* Lazily computed and memoized on first access.
|
|
67
|
+
*/
|
|
68
|
+
get computedContext(): Record<string, unknown>;
|
|
69
|
+
/**
|
|
70
|
+
* Stringified error for this entry, sourced (in priority order) from:
|
|
71
|
+
* 1. {@link error} (e.g. `log.catch(err)`),
|
|
72
|
+
* 2. {@link context} when the context itself is an {@link Error},
|
|
73
|
+
* 3. `context.error` or `context.err`.
|
|
74
|
+
*
|
|
75
|
+
* Formatted as `.stack` when available, falling back to `.message` or `String(err)`.
|
|
76
|
+
*
|
|
77
|
+
* Lazily computed and memoized on first access.
|
|
78
|
+
*/
|
|
79
|
+
get computedError(): string | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Normalized call-site metadata suitable for display / serialization.
|
|
82
|
+
*
|
|
83
|
+
* Lazily computed and memoized on first access.
|
|
84
|
+
*/
|
|
85
|
+
get computedMeta(): ComputedLogMeta;
|
|
16
86
|
}
|
|
17
87
|
/**
|
|
18
88
|
* Processes (e.g., prints, forwards) log entries.
|
|
@@ -22,5 +92,11 @@ export type LogProcessor = (config: LogConfig, entry: LogEntry) => void;
|
|
|
22
92
|
* Determines if the current line should be logged (called by the processor).
|
|
23
93
|
*/
|
|
24
94
|
export declare const shouldLog: (entry: LogEntry, filters?: LogFilter[]) => boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Merges scope info, entry context, and error into a single record — preserving nested
|
|
97
|
+
* objects and Error instances so rich consumers (console inspect, devtools) can format them.
|
|
98
|
+
*
|
|
99
|
+
* Prefer {@link LogEntry.computedContext} for serialized / JSON outputs.
|
|
100
|
+
*/
|
|
25
101
|
export declare const getContextFromEntry: (entry: LogEntry) => Record<string, any> | undefined;
|
|
26
102
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/context.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,QAAQ,CAAC;AAI3C;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,KAAK,GAAG,GAAG,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,QAAQ,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,qBAAa,QAAQ;;IACnB,8BAA8B;IAC9B,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IAEzB,0CAA0C;IAC1C,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC;IAE9B,mEAAmE;IACnE,QAAQ,CAAC,IAAI,CAAC,EAAE,YAAY,CAAC;IAE7B,gEAAgE;IAChE,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;IAEvB,oEAAoE;IACpE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAU3B,YAAY,IAAI,EAAE,YAAY,EAO7B;IAcD;;;;;;;;;;OAUG;IACH,IAAI,eAAe,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAM7C;IAED;;;;;;;;;OASG;IACH,IAAI,aAAa,IAAI,MAAM,GAAG,SAAS,CAMtC;IAED;;;;OAIG;IACH,IAAI,YAAY,IAAI,eAAe,CAKlC;CACF;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;AA+BxE;;GAEG;AACH,eAAO,MAAM,SAAS,UAAW,QAAQ,YAAY,SAAS,EAAE,KAAG,OAYlE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,UAAW,QAAQ,KAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SA0B3E,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type CallMetadata } from './meta';
|
|
2
|
+
/**
|
|
3
|
+
* Debug-log value to console.
|
|
4
|
+
* Log's the expression being evaluated.
|
|
5
|
+
*
|
|
6
|
+
* If only one argument is provided, it will also be returned.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* dbg(foo, bar);
|
|
11
|
+
* // foo = 1
|
|
12
|
+
* // bar = 2
|
|
13
|
+
*
|
|
14
|
+
* bar = dbg(foo * 2);
|
|
15
|
+
* // foo * 2 = 2
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* NOTE: The second argument is injected by the log transform plugin.
|
|
19
|
+
*/
|
|
20
|
+
export declare const dbg: {
|
|
21
|
+
<T>(value: T, _meta?: CallMetadata): T;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=dbg.d.ts.map
|