@hydranium/protocol 1.0.0-next.217 → 1.0.0-next.218

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.
@@ -35,6 +35,11 @@ export declare abstract class AbstractLogger implements Logger {
35
35
  protected clock(): Clock;
36
36
  /** Render the current wall-clock instant as `HH:MM:SS.mmm`, sourced from {@link clock}. */
37
37
  protected timestamp(): string;
38
+ /**
39
+ * The `[Label - HH:MM:SS.mmm] [component]` prefix every sink starts a line
40
+ * with. The label is padded to the widest, so timestamps line up across sinks.
41
+ */
42
+ protected formatLinePrefix(label: string): string;
38
43
  error(message?: string, ...args: unknown[]): this;
39
44
  warn(message?: string, ...args: unknown[]): this;
40
45
  info(message?: string, ...args: unknown[]): this;
@@ -1 +1 @@
1
- {"version":3,"file":"abstract-logger.d.ts","sourceRoot":"","sources":["../src/abstract-logger.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,KAAK,EAAe,MAAM,SAAS,CAAC;AAClD,OAAO,EAAwB,KAAK,QAAQ,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAK1F;;;;;;;;;;;;GAYG;AACH,8BAAsB,cAAe,YAAW,MAAM;IACvC,SAAS,CAAC,SAAS,CAAC,EAAE,MAAM;IAAxC,YAAsB,SAAS,CAAC,EAAE,MAAM,YAAA,EAAI;IAE5C;;;;;;;OAOG;IACH,SAAS,CAAC,KAAK,IAAI,KAAK,CAEvB;IAED,2FAA2F;IAC3F,SAAS,CAAC,SAAS,IAAI,MAAM,CAE5B;IAED,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAGhD;IACD,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAG/C;IACD,IAAI,CAAC,OAAO,CAAC,EAAE,MAA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M,GAAG,IAAI,CAKpD;IAED,qDAAqD;IACrD,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAE3B;IAED,uFAAuF;IACvF,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAE3B;IAED,kFAAkF;IAClF,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAE5B;IAED;;;OAGG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEzB;IAED,yFAAyF;IACzF,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,GAAE,SAAS,OAAO,EAAO,EAAE,KAAK,SAAsB,GAAG,IAAI,CAKlH;IAED,gGAAgG;IAChG,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,CAAC;IAEzG,qFAAqF;IACrF,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CACrD"}
@@ -46,6 +46,13 @@ class AbstractLogger {
46
46
  timestamp() {
47
47
  return logger_1.Format.timestamp(new Date(this.clock().now()));
48
48
  }
49
+ /**
50
+ * The `[Label - HH:MM:SS.mmm] [component]` prefix every sink starts a line
51
+ * with. The label is padded to the widest, so timestamps line up across sinks.
52
+ */
53
+ formatLinePrefix(label) {
54
+ return `[${label.padEnd(5)} - ${this.timestamp()}]${this.component ? ` [${this.component}]` : ''}`;
55
+ }
49
56
  error(message, ...args) {
50
57
  this.send('error', message, args);
51
58
  return this;
@@ -1 +1 @@
1
- {"version":3,"file":"abstract-logger.js","sourceRoot":"","sources":["../src/abstract-logger.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAElF,mCAAkD;AAClD,qCAA0F;AAE1F,uHAAuH;AAC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;IAED,yFAAyF;IAC/E,IAAI,CAAC,KAAe,EAAE,OAAgB,EAAE,IAAI,GAAuB,EAAE,EAAE,KAAK,GAAG,qBAAY,CAAC,KAAK,CAAC;QACzG,IAAI,CAAC,OAAO,IAAI,CAAC,eAAM,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7C,OAAO;QACV,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAC1C,CAAC;CAOH"}
@@ -0,0 +1,23 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ import { AbstractLogger } from './abstract-logger';
10
+ import { type LogLevel, type Logger } from './logger';
11
+ /**
12
+ * {@link Logger} that writes each line to `console`, at the method matching its
13
+ * level: the framework's `[Label - time] [component]` prefix and the message,
14
+ * then any trailing arguments as they are, so a browser console can expand
15
+ * them. For a browser page, webview or extension host, which has no other sink
16
+ * to hand. On Node, `info` and `debug` reach stdout, so a process whose stdout
17
+ * carries a protocol stream must not use it.
18
+ */
19
+ export declare class ConsoleLogger extends AbstractLogger implements Logger {
20
+ protected emit(level: LogLevel, label: string, message: string, args: readonly unknown[]): void;
21
+ protected derive(component: string): this;
22
+ }
23
+ //# sourceMappingURL=console-logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-logger.d.ts","sourceRoot":"","sources":["../src/console-logger.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,MAAM,EAAE,MAAM,UAAU,CAAC;AAWtD;;;;;;;GAOG;AACH,qBAAa,aAAc,SAAQ,cAAe,YAAW,MAAM;IAChE,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,CAE9F;IAED,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAGxC;CACH"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2026 EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the MIT License which is available in the project root.
7
+ *
8
+ * SPDX-License-Identifier: MIT
9
+ ********************************************************************************/
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.ConsoleLogger = void 0;
12
+ const abstract_logger_1 = require("./abstract-logger");
13
+ /** `console.trace` prints a stack with every line, so `trace` goes out at `debug`. */
14
+ const CONSOLE_METHODS = {
15
+ error: 'error',
16
+ warn: 'warn',
17
+ info: 'info',
18
+ debug: 'debug',
19
+ trace: 'debug'
20
+ };
21
+ /**
22
+ * {@link Logger} that writes each line to `console`, at the method matching its
23
+ * level: the framework's `[Label - time] [component]` prefix and the message,
24
+ * then any trailing arguments as they are, so a browser console can expand
25
+ * them. For a browser page, webview or extension host, which has no other sink
26
+ * to hand. On Node, `info` and `debug` reach stdout, so a process whose stdout
27
+ * carries a protocol stream must not use it.
28
+ */
29
+ class ConsoleLogger extends abstract_logger_1.AbstractLogger {
30
+ emit(level, label, message, args) {
31
+ console[CONSOLE_METHODS[level]](`${this.formatLinePrefix(label)} ${message}`, ...args);
32
+ }
33
+ derive(component) {
34
+ const Subclass = this.constructor;
35
+ return new Subclass(component);
36
+ }
37
+ }
38
+ exports.ConsoleLogger = ConsoleLogger;
39
+ //# sourceMappingURL=console-logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console-logger.js","sourceRoot":"","sources":["../src/console-logger.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAElF,uDAAmD;AAGnD,sFAAsF;AACtF,MAAM,eAAe,GAA0D;IAC5E,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;CAChB,CAAC;AAEF;;;;;;;GAOG;AACH,mBAA2B,SAAQ,gCAAc;IACpC,IAAI,CAAC,KAAe,EAAE,KAAa,EAAE,OAAe,EAAE,IAAwB;QACrF,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,IAAI,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IAC1F,CAAC;IAES,MAAM,CAAC,SAAiB;QAC/B,MAAM,QAAQ,GAAG,IAAI,CAAC,WAA+C,CAAC;QACtE,OAAO,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;CACH"}
package/lib/index.d.ts CHANGED
@@ -7,6 +7,7 @@
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
9
  export * from './abstract-logger';
10
+ export * from './console-logger';
10
11
  export * from './client';
11
12
  export * from './client-ids';
12
13
  export * from './clock';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AASlF,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AAIpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,e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AAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,OAAO,CAAC;AACtB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC"}
package/lib/index.js CHANGED
@@ -29,6 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
29
29
  // on the opposite constraint: re-exporting it would put the test doubles in
30
30
  // every production bundle that imports the root.
31
31
  __exportStar(require("./abstract-logger"), exports);
32
+ __exportStar(require("./console-logger"), exports);
32
33
  __exportStar(require("./client"), exports);
33
34
  __exportStar(require("./client-ids"), exports);
34
35
  __exportStar(require("./clock"), exports);
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,kFAAkF;AAClF,+EAA+E;AAC/E,8EAA8E;AAC9E,+EAA+E;AAC/E,4EAA4E;AAC5E,iDAAiD;AAEjD,oDAAkC;AAClC,2CAAyB;AACzB,+CAA6B;AAC7B,0CAAwB;AACxB,yCAAuB;AACvB,oDAAkC;AAClC,8CAA4B;AAC5B,4DAA0C;AAC1C,4DAA0C;AAC1C,2CAAyB;AACzB,qDAAmC;AACnC,2CAAyB;AACzB,sDAAoC;AACpC,6EAA6E;AAC7E,+EAA+E;AAC/E,+BAA+B;AAC/B,wDAAsC;AACtC,gDAA8B;AAC9B,oDAAkC;AAClC,gDAA8B;AAC9B,qDAAmC;AACnC,oDAAkC;AAClC,8CAA4B;AAC5B,2CAAyB;AACzB,wDAAsC;AACtC,qDAAmC;AACnC,kDAAgC;AAChC,sDAAoC;AACpC,iDAA+B;AAC/B,4CAA0B;AAC1B,gDAA8B;AAC9B,wCAAsB;AACtB,wCAAsB;AACtB,yCAAuB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,kFAAkF;AAClF,+EAA+E;AAC/E,8EAA8E;AAC9E,+EAA+E;AAC/E,4EAA4E;AAC5E,iDAAiD;AAEjD,oDAAkC;AAClC,mDAAiC;AACjC,2CAAyB;AACzB,+CAA6B;AAC7B,0CAAwB;AACxB,yCAAuB;AACvB,oDAAkC;AAClC,8CAA4B;AAC5B,4DAA0C;AAC1C,4DAA0C;AAC1C,2CAAyB;AACzB,qDAAmC;AACnC,2CAAyB;AACzB,sDAAoC;AACpC,6EAA6E;AAC7E,+EAA+E;AAC/E,+BAA+B;AAC/B,wDAAsC;AACtC,gDAA8B;AAC9B,oDAAkC;AAClC,gDAA8B;AAC9B,qDAAmC;AACnC,oDAAkC;AAClC,8CAA4B;AAC5B,2CAAyB;AACzB,wDAAsC;AACtC,qDAAmC;AACnC,kDAAgC;AAChC,sDAAoC;AACpC,iDAA+B;AAC/B,4CAA0B;AAC1B,gDAA8B;AAC9B,wCAAsB;AACtB,wCAAsB;AACtB,yCAAuB"}
@@ -1 +1 @@
1
- {"version":3,"file":"duplex-connection.d.ts","sourceRoot":"","sources":["../../../src/testing/node/duplex-connection.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAqE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGhI;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB;IAClC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC,OAAO,IAAI,IAAI,CAAC;CAClB;AAED,wBAAgB,wBAAwB,IAAI,oBAAoB,CAsB/D"}
1
+ {"version":3,"file":"duplex-connection.d.ts","sourceRoot":"","sources":["../../../src/testing/node/duplex-connection.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAqE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGhI;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB;IAClC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC,OAAO,IAAI,IAAI,CAAC;CAClB;AAED,wBAAgB,wBAAwB,IAAI,oBAAoB,CAuB/D"}
@@ -17,8 +17,9 @@ function makeDuplexConnectionPair() {
17
17
  // writes and `left` reads.
18
18
  const pair = (0, duplex_stream_1.makeDuplexStreamPair)();
19
19
  const { clientToServer, serverToClient } = pair;
20
- const left = (0, node_1.createMessageConnection)(new node_1.StreamMessageReader(serverToClient), new node_1.StreamMessageWriter(clientToServer));
21
- const right = (0, node_1.createMessageConnection)(new node_1.StreamMessageReader(clientToServer), new node_1.StreamMessageWriter(serverToClient));
20
+ // `console`, so a protocol fault on either end shows in the test's output.
21
+ const left = (0, node_1.createMessageConnection)(new node_1.StreamMessageReader(serverToClient), new node_1.StreamMessageWriter(clientToServer), console);
22
+ const right = (0, node_1.createMessageConnection)(new node_1.StreamMessageReader(clientToServer), new node_1.StreamMessageWriter(serverToClient), console);
22
23
  left.listen();
23
24
  right.listen();
24
25
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"duplex-connection.js","sourceRoot":"","sources":["../../../src/testing/node/duplex-connection.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAElF,8CAAgI;AAChI,mDAAuD;AAiBvD;IACG,0EAA0E;IAC1E,yEAAyE;IACzE,2BAA2B;IAC3B,MAAM,IAAI,GAAG,IAAA,oCAAoB,GAAE,CAAC;IACpC,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;IAEhD,MAAM,IAAI,GAAG,IAAA,8BAAuB,EAAC,IAAI,0BAAmB,CAAC,cAAc,CAAC,EAAE,IAAI,0BAAmB,CAAC,cAAc,CAAC,CAAC,CAAC;IACvH,MAAM,KAAK,GAAG,IAAA,8BAAuB,EAAC,IAAI,0BAAmB,CAAC,cAAc,CAAC,EAAE,IAAI,0BAAmB,CAAC,cAAc,CAAC,CAAC,CAAC;IAExH,IAAI,CAAC,MAAM,EAAE,CAAC;IACd,KAAK,CAAC,MAAM,EAAE,CAAC;IAEf,OAAO;QACJ,IAAI;QACJ,KAAK;QACL,OAAO;YACJ,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,KAAK,CAAC,OAAO,EAAE,CAAC;YAChB,IAAI,CAAC,OAAO,EAAE,CAAC;QAClB,CAAC;KACH,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"duplex-connection.js","sourceRoot":"","sources":["../../../src/testing/node/duplex-connection.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAElF,8CAAgI;AAChI,mDAAuD;AAiBvD;IACG,0EAA0E;IAC1E,yEAAyE;IACzE,2BAA2B;IAC3B,MAAM,IAAI,GAAG,IAAA,oCAAoB,GAAE,CAAC;IACpC,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;IAEhD,2EAA2E;IAC3E,MAAM,IAAI,GAAG,IAAA,8BAAuB,EAAC,IAAI,0BAAmB,CAAC,cAAc,CAAC,EAAE,IAAI,0BAAmB,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC;IAChI,MAAM,KAAK,GAAG,IAAA,8BAAuB,EAAC,IAAI,0BAAmB,CAAC,cAAc,CAAC,EAAE,IAAI,0BAAmB,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC;IAEjI,IAAI,CAAC,MAAM,EAAE,CAAC;IACd,KAAK,CAAC,MAAM,EAAE,CAAC;IAEf,OAAO;QACJ,IAAI;QACJ,KAAK;QACL,OAAO;YACJ,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,KAAK,CAAC,OAAO,EAAE,CAAC;YAChB,IAAI,CAAC,OAAO,EAAE,CAAC;QAClB,CAAC;KACH,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hydranium/protocol",
3
- "version": "1.0.0-next.217",
3
+ "version": "1.0.0-next.218",
4
4
  "description": "Generic, language-agnostic types, constants, and pure utilities for the hydranium framework.",
5
5
  "keywords": [
6
6
  "hydranium",
@@ -46,6 +46,14 @@ export abstract class AbstractLogger implements Logger {
46
46
  return Format.timestamp(new Date(this.clock().now()));
47
47
  }
48
48
 
49
+ /**
50
+ * The `[Label - HH:MM:SS.mmm] [component]` prefix every sink starts a line
51
+ * with. The label is padded to the widest, so timestamps line up across sinks.
52
+ */
53
+ protected formatLinePrefix(label: string): string {
54
+ return `[${label.padEnd(5)} - ${this.timestamp()}]${this.component ? ` [${this.component}]` : ''}`;
55
+ }
56
+
49
57
  error(message?: string, ...args: unknown[]): this {
50
58
  this.send('error', message, args);
51
59
  return this;
@@ -0,0 +1,39 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+
10
+ import { AbstractLogger } from './abstract-logger';
11
+ import { type LogLevel, type Logger } from './logger';
12
+
13
+ /** `console.trace` prints a stack with every line, so `trace` goes out at `debug`. */
14
+ const CONSOLE_METHODS: Record<LogLevel, 'error' | 'warn' | 'info' | 'debug'> = {
15
+ error: 'error',
16
+ warn: 'warn',
17
+ info: 'info',
18
+ debug: 'debug',
19
+ trace: 'debug'
20
+ };
21
+
22
+ /**
23
+ * {@link Logger} that writes each line to `console`, at the method matching its
24
+ * level: the framework's `[Label - time] [component]` prefix and the message,
25
+ * then any trailing arguments as they are, so a browser console can expand
26
+ * them. For a browser page, webview or extension host, which has no other sink
27
+ * to hand. On Node, `info` and `debug` reach stdout, so a process whose stdout
28
+ * carries a protocol stream must not use it.
29
+ */
30
+ export class ConsoleLogger extends AbstractLogger implements Logger {
31
+ protected emit(level: LogLevel, label: string, message: string, args: readonly unknown[]): void {
32
+ console[CONSOLE_METHODS[level]](`${this.formatLinePrefix(label)} ${message}`, ...args);
33
+ }
34
+
35
+ protected derive(component: string): this {
36
+ const Subclass = this.constructor as new (component?: string) => this;
37
+ return new Subclass(component);
38
+ }
39
+ }
package/src/index.ts CHANGED
@@ -15,6 +15,7 @@
15
15
  // every production bundle that imports the root.
16
16
 
17
17
  export * from './abstract-logger';
18
+ export * from './console-logger';
18
19
  export * from './client';
19
20
  export * from './client-ids';
20
21
  export * from './clock';
@@ -32,8 +32,9 @@ export function makeDuplexConnectionPair(): DuplexConnectionPair {
32
32
  const pair = makeDuplexStreamPair();
33
33
  const { clientToServer, serverToClient } = pair;
34
34
 
35
- const left = createMessageConnection(new StreamMessageReader(serverToClient), new StreamMessageWriter(clientToServer));
36
- const right = createMessageConnection(new StreamMessageReader(clientToServer), new StreamMessageWriter(serverToClient));
35
+ // `console`, so a protocol fault on either end shows in the test's output.
36
+ const left = createMessageConnection(new StreamMessageReader(serverToClient), new StreamMessageWriter(clientToServer), console);
37
+ const right = createMessageConnection(new StreamMessageReader(clientToServer), new StreamMessageWriter(serverToClient), console);
37
38
 
38
39
  left.listen();
39
40
  right.listen();