@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.
Files changed (73) hide show
  1. package/dist/lib/browser/chunk-V7FYKT4H.mjs +311 -0
  2. package/dist/lib/browser/chunk-V7FYKT4H.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +236 -43
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/platform/node/index.mjs +1 -1
  7. package/dist/lib/browser/platform/node/index.mjs.map +3 -3
  8. package/dist/lib/browser/processors/console-processor.mjs +6 -11
  9. package/dist/lib/browser/processors/console-processor.mjs.map +3 -3
  10. package/dist/lib/node-esm/chunk-5TBDXMQF.mjs +313 -0
  11. package/dist/lib/node-esm/chunk-5TBDXMQF.mjs.map +7 -0
  12. package/dist/lib/node-esm/index.mjs +236 -43
  13. package/dist/lib/node-esm/index.mjs.map +4 -4
  14. package/dist/lib/node-esm/meta.json +1 -1
  15. package/dist/lib/node-esm/platform/node/index.mjs +1 -1
  16. package/dist/lib/node-esm/platform/node/index.mjs.map +3 -3
  17. package/dist/lib/node-esm/processors/console-processor.mjs +6 -11
  18. package/dist/lib/node-esm/processors/console-processor.mjs.map +3 -3
  19. package/dist/types/src/context.d.ts +78 -2
  20. package/dist/types/src/context.d.ts.map +1 -1
  21. package/dist/types/src/dbg.d.ts +23 -0
  22. package/dist/types/src/dbg.d.ts.map +1 -0
  23. package/dist/types/src/decorators.d.ts.map +1 -1
  24. package/dist/types/src/environment.d.ts +24 -0
  25. package/dist/types/src/environment.d.ts.map +1 -0
  26. package/dist/types/src/environment.test.d.ts +2 -0
  27. package/dist/types/src/environment.test.d.ts.map +1 -0
  28. package/dist/types/src/experimental/ownership.d.ts.map +1 -1
  29. package/dist/types/src/index.d.ts +7 -3
  30. package/dist/types/src/index.d.ts.map +1 -1
  31. package/dist/types/src/jsonl.d.ts +53 -0
  32. package/dist/types/src/jsonl.d.ts.map +1 -0
  33. package/dist/types/src/jsonl.test.d.ts +2 -0
  34. package/dist/types/src/jsonl.test.d.ts.map +1 -0
  35. package/dist/types/src/log-buffer.d.ts +20 -0
  36. package/dist/types/src/log-buffer.d.ts.map +1 -0
  37. package/dist/types/src/log-buffer.test.d.ts +2 -0
  38. package/dist/types/src/log-buffer.test.d.ts.map +1 -0
  39. package/dist/types/src/log.d.ts +44 -1
  40. package/dist/types/src/log.d.ts.map +1 -1
  41. package/dist/types/src/meta.d.ts +20 -1
  42. package/dist/types/src/meta.d.ts.map +1 -1
  43. package/dist/types/src/platform/browser/index.d.ts.map +1 -1
  44. package/dist/types/src/platform/node/index.d.ts.map +1 -1
  45. package/dist/types/src/processors/browser-processor.d.ts.map +1 -1
  46. package/dist/types/src/processors/common.d.ts.map +1 -1
  47. package/dist/types/src/processors/console-processor.d.ts.map +1 -1
  48. package/dist/types/src/processors/file-processor.d.ts.map +1 -1
  49. package/dist/types/src/scope.d.ts.map +1 -1
  50. package/dist/types/tsconfig.tsbuildinfo +1 -1
  51. package/package.json +4 -9
  52. package/src/context.ts +242 -2
  53. package/src/dbg.ts +34 -0
  54. package/src/decorators.ts +1 -2
  55. package/src/environment.test.ts +222 -0
  56. package/src/environment.ts +129 -0
  57. package/src/experimental/classes.test.ts +0 -1
  58. package/src/index.ts +7 -4
  59. package/src/jsonl.test.ts +121 -0
  60. package/src/jsonl.ts +104 -0
  61. package/src/log-buffer.test.ts +158 -0
  62. package/src/log-buffer.ts +89 -0
  63. package/src/log.test.ts +0 -1
  64. package/src/log.ts +56 -12
  65. package/src/meta.ts +29 -1
  66. package/src/platform/node/index.ts +1 -2
  67. package/src/processors/browser-processor.ts +27 -28
  68. package/src/processors/console-processor.ts +5 -13
  69. package/src/processors/file-processor.ts +7 -9
  70. package/dist/lib/browser/chunk-GPOFUMLO.mjs +0 -133
  71. package/dist/lib/browser/chunk-GPOFUMLO.mjs.map +0 -7
  72. package/dist/lib/node-esm/chunk-QPYJZ4SO.mjs +0 -135
  73. package/dist/lib/node-esm/chunk-QPYJZ4SO.mjs.map +0 -7
package/src/log.ts CHANGED
@@ -3,13 +3,15 @@
3
3
  //
4
4
 
5
5
  import { type LogConfig, LogLevel, type LogOptions } from './config';
6
- import { type LogContext, type LogProcessor } from './context';
6
+ import { type LogContext, LogEntry, type LogProcessor } from './context';
7
7
  import { createFunctionLogDecorator, createMethodLogDecorator } from './decorators';
8
8
  import { type CallMetadata } from './meta';
9
9
  import { createConfig } from './options';
10
10
 
11
11
  /**
12
12
  * Accessible from browser console.
13
+ * Example: `DX_LOG.config({ filter: 'ERROR' })`
14
+ * NOTE: File level filtering isn't supported in storybooks.
13
15
  */
14
16
  declare global {
15
17
  const DX_LOG: Log;
@@ -24,18 +26,60 @@ type LogFunction = (message: string, context?: LogContext, meta?: CallMetadata)
24
26
  * Logging methods.
25
27
  */
26
28
  export interface LogMethods {
27
- config: (options: LogOptions) => Log;
29
+ config: (options?: LogOptions) => Log;
28
30
  addProcessor: (processor: LogProcessor, addDefault?: boolean) => () => void;
29
31
 
32
+ /**
33
+ * Log at `trace` level.
34
+ *
35
+ * Generally not surfaced to the developer and not captured in a log file.
36
+ */
30
37
  trace: LogFunction;
38
+
39
+ /**
40
+ * Log at `debug` level.
41
+ * Generally not surfaced to the developer and captured in a log file.
42
+ */
31
43
  debug: LogFunction;
44
+
45
+ /**
46
+ * Log at `verbose` level.
47
+ * Generally not surfaced to the developer and not captured in a log file.
48
+ */
32
49
  verbose: LogFunction;
50
+
51
+ /**
52
+ * Log at `info` level.
53
+ * Generally surfaced to the developer and captured in a log file.
54
+ */
33
55
  info: LogFunction;
56
+
57
+ /**
58
+ * Log at `warn` level.
59
+ * Generally surfaced to the developer and captured in a log file.
60
+ */
34
61
  warn: LogFunction;
62
+
63
+ /**
64
+ * Log at `error` level.
65
+ * Generally surfaced to the developer and captured in a log file.
66
+ */
35
67
  error: LogFunction;
68
+
69
+ /**
70
+ * Log an error and its stack trace at an `error` level.
71
+ * Generally surfaced to the developer and captured in a log file.
72
+ */
36
73
  catch: (error: Error | any, context?: LogContext, meta?: CallMetadata) => void;
37
74
 
75
+ /**
76
+ * Decorator to log method parameters and return value at the `info` level.
77
+ */
38
78
  method: (arg0?: never, arg1?: never, meta?: CallMetadata) => MethodDecorator;
79
+
80
+ /**
81
+ * Wrapper to log function parameters and return value at the `info` level.
82
+ */
39
83
  function: <F extends (...args: any[]) => any>(
40
84
  name: string,
41
85
  fn: F,
@@ -44,7 +88,14 @@ export interface LogMethods {
44
88
  },
45
89
  ) => F;
46
90
 
91
+ /**
92
+ * Log a horizontal rule at the `info` level.
93
+ */
47
94
  break: () => void;
95
+
96
+ /**
97
+ * Log a stack trace at the `info` level.
98
+ */
48
99
  stack: (message?: string, context?: never, meta?: CallMetadata) => void;
49
100
  }
50
101
 
@@ -96,15 +147,8 @@ export const createLog = (): LogImp => {
96
147
  error?: Error,
97
148
  ) => {
98
149
  // TODO(burdon): Do the filter matching upstream (here) rather than in each processor?
99
- log._config.processors.forEach((processor) =>
100
- processor(log._config, {
101
- level,
102
- message,
103
- context,
104
- meta,
105
- error,
106
- }),
107
- );
150
+ const entry = new LogEntry({ level, message, context, meta, error });
151
+ log._config.processors.forEach((processor) => processor(log._config, entry));
108
152
  };
109
153
 
110
154
  /**
@@ -116,7 +160,7 @@ export const createLog = (): LogImp => {
116
160
  * NOTE: Preserves any processors that were already added to this logger instance
117
161
  * unless an explicit processor option is provided.
118
162
  */
119
- config: ({ processor, ...options }) => {
163
+ config: ({ processor, ...options } = {}) => {
120
164
  const config = createConfig(options);
121
165
  // TODO(burdon): This could be buggy since the behavior is not reentrant.
122
166
  const processors = processor ? config.processors : log._config.processors;
package/src/meta.ts CHANGED
@@ -3,11 +3,27 @@
3
3
  //
4
4
 
5
5
  /**
6
- * Metadata injected b y the log transform plugin.
6
+ * Marker key + value injected on every {@link CallMetadata} object by the log transform plugin.
7
+ * Used by {@link isLogMeta} to detect a log-meta argument at runtime (e.g. for variadic
8
+ * `param_index: 'last'` callees that don't have a fixed meta slot).
9
+ */
10
+ export const LOG_META_MARKER = '~LogMeta';
11
+
12
+ /**
13
+ * Metadata injected by the log transform plugin.
7
14
  *
8
15
  * Field names are intentionally short to reduce the size of the generated code.
9
16
  */
10
17
  export interface CallMetadata {
18
+ /**
19
+ * Marker tag — when present, equal to {@link LOG_META_MARKER} ({@link `'~LogMeta'`}).
20
+ * Injected by the log transform plugin on every emitted meta object so that {@link isLogMeta}
21
+ * can distinguish a meta argument from a regular user-supplied value at runtime.
22
+ * Optional because hand-written `CallMetadata` literals (decorators, RPC mappers, tests)
23
+ * don't need the marker — they are recognized by position in the call signature.
24
+ */
25
+ '~LogMeta'?: typeof LOG_META_MARKER;
26
+
11
27
  /**
12
28
  * File name.
13
29
  */
@@ -35,3 +51,15 @@ export interface CallMetadata {
35
51
  */
36
52
  A?: string[];
37
53
  }
54
+
55
+ /**
56
+ * Type guard: `true` when `value` is a {@link CallMetadata} object emitted by the log transform plugin.
57
+ * Detection is based on the presence of the {@link LOG_META_MARKER} marker key/value.
58
+ */
59
+ export const isLogMeta = (value: unknown): value is CallMetadata => {
60
+ return (
61
+ value != null &&
62
+ typeof value === 'object' &&
63
+ (value as Record<string, unknown>)[LOG_META_MARKER] === LOG_META_MARKER
64
+ );
65
+ };
@@ -2,9 +2,8 @@
2
2
  // Copyright 2022 DXOS.org
3
3
  //
4
4
 
5
- import fs from 'node:fs';
6
-
7
5
  import yaml from 'js-yaml';
6
+ import fs from 'node:fs';
8
7
 
9
8
  import { type LogOptions } from '../../config';
10
9
 
@@ -2,23 +2,11 @@
2
2
  // Copyright 2022 DXOS.org
3
3
  //
4
4
 
5
- import { getDebugName, safariCheck } from '@dxos/util';
5
+ import { safariCheck } from '@dxos/util';
6
6
 
7
7
  import { LogLevel } from '../config';
8
8
  import { type LogProcessor, getContextFromEntry, shouldLog } from '../context';
9
9
 
10
- const getRelativeFilename = (filename: string) => {
11
- // TODO(burdon): Hack uses "packages" as an anchor (pre-parse NX?)
12
- // Including `packages/` part of the path so that excluded paths (e.g. from dist) are clickable in vscode.
13
- const match = filename.match(/.+\/(packages\/.+\/.+)/);
14
- if (match) {
15
- const [, filePath] = match;
16
- return filePath;
17
- }
18
-
19
- return filename;
20
- };
21
-
22
10
  type Config = {
23
11
  useTestProcessor: boolean;
24
12
  printFileLinks: boolean;
@@ -47,23 +35,26 @@ const APP_BROWSER_PROCESSOR: LogProcessor = (config, entry) => {
47
35
  // const LOG_BROWSER_CSS = ['color:gray; font-size:10px; padding-bottom: 4px', 'color:#B97852; font-size:14px;'];
48
36
  const LOG_BROWSER_CSS: string[] = [];
49
37
 
38
+ const { filename, line: lineNumber, context: scopeDebugName } = entry.computedMeta;
39
+
50
40
  let link = '';
51
- if (entry.meta) {
52
- const filename = getRelativeFilename(entry.meta.F);
41
+ if (filename !== undefined && lineNumber !== undefined) {
53
42
  const filepath = `${LOG_BROWSER_PREFIX.replace(/\/$/, '')}/${filename}`;
54
43
  // TODO(burdon): Line numbers not working for app link, even with colons.
55
44
  // https://stackoverflow.com/a/54459820/2804332
56
- link = `${filepath}#L${entry.meta.L}`;
45
+ link = `${filepath}#L${lineNumber}`;
57
46
  }
58
47
 
59
48
  let args = [];
60
49
 
61
- if (entry.meta?.S) {
62
- const scope = entry.meta?.S;
63
- const scopeName = scope.name || getDebugName(scope);
64
- const processPrefix = entry.meta.S?.hostSessionId ? '[worker] ' : '';
65
- // TODO(dmaretskyi): Those can be made clickable with a custom formatter.
66
- args.push(`%c${processPrefix}${scopeName}`, 'color:#C026D3;font-weight:bold');
50
+ const scope = entry.meta?.S;
51
+ if (scope) {
52
+ const scopeName = scope.name || scopeDebugName;
53
+ if (scopeName) {
54
+ const processPrefix = scope.hostSessionId ? '[worker] ' : '';
55
+ // TODO(dmaretskyi): Those can be made clickable with a custom formatter.
56
+ args.push(`%c${processPrefix}${scopeName}`, 'color:#C026D3;font-weight:bold');
57
+ }
67
58
  }
68
59
 
69
60
  if (entry.message) {
@@ -73,9 +64,9 @@ const APP_BROWSER_PROCESSOR: LogProcessor = (config, entry) => {
73
64
  const context = getContextFromEntry(entry);
74
65
  if (context) {
75
66
  if (Object.keys(context).length === 1 && 'error' in context) {
76
- args.push(context.error);
67
+ args.push(unwrapEffectError(context.error));
77
68
  } else if (Object.keys(context).length === 1 && 'err' in context) {
78
- args.push(context.err);
69
+ args.push(unwrapEffectError(context.err));
79
70
  } else {
80
71
  args.push(context);
81
72
  }
@@ -114,10 +105,8 @@ const TEST_BROWSER_PROCESSOR: LogProcessor = (config, entry) => {
114
105
  return;
115
106
  }
116
107
 
117
- let path = '';
118
- if (entry.meta) {
119
- path = `${getRelativeFilename(entry.meta.F)}:${entry.meta.L}`;
120
- }
108
+ const { filename, line: lineNumber } = entry.computedMeta;
109
+ const path = filename !== undefined && lineNumber !== undefined ? `${filename}:${lineNumber}` : '';
121
110
 
122
111
  let args = [];
123
112
 
@@ -148,3 +137,13 @@ const TEST_BROWSER_PROCESSOR: LogProcessor = (config, entry) => {
148
137
  };
149
138
 
150
139
  export const BROWSER_PROCESSOR: LogProcessor = CONFIG.useTestProcessor ? TEST_BROWSER_PROCESSOR : APP_BROWSER_PROCESSOR;
140
+
141
+ // effect-specific
142
+ const originalSymbol = Symbol.for('effect/OriginalAnnotation');
143
+
144
+ const unwrapEffectError = (error: any) => {
145
+ if (typeof error === 'object' && error !== null && originalSymbol in error) {
146
+ return error[originalSymbol];
147
+ }
148
+ return error;
149
+ };
@@ -2,17 +2,14 @@
2
2
  // Copyright 2022 DXOS.org
3
3
  //
4
4
 
5
- import { inspect } from 'node:util';
6
-
7
5
  import chalk from 'chalk';
6
+ import { inspect } from 'node:util';
8
7
 
9
8
  import { getPrototypeSpecificInstanceId, pickBy } from '@dxos/util';
10
9
 
11
10
  import { type LogConfig, LogLevel, shortLevelName } from '../config';
12
11
  import { type LogProcessor, getContextFromEntry, shouldLog } from '../context';
13
12
 
14
- import { getRelativeFilename } from './common';
15
-
16
13
  const LEVEL_COLORS: Record<LogLevel, typeof chalk.ForegroundColor> = {
17
14
  [LogLevel.TRACE]: 'gray',
18
15
  [LogLevel.DEBUG]: 'gray',
@@ -95,22 +92,17 @@ export const CONSOLE_PROCESSOR: LogProcessor = (config, entry) => {
95
92
  return;
96
93
  }
97
94
 
95
+ const { filename, line: lineNumber } = entry.computedMeta;
98
96
  const parts: FormatParts = {
99
97
  level,
100
98
  message,
101
99
  error,
102
- path: undefined,
103
- line: undefined,
104
- scope: undefined,
100
+ path: filename,
101
+ line: lineNumber,
102
+ scope: meta?.S,
105
103
  context: undefined,
106
104
  };
107
105
 
108
- if (meta) {
109
- parts.path = getRelativeFilename(meta.F);
110
- parts.line = meta.L;
111
- parts.scope = meta.S;
112
- }
113
-
114
106
  const context = getContextFromEntry(entry);
115
107
  if (context) {
116
108
  // Remove undefined fields.
@@ -5,12 +5,8 @@
5
5
  import { appendFileSync, mkdirSync, openSync } from 'node:fs';
6
6
  import { dirname } from 'node:path';
7
7
 
8
- import { jsonlogify } from '@dxos/util';
9
-
10
8
  import { type LogFilter, LogLevel } from '../config';
11
- import { type LogProcessor, getContextFromEntry, shouldLog } from '../context';
12
-
13
- import { getRelativeFilename } from './common';
9
+ import { type LogProcessor, shouldLog } from '../context';
14
10
 
15
11
  // Amount of time to retry writing after encountering EAGAIN before giving up.
16
12
  const EAGAIN_MAX_DURATION = 1000;
@@ -50,10 +46,12 @@ export const createFileProcessor = ({
50
46
  }
51
47
 
52
48
  const record = {
53
- ...entry,
54
- timestamp: Date.now(),
55
- ...(entry.meta ? { meta: { file: getRelativeFilename(entry.meta.F), line: entry.meta.L } } : {}),
56
- context: jsonlogify(getContextFromEntry(entry)),
49
+ level: entry.level,
50
+ message: entry.message,
51
+ timestamp: entry.timestamp,
52
+ meta: entry.computedMeta,
53
+ context: entry.computedContext,
54
+ error: entry.computedError,
57
55
  };
58
56
  let retryTS: number = 0;
59
57
 
@@ -1,133 +0,0 @@
1
- // src/config.ts
2
- var LogLevel = /* @__PURE__ */ (function(LogLevel2) {
3
- LogLevel2[LogLevel2["TRACE"] = 5] = "TRACE";
4
- LogLevel2[LogLevel2["DEBUG"] = 10] = "DEBUG";
5
- LogLevel2[LogLevel2["VERBOSE"] = 11] = "VERBOSE";
6
- LogLevel2[LogLevel2["INFO"] = 12] = "INFO";
7
- LogLevel2[LogLevel2["WARN"] = 13] = "WARN";
8
- LogLevel2[LogLevel2["ERROR"] = 14] = "ERROR";
9
- return LogLevel2;
10
- })({});
11
- var levels = {
12
- "*": 5,
13
- trace: 5,
14
- debug: 10,
15
- verbose: 11,
16
- info: 12,
17
- warn: 13,
18
- error: 14
19
- };
20
- var shortLevelName = {
21
- [5]: "T",
22
- [10]: "D",
23
- [11]: "V",
24
- [12]: "I",
25
- [13]: "W",
26
- [14]: "E"
27
- };
28
- var LogProcessorType = /* @__PURE__ */ (function(LogProcessorType2) {
29
- LogProcessorType2["CONSOLE"] = "console";
30
- LogProcessorType2["BROWSER"] = "browser";
31
- LogProcessorType2["DEBUG"] = "debug";
32
- return LogProcessorType2;
33
- })({});
34
-
35
- // src/scope.ts
36
- var logInfoProperties = Symbol("logInfoProperties");
37
- var logInfo = (target, propertyKey, descriptor) => {
38
- (target[logInfoProperties] ??= []).push(propertyKey);
39
- };
40
- var gatherLogInfoFromScope = (scope) => {
41
- if (!scope) {
42
- return {};
43
- }
44
- const res = {};
45
- const prototype = Object.getPrototypeOf(scope);
46
- const infoProps = (typeof prototype === "object" && prototype !== null ? prototype[logInfoProperties] : []) ?? [];
47
- for (const prop of infoProps) {
48
- try {
49
- res[prop] = typeof scope[prop] === "function" ? scope[prop]() : scope[prop];
50
- } catch (err) {
51
- res[prop] = err.message;
52
- }
53
- }
54
- return res;
55
- };
56
-
57
- // src/context.ts
58
- var matchFilter = (filter, level, path) => {
59
- if (filter.pattern?.startsWith("-")) {
60
- if (path?.includes(filter.pattern.slice(1))) {
61
- if (level >= filter.level) {
62
- return false;
63
- }
64
- }
65
- } else {
66
- if (filter.pattern?.length) {
67
- if (path?.includes(filter.pattern)) {
68
- return level >= filter.level;
69
- }
70
- } else {
71
- if (level >= filter.level) {
72
- return true;
73
- }
74
- }
75
- }
76
- };
77
- var shouldLog = (entry, filters) => {
78
- if (filters === void 0) {
79
- return false;
80
- }
81
- const results = filters.map((filter) => matchFilter(filter, entry.level, entry.meta?.F)).filter((result) => result !== void 0);
82
- return results.length > 0 && !results.some((results2) => results2 === false);
83
- };
84
- var getContextFromEntry = (entry) => {
85
- let context;
86
- if (entry.meta) {
87
- const scopeInfo = gatherLogInfoFromScope(entry.meta.S);
88
- if (Object.keys(scopeInfo).length > 0) {
89
- context = Object.assign(context ?? {}, scopeInfo);
90
- }
91
- }
92
- const entryContext = typeof entry.context === "function" ? entry.context() : entry.context;
93
- if (entryContext) {
94
- if (entryContext instanceof Error) {
95
- const c = entryContext.context;
96
- context = Object.assign(context ?? {}, {
97
- error: entryContext.stack,
98
- ...c
99
- });
100
- } else if (typeof entryContext === "object") {
101
- context = Object.assign(context ?? {}, entryContext);
102
- }
103
- }
104
- if (entry.error) {
105
- context = Object.assign(context ?? {}, {
106
- error: entry.error
107
- });
108
- }
109
- return context && Object.keys(context).length > 0 ? context : void 0;
110
- };
111
-
112
- // src/processors/common.ts
113
- var getRelativeFilename = (filename) => {
114
- const match = filename.match(/.+\/(packages\/.+\/.+)/);
115
- if (match) {
116
- const [, filePath] = match;
117
- return filePath;
118
- }
119
- return filename;
120
- };
121
-
122
- export {
123
- LogLevel,
124
- levels,
125
- shortLevelName,
126
- LogProcessorType,
127
- logInfo,
128
- gatherLogInfoFromScope,
129
- shouldLog,
130
- getContextFromEntry,
131
- getRelativeFilename
132
- };
133
- //# sourceMappingURL=chunk-GPOFUMLO.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/config.ts", "../../../src/scope.ts", "../../../src/context.ts", "../../../src/processors/common.ts"],
4
- "sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nimport { type LogProcessor } from './context';\n\n/**\n * Standard levels.\n * NOTE: Keep aligned with LogLevel in @dxos/protocols.\n */\n// TODO(burdon): Update numbers?\nexport enum LogLevel {\n TRACE = 5,\n DEBUG = 10,\n VERBOSE = 11,\n INFO = 12,\n WARN = 13,\n ERROR = 14,\n}\n\nexport const levels: Record<string, LogLevel> = {\n '*': LogLevel.TRACE,\n trace: LogLevel.TRACE,\n debug: LogLevel.DEBUG,\n verbose: LogLevel.VERBOSE,\n info: LogLevel.INFO,\n warn: LogLevel.WARN,\n error: LogLevel.ERROR,\n};\n\nexport const shortLevelName = {\n [LogLevel.TRACE]: 'T',\n [LogLevel.DEBUG]: 'D',\n [LogLevel.VERBOSE]: 'V',\n [LogLevel.INFO]: 'I',\n [LogLevel.WARN]: 'W',\n [LogLevel.ERROR]: 'E',\n};\n\nexport enum LogProcessorType {\n CONSOLE = 'console',\n BROWSER = 'browser',\n DEBUG = 'debug',\n}\n\n/**\n * Individual filter condition.\n */\nexport type LogFilter = {\n level: LogLevel;\n pattern?: string;\n};\n\n/**\n * Options to set inline or load from the YML file.\n */\nexport type LogOptions = {\n file?: string;\n filter?: string | string[] | LogLevel;\n captureFilter?: string | string[] | LogLevel;\n depth?: number; // Context object depth.\n processor?: string | LogProcessorType;\n formatter?: {\n column: number;\n timestamp: boolean;\n timestampFirst: boolean;\n };\n prefix?: string;\n};\n\n/**\n * Runtime config.\n */\nexport interface LogConfig {\n options: LogOptions;\n filters?: LogFilter[];\n captureFilters?: LogFilter[];\n processors: LogProcessor[];\n prefix?: string;\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nconst logInfoProperties = Symbol('logInfoProperties');\n\n/**\n * Decorate fields, properties, or methods to automatically include their values in log messages.\n *\n * Example:\n *\n * ```typescript\n * class Example {\n * @logInfo\n * peerId: PublicKey;\n * }\n * ```\n */\nexport const logInfo = (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => {\n // console.log(target, propertyKey, descriptor);\n (target[logInfoProperties] ??= []).push(propertyKey);\n};\n\n/**\n * Introspects class instance to find decorated metadata.\n * @param scope Class instance.\n */\nexport const gatherLogInfoFromScope = (scope: any): Record<string, any> => {\n if (!scope) {\n return {};\n }\n\n const res: Record<string, any> = {};\n\n const prototype = Object.getPrototypeOf(scope);\n const infoProps = (typeof prototype === 'object' && prototype !== null ? prototype[logInfoProperties] : []) ?? [];\n for (const prop of infoProps) {\n try {\n res[prop] = typeof scope[prop] === 'function' ? scope[prop]() : scope[prop];\n } catch (err: any) {\n res[prop] = err.message;\n }\n }\n\n return res;\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { type LogConfig, type LogFilter, type LogLevel } from './config';\nimport { type CallMetadata } from './meta';\nimport { gatherLogInfoFromScope } from './scope';\n\n/**\n * Optional object passed to the logging API.\n */\nexport type LogContext = Record<string, any> | Error | any;\n\n/**\n * Record for current log line.\n */\nexport interface LogEntry {\n level: LogLevel;\n message?: string;\n context?: LogContext;\n meta?: CallMetadata;\n error?: Error;\n}\n\n/**\n * Processes (e.g., prints, forwards) log entries.\n */\nexport type LogProcessor = (config: LogConfig, entry: LogEntry) => void;\n\n/**\n * Returns:\n * true if the log entry matches the filter,\n * false if should be excluded, or\n * undefined if it the filter doesn't match the level.\n */\nconst matchFilter = (filter: LogFilter, level: LogLevel, path?: string): boolean | undefined => {\n // TODO(burdon): Support regexp.\n if (filter.pattern?.startsWith('-')) {\n // Exclude.\n if (path?.includes(filter.pattern.slice(1))) {\n if (level >= filter.level) {\n return false;\n }\n }\n } else {\n // Include.\n if (filter.pattern?.length) {\n if (path?.includes(filter.pattern)) {\n return level >= filter.level;\n }\n } else {\n if (level >= filter.level) {\n return true;\n }\n }\n }\n};\n\n/**\n * Determines if the current line should be logged (called by the processor).\n */\nexport const shouldLog = (entry: LogEntry, filters?: LogFilter[]): boolean => {\n if (filters === undefined) {\n return false;\n }\n\n const results = filters\n .map((filter) => matchFilter(filter, entry.level, entry.meta?.F))\n .filter((result): result is boolean => result !== undefined);\n\n // Skip if any are explicitely false.\n // console.log({ level: entry.level, path: entry.meta?.F }, filters, results, results.length);\n return results.length > 0 && !results.some((results) => results === false);\n};\n\nexport const getContextFromEntry = (entry: LogEntry): Record<string, any> | undefined => {\n let context;\n if (entry.meta) {\n const scopeInfo = gatherLogInfoFromScope(entry.meta.S);\n if (Object.keys(scopeInfo).length > 0) {\n context = Object.assign(context ?? {}, scopeInfo);\n }\n }\n\n const entryContext = typeof entry.context === 'function' ? entry.context() : entry.context;\n if (entryContext) {\n if (entryContext instanceof Error) {\n // Additional context from Error.\n const c = (entryContext as any).context;\n // If ERROR then show stacktrace.\n context = Object.assign(context ?? {}, { error: entryContext.stack, ...c });\n } else if (typeof entryContext === 'object') {\n context = Object.assign(context ?? {}, entryContext);\n }\n }\n\n if (entry.error) {\n context = Object.assign(context ?? {}, { error: entry.error });\n }\n\n return context && Object.keys(context).length > 0 ? context : undefined;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nexport const getRelativeFilename = (filename: string) => {\n // TODO(burdon): Hack uses \"packages\" as an anchor (pre-parse NX?)\n // Including `packages/` part of the path so that excluded paths (e.g. from dist) are clickable in vscode.\n const match = filename.match(/.+\\/(packages\\/.+\\/.+)/);\n if (match) {\n const [, filePath] = match;\n return filePath;\n }\n\n return filename;\n};\n"],
5
- "mappings": ";AAWO,IAAKA,WAAAA,0BAAAA,WAAAA;;;;;;;SAAAA;;AASL,IAAMC,SAAmC;EAC9C,KAAG;EACHC,OAAK;EACLC,OAAK;EACLC,SAAO;EACPC,MAAI;EACJC,MAAI;EACJC,OAAK;AACP;AAEO,IAAMC,iBAAiB;EAC5B,CAAA,CAAA,GAAkB;EAClB,CAAA,EAAA,GAAkB;EAClB,CAAA,EAAA,GAAoB;EACpB,CAAA,EAAA,GAAiB;EACjB,CAAA,EAAA,GAAiB;EACjB,CAAA,EAAA,GAAkB;AACpB;AAEO,IAAKC,mBAAAA,0BAAAA,mBAAAA;;;;SAAAA;;;;ACnCZ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,EAC7Df,OAAO,CAACgB,WAA8BA,WAAWL,MAAAA;AAIpD,SAAOC,QAAQL,SAAS,KAAK,CAACK,QAAQK,KAAK,CAACL,aAAYA,aAAY,KAAA;AACtE;AAEO,IAAMM,sBAAsB,CAACT,UAAAA;AAClC,MAAIU;AACJ,MAAIV,MAAMK,MAAM;AACd,UAAMM,YAAYC,uBAAuBZ,MAAMK,KAAKQ,CAAC;AACrD,QAAIC,OAAOC,KAAKJ,SAAAA,EAAWb,SAAS,GAAG;AACrCY,gBAAUI,OAAOE,OAAON,WAAW,CAAC,GAAGC,SAAAA;IACzC;EACF;AAEA,QAAMM,eAAe,OAAOjB,MAAMU,YAAY,aAAaV,MAAMU,QAAO,IAAKV,MAAMU;AACnF,MAAIO,cAAc;AAChB,QAAIA,wBAAwBC,OAAO;AAEjC,YAAMC,IAAKF,aAAqBP;AAEhCA,gBAAUI,OAAOE,OAAON,WAAW,CAAC,GAAG;QAAEU,OAAOH,aAAaI;QAAO,GAAGF;MAAE,CAAA;IAC3E,WAAW,OAAOF,iBAAiB,UAAU;AAC3CP,gBAAUI,OAAOE,OAAON,WAAW,CAAC,GAAGO,YAAAA;IACzC;EACF;AAEA,MAAIjB,MAAMoB,OAAO;AACfV,cAAUI,OAAOE,OAAON,WAAW,CAAC,GAAG;MAAEU,OAAOpB,MAAMoB;IAAM,CAAA;EAC9D;AAEA,SAAOV,WAAWI,OAAOC,KAAKL,OAAAA,EAASZ,SAAS,IAAIY,UAAUR;AAChE;;;ACjGO,IAAMoB,sBAAsB,CAACC,aAAAA;AAGlC,QAAMC,QAAQD,SAASC,MAAM,wBAAA;AAC7B,MAAIA,OAAO;AACT,UAAM,CAAA,EAAGC,QAAAA,IAAYD;AACrB,WAAOC;EACT;AAEA,SAAOF;AACT;",
6
- "names": ["LogLevel", "levels", "trace", "debug", "verbose", "info", "warn", "error", "shortLevelName", "LogProcessorType", "logInfoProperties", "Symbol", "logInfo", "target", "propertyKey", "descriptor", "push", "gatherLogInfoFromScope", "scope", "res", "prototype", "Object", "getPrototypeOf", "infoProps", "prop", "err", "message", "matchFilter", "filter", "level", "path", "pattern", "startsWith", "includes", "slice", "length", "shouldLog", "entry", "filters", "undefined", "results", "map", "meta", "F", "result", "some", "getContextFromEntry", "context", "scopeInfo", "gatherLogInfoFromScope", "S", "Object", "keys", "assign", "entryContext", "Error", "c", "error", "stack", "getRelativeFilename", "filename", "match", "filePath"]
7
- }
@@ -1,135 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
-
3
- // src/config.ts
4
- var LogLevel = /* @__PURE__ */ (function(LogLevel2) {
5
- LogLevel2[LogLevel2["TRACE"] = 5] = "TRACE";
6
- LogLevel2[LogLevel2["DEBUG"] = 10] = "DEBUG";
7
- LogLevel2[LogLevel2["VERBOSE"] = 11] = "VERBOSE";
8
- LogLevel2[LogLevel2["INFO"] = 12] = "INFO";
9
- LogLevel2[LogLevel2["WARN"] = 13] = "WARN";
10
- LogLevel2[LogLevel2["ERROR"] = 14] = "ERROR";
11
- return LogLevel2;
12
- })({});
13
- var levels = {
14
- "*": 5,
15
- trace: 5,
16
- debug: 10,
17
- verbose: 11,
18
- info: 12,
19
- warn: 13,
20
- error: 14
21
- };
22
- var shortLevelName = {
23
- [5]: "T",
24
- [10]: "D",
25
- [11]: "V",
26
- [12]: "I",
27
- [13]: "W",
28
- [14]: "E"
29
- };
30
- var LogProcessorType = /* @__PURE__ */ (function(LogProcessorType2) {
31
- LogProcessorType2["CONSOLE"] = "console";
32
- LogProcessorType2["BROWSER"] = "browser";
33
- LogProcessorType2["DEBUG"] = "debug";
34
- return LogProcessorType2;
35
- })({});
36
-
37
- // src/scope.ts
38
- var logInfoProperties = Symbol("logInfoProperties");
39
- var logInfo = (target, propertyKey, descriptor) => {
40
- (target[logInfoProperties] ??= []).push(propertyKey);
41
- };
42
- var gatherLogInfoFromScope = (scope) => {
43
- if (!scope) {
44
- return {};
45
- }
46
- const res = {};
47
- const prototype = Object.getPrototypeOf(scope);
48
- const infoProps = (typeof prototype === "object" && prototype !== null ? prototype[logInfoProperties] : []) ?? [];
49
- for (const prop of infoProps) {
50
- try {
51
- res[prop] = typeof scope[prop] === "function" ? scope[prop]() : scope[prop];
52
- } catch (err) {
53
- res[prop] = err.message;
54
- }
55
- }
56
- return res;
57
- };
58
-
59
- // src/context.ts
60
- var matchFilter = (filter, level, path) => {
61
- if (filter.pattern?.startsWith("-")) {
62
- if (path?.includes(filter.pattern.slice(1))) {
63
- if (level >= filter.level) {
64
- return false;
65
- }
66
- }
67
- } else {
68
- if (filter.pattern?.length) {
69
- if (path?.includes(filter.pattern)) {
70
- return level >= filter.level;
71
- }
72
- } else {
73
- if (level >= filter.level) {
74
- return true;
75
- }
76
- }
77
- }
78
- };
79
- var shouldLog = (entry, filters) => {
80
- if (filters === void 0) {
81
- return false;
82
- }
83
- const results = filters.map((filter) => matchFilter(filter, entry.level, entry.meta?.F)).filter((result) => result !== void 0);
84
- return results.length > 0 && !results.some((results2) => results2 === false);
85
- };
86
- var getContextFromEntry = (entry) => {
87
- let context;
88
- if (entry.meta) {
89
- const scopeInfo = gatherLogInfoFromScope(entry.meta.S);
90
- if (Object.keys(scopeInfo).length > 0) {
91
- context = Object.assign(context ?? {}, scopeInfo);
92
- }
93
- }
94
- const entryContext = typeof entry.context === "function" ? entry.context() : entry.context;
95
- if (entryContext) {
96
- if (entryContext instanceof Error) {
97
- const c = entryContext.context;
98
- context = Object.assign(context ?? {}, {
99
- error: entryContext.stack,
100
- ...c
101
- });
102
- } else if (typeof entryContext === "object") {
103
- context = Object.assign(context ?? {}, entryContext);
104
- }
105
- }
106
- if (entry.error) {
107
- context = Object.assign(context ?? {}, {
108
- error: entry.error
109
- });
110
- }
111
- return context && Object.keys(context).length > 0 ? context : void 0;
112
- };
113
-
114
- // src/processors/common.ts
115
- var getRelativeFilename = (filename) => {
116
- const match = filename.match(/.+\/(packages\/.+\/.+)/);
117
- if (match) {
118
- const [, filePath] = match;
119
- return filePath;
120
- }
121
- return filename;
122
- };
123
-
124
- export {
125
- LogLevel,
126
- levels,
127
- shortLevelName,
128
- LogProcessorType,
129
- logInfo,
130
- gatherLogInfoFromScope,
131
- shouldLog,
132
- getContextFromEntry,
133
- getRelativeFilename
134
- };
135
- //# sourceMappingURL=chunk-QPYJZ4SO.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/config.ts", "../../../src/scope.ts", "../../../src/context.ts", "../../../src/processors/common.ts"],
4
- "sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nimport { type LogProcessor } from './context';\n\n/**\n * Standard levels.\n * NOTE: Keep aligned with LogLevel in @dxos/protocols.\n */\n// TODO(burdon): Update numbers?\nexport enum LogLevel {\n TRACE = 5,\n DEBUG = 10,\n VERBOSE = 11,\n INFO = 12,\n WARN = 13,\n ERROR = 14,\n}\n\nexport const levels: Record<string, LogLevel> = {\n '*': LogLevel.TRACE,\n trace: LogLevel.TRACE,\n debug: LogLevel.DEBUG,\n verbose: LogLevel.VERBOSE,\n info: LogLevel.INFO,\n warn: LogLevel.WARN,\n error: LogLevel.ERROR,\n};\n\nexport const shortLevelName = {\n [LogLevel.TRACE]: 'T',\n [LogLevel.DEBUG]: 'D',\n [LogLevel.VERBOSE]: 'V',\n [LogLevel.INFO]: 'I',\n [LogLevel.WARN]: 'W',\n [LogLevel.ERROR]: 'E',\n};\n\nexport enum LogProcessorType {\n CONSOLE = 'console',\n BROWSER = 'browser',\n DEBUG = 'debug',\n}\n\n/**\n * Individual filter condition.\n */\nexport type LogFilter = {\n level: LogLevel;\n pattern?: string;\n};\n\n/**\n * Options to set inline or load from the YML file.\n */\nexport type LogOptions = {\n file?: string;\n filter?: string | string[] | LogLevel;\n captureFilter?: string | string[] | LogLevel;\n depth?: number; // Context object depth.\n processor?: string | LogProcessorType;\n formatter?: {\n column: number;\n timestamp: boolean;\n timestampFirst: boolean;\n };\n prefix?: string;\n};\n\n/**\n * Runtime config.\n */\nexport interface LogConfig {\n options: LogOptions;\n filters?: LogFilter[];\n captureFilters?: LogFilter[];\n processors: LogProcessor[];\n prefix?: string;\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nconst logInfoProperties = Symbol('logInfoProperties');\n\n/**\n * Decorate fields, properties, or methods to automatically include their values in log messages.\n *\n * Example:\n *\n * ```typescript\n * class Example {\n * @logInfo\n * peerId: PublicKey;\n * }\n * ```\n */\nexport const logInfo = (target: any, propertyKey: string, descriptor?: PropertyDescriptor) => {\n // console.log(target, propertyKey, descriptor);\n (target[logInfoProperties] ??= []).push(propertyKey);\n};\n\n/**\n * Introspects class instance to find decorated metadata.\n * @param scope Class instance.\n */\nexport const gatherLogInfoFromScope = (scope: any): Record<string, any> => {\n if (!scope) {\n return {};\n }\n\n const res: Record<string, any> = {};\n\n const prototype = Object.getPrototypeOf(scope);\n const infoProps = (typeof prototype === 'object' && prototype !== null ? prototype[logInfoProperties] : []) ?? [];\n for (const prop of infoProps) {\n try {\n res[prop] = typeof scope[prop] === 'function' ? scope[prop]() : scope[prop];\n } catch (err: any) {\n res[prop] = err.message;\n }\n }\n\n return res;\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { type LogConfig, type LogFilter, type LogLevel } from './config';\nimport { type CallMetadata } from './meta';\nimport { gatherLogInfoFromScope } from './scope';\n\n/**\n * Optional object passed to the logging API.\n */\nexport type LogContext = Record<string, any> | Error | any;\n\n/**\n * Record for current log line.\n */\nexport interface LogEntry {\n level: LogLevel;\n message?: string;\n context?: LogContext;\n meta?: CallMetadata;\n error?: Error;\n}\n\n/**\n * Processes (e.g., prints, forwards) log entries.\n */\nexport type LogProcessor = (config: LogConfig, entry: LogEntry) => void;\n\n/**\n * Returns:\n * true if the log entry matches the filter,\n * false if should be excluded, or\n * undefined if it the filter doesn't match the level.\n */\nconst matchFilter = (filter: LogFilter, level: LogLevel, path?: string): boolean | undefined => {\n // TODO(burdon): Support regexp.\n if (filter.pattern?.startsWith('-')) {\n // Exclude.\n if (path?.includes(filter.pattern.slice(1))) {\n if (level >= filter.level) {\n return false;\n }\n }\n } else {\n // Include.\n if (filter.pattern?.length) {\n if (path?.includes(filter.pattern)) {\n return level >= filter.level;\n }\n } else {\n if (level >= filter.level) {\n return true;\n }\n }\n }\n};\n\n/**\n * Determines if the current line should be logged (called by the processor).\n */\nexport const shouldLog = (entry: LogEntry, filters?: LogFilter[]): boolean => {\n if (filters === undefined) {\n return false;\n }\n\n const results = filters\n .map((filter) => matchFilter(filter, entry.level, entry.meta?.F))\n .filter((result): result is boolean => result !== undefined);\n\n // Skip if any are explicitely false.\n // console.log({ level: entry.level, path: entry.meta?.F }, filters, results, results.length);\n return results.length > 0 && !results.some((results) => results === false);\n};\n\nexport const getContextFromEntry = (entry: LogEntry): Record<string, any> | undefined => {\n let context;\n if (entry.meta) {\n const scopeInfo = gatherLogInfoFromScope(entry.meta.S);\n if (Object.keys(scopeInfo).length > 0) {\n context = Object.assign(context ?? {}, scopeInfo);\n }\n }\n\n const entryContext = typeof entry.context === 'function' ? entry.context() : entry.context;\n if (entryContext) {\n if (entryContext instanceof Error) {\n // Additional context from Error.\n const c = (entryContext as any).context;\n // If ERROR then show stacktrace.\n context = Object.assign(context ?? {}, { error: entryContext.stack, ...c });\n } else if (typeof entryContext === 'object') {\n context = Object.assign(context ?? {}, entryContext);\n }\n }\n\n if (entry.error) {\n context = Object.assign(context ?? {}, { error: entry.error });\n }\n\n return context && Object.keys(context).length > 0 ? context : undefined;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nexport const getRelativeFilename = (filename: string) => {\n // TODO(burdon): Hack uses \"packages\" as an anchor (pre-parse NX?)\n // Including `packages/` part of the path so that excluded paths (e.g. from dist) are clickable in vscode.\n const match = filename.match(/.+\\/(packages\\/.+\\/.+)/);\n if (match) {\n const [, filePath] = match;\n return filePath;\n }\n\n return filename;\n};\n"],
5
- "mappings": ";;;AAWO,IAAKA,WAAAA,0BAAAA,WAAAA;;;;;;;SAAAA;;AASL,IA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ASZ,SAAS,IAAIY,UAAUR;AAChE;;;ACjGO,IAAMoB,sBAAsB,CAACC,aAAAA;AAGlC,QAAMC,QAAQD,SAASC,MAAM,wBAAA;AAC7B,MAAIA,OAAO;AACT,UAAM,CAAA,EAAGC,QAAAA,IAAYD;AACrB,WAAOC;EACT;AAEA,SAAOF;AACT;",
6
- "names": ["LogLevel", "levels", "trace", "debug", "verbose", "info", "warn", "error", "shortLevelName", "LogProcessorType", "logInfoProperties", "Symbol", "logInfo", "target", "propertyKey", "descriptor", "push", "gatherLogInfoFromScope", "scope", "res", "prototype", "Object", "getPrototypeOf", "infoProps", "prop", "err", "message", "matchFilter", "filter", "level", "path", "pattern", "startsWith", "includes", "slice", "length", "shouldLog", "entry", "filters", "undefined", "results", "map", "meta", "F", "result", "some", "getContextFromEntry", "context", "scopeInfo", "gatherLogInfoFromScope", "S", "Object", "keys", "assign", "entryContext", "Error", "c", "error", "stack", "getRelativeFilename", "filename", "match", "filePath"]
7
- }