@deepseek-ai/cordis-plugin-logger-console 1.0.1-rc.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021-present Shigma
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # @cordisjs/plugin-logger-console
2
+
3
+ Console exporter for the built-in Cordis logger service.
4
+
5
+ ## Usage
6
+
7
+ ```ts
8
+ import { Context } from 'cordis'
9
+ import ConsoleLogger from '@cordisjs/plugin-logger-console'
10
+
11
+ const root = new Context()
12
+ await root.plugin(ConsoleLogger, {
13
+ showDiff: true,
14
+ levels: {
15
+ default: 2,
16
+ hmr: 3,
17
+ },
18
+ })
19
+
20
+ root.logger('app').info('started')
21
+ ```
22
+
23
+ ## Config
24
+
25
+ | Field | Description |
26
+ | --- | --- |
27
+ | `colors` | Color support level, or `false` to disable colors. |
28
+ | `maxLength` | Maximum rendered line length before truncation. |
29
+ | `levels` | Per-logger minimum level map. |
30
+ | `showDiff` | Show elapsed time since the previous message. |
31
+ | `showTime` | Timestamp template. |
32
+ | `label` | Label width, margin, and alignment options. |
33
+
34
+ The Node entry uses `node:util.inspect` for `%o` and `%O`; the browser entry
35
+ passes log arguments through to `console`.
package/lib/browser.js ADDED
@@ -0,0 +1,80 @@
1
+ import { Logger } from "@deepseek-ai/cordis";
2
+ import { Time } from "@deepseek-ai/cosmokit";
3
+ import z from "@deepseek-ai/schemastery";
4
+ //#region lib/types/shared.js
5
+ /** Shared console log exporter implementation used by Node and browser builds. */
6
+ var ConsoleExporter$1 = class {
7
+ ctx;
8
+ static name = "logger-console";
9
+ static Config = z.object({
10
+ colors: z.union([z.const(false), z.number()]),
11
+ maxLength: z.number(),
12
+ levels: z.dict(z.number()),
13
+ showDiff: z.boolean().default(false),
14
+ showTime: z.string().default("yyyy-MM-dd hh:mm:ss "),
15
+ label: z.object({
16
+ width: z.number(),
17
+ margin: z.number(),
18
+ align: z.union(["left", "right"])
19
+ })
20
+ });
21
+ colors;
22
+ maxLength;
23
+ levels;
24
+ showDiff;
25
+ showTime;
26
+ label;
27
+ timestamp;
28
+ formatters = {};
29
+ constructor(ctx, config = {}) {
30
+ this.ctx = ctx;
31
+ Object.assign(this, this.getDefaults(), config);
32
+ this.timestamp = Date.now();
33
+ ctx.logger.exporter(this);
34
+ }
35
+ getDefaults() {
36
+ return {
37
+ colors: false,
38
+ showTime: "yyyy-MM-dd hh:mm:ss ",
39
+ showDiff: false
40
+ };
41
+ }
42
+ export(message) {
43
+ console.log(this.render(message));
44
+ }
45
+ render(message) {
46
+ const prefix = `[${message.type[0].toUpperCase()}]`;
47
+ const space = " ".repeat(this.label?.margin ?? 1);
48
+ let indent = 3 + space.length, output = "";
49
+ if (this.showTime) {
50
+ indent += this.showTime.length;
51
+ output += Logger.color(this, 8, Time.template(this.showTime));
52
+ }
53
+ const code = Logger.code(message.name, this.colors);
54
+ const label = Logger.color(this, code, message.name, ";1");
55
+ const padLength = (this.label?.width ?? 0) + label.length - message.name.length;
56
+ if (this.label?.align === "right") {
57
+ output += label.padStart(padLength) + space + prefix + space;
58
+ indent += (this.label.width ?? 0) + space.length;
59
+ } else output += prefix + space + label.padEnd(padLength) + space;
60
+ output += Logger.format(this, message).replace(/\n/g, "\n" + " ".repeat(indent));
61
+ if (this.showDiff && this.timestamp) {
62
+ const diff = message.ts - this.timestamp;
63
+ output += Logger.color(this, code, " +" + Time.format(diff));
64
+ }
65
+ this.timestamp = message.ts;
66
+ return output;
67
+ }
68
+ };
69
+ //#endregion
70
+ //#region lib/types/browser.js
71
+ /** Browser console exporter that dispatches to native console methods. */
72
+ var ConsoleExporter = class extends ConsoleExporter$1 {
73
+ export(message) {
74
+ const prefix = `[${message.type[0].toUpperCase()}] ${message.name}`;
75
+ const method = message.type === "error" ? "error" : message.type === "warn" ? "warn" : "log";
76
+ console[method](prefix, ...message.args);
77
+ }
78
+ };
79
+ //#endregion
80
+ export { ConsoleExporter, ConsoleExporter as default };
package/lib/index.js ADDED
@@ -0,0 +1,95 @@
1
+ import { inspect } from "node:util";
2
+ import supportsColor from "supports-color";
3
+ import { Logger } from "@deepseek-ai/cordis";
4
+ import { Time } from "@deepseek-ai/cosmokit";
5
+ import z from "@deepseek-ai/schemastery";
6
+ //#region lib/types/shared.js
7
+ /** Shared console log exporter implementation used by Node and browser builds. */
8
+ var ConsoleExporter$1 = class {
9
+ ctx;
10
+ static name = "logger-console";
11
+ static Config = z.object({
12
+ colors: z.union([z.const(false), z.number()]),
13
+ maxLength: z.number(),
14
+ levels: z.dict(z.number()),
15
+ showDiff: z.boolean().default(false),
16
+ showTime: z.string().default("yyyy-MM-dd hh:mm:ss "),
17
+ label: z.object({
18
+ width: z.number(),
19
+ margin: z.number(),
20
+ align: z.union(["left", "right"])
21
+ })
22
+ });
23
+ colors;
24
+ maxLength;
25
+ levels;
26
+ showDiff;
27
+ showTime;
28
+ label;
29
+ timestamp;
30
+ formatters = {};
31
+ constructor(ctx, config = {}) {
32
+ this.ctx = ctx;
33
+ Object.assign(this, this.getDefaults(), config);
34
+ this.timestamp = Date.now();
35
+ ctx.logger.exporter(this);
36
+ }
37
+ getDefaults() {
38
+ return {
39
+ colors: false,
40
+ showTime: "yyyy-MM-dd hh:mm:ss ",
41
+ showDiff: false
42
+ };
43
+ }
44
+ export(message) {
45
+ console.log(this.render(message));
46
+ }
47
+ render(message) {
48
+ const prefix = `[${message.type[0].toUpperCase()}]`;
49
+ const space = " ".repeat(this.label?.margin ?? 1);
50
+ let indent = 3 + space.length, output = "";
51
+ if (this.showTime) {
52
+ indent += this.showTime.length;
53
+ output += Logger.color(this, 8, Time.template(this.showTime));
54
+ }
55
+ const code = Logger.code(message.name, this.colors);
56
+ const label = Logger.color(this, code, message.name, ";1");
57
+ const padLength = (this.label?.width ?? 0) + label.length - message.name.length;
58
+ if (this.label?.align === "right") {
59
+ output += label.padStart(padLength) + space + prefix + space;
60
+ indent += (this.label.width ?? 0) + space.length;
61
+ } else output += prefix + space + label.padEnd(padLength) + space;
62
+ output += Logger.format(this, message).replace(/\n/g, "\n" + " ".repeat(indent));
63
+ if (this.showDiff && this.timestamp) {
64
+ const diff = message.ts - this.timestamp;
65
+ output += Logger.color(this, code, " +" + Time.format(diff));
66
+ }
67
+ this.timestamp = message.ts;
68
+ return output;
69
+ }
70
+ };
71
+ //#endregion
72
+ //#region lib/types/index.js
73
+ const inspectFormatter = (value, target) => {
74
+ return inspect(value, {
75
+ colors: !!target.colors,
76
+ depth: Infinity,
77
+ compact: true,
78
+ breakLength: Infinity
79
+ });
80
+ };
81
+ /** Node console exporter with `util.inspect` object formatting. */
82
+ var ConsoleExporter = class extends ConsoleExporter$1 {
83
+ formatters = {
84
+ o: inspectFormatter,
85
+ O: inspectFormatter
86
+ };
87
+ getDefaults() {
88
+ return {
89
+ ...super.getDefaults(),
90
+ colors: supportsColor.stdout ? supportsColor.stdout.level : 0
91
+ };
92
+ }
93
+ };
94
+ //#endregion
95
+ export { ConsoleExporter, ConsoleExporter as default };
@@ -0,0 +1,10 @@
1
+ import { Message } from '@deepseek-ai/cordis';
2
+ import { ConsoleExporter as Base } from './shared.ts';
3
+ /** Re-export shared console exporter config and base implementation. */
4
+ export * from './shared.ts';
5
+ /** Browser console exporter that dispatches to native console methods. */
6
+ export declare class ConsoleExporter extends Base {
7
+ export(message: Message): void;
8
+ }
9
+ export default ConsoleExporter;
10
+ //# sourceMappingURL=browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,EAAE,eAAe,IAAI,IAAI,EAAE,MAAM,aAAa,CAAA;AAErD,wEAAwE;AACxE,cAAc,aAAa,CAAA;AAE3B,0EAA0E;AAC1E,qBAAa,eAAgB,SAAQ,IAAI;IACvC,MAAM,CAAC,OAAO,EAAE,OAAO;CAMxB;AAED,eAAe,eAAe,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { Formatter } from '@deepseek-ai/cordis';
2
+ import { ConsoleExporter as Base } from './shared.ts';
3
+ /** Re-export shared console exporter config and base implementation. */
4
+ export * from './shared.ts';
5
+ /** Node console exporter with `util.inspect` object formatting. */
6
+ export declare class ConsoleExporter extends Base {
7
+ formatters: Record<string, Formatter>;
8
+ getDefaults(): {
9
+ colors: false | 0 | 1 | 2 | 3;
10
+ showTime: string;
11
+ showDiff: boolean;
12
+ };
13
+ }
14
+ export default ConsoleExporter;
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAG/C,OAAO,EAAE,eAAe,IAAI,IAAI,EAAE,MAAM,aAAa,CAAA;AAErD,wEAAwE;AACxE,cAAc,aAAa,CAAA;AAM3B,mEAAmE;AACnE,qBAAa,eAAgB,SAAQ,IAAI;IACvC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAGpC;IAED,WAAW;gBAG4D,KAAK,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC;;;;CAG7F;AAED,eAAe,eAAe,CAAA"}
@@ -0,0 +1,45 @@
1
+ import { Context, Exporter, Formatter, Message } from '@deepseek-ai/cordis';
2
+ import z from '@deepseek-ai/schemastery';
3
+ /** Terminal color support level compatible with supports-color. */
4
+ export type ColorSupportLevel = 0 | 1 | 2 | 3;
5
+ /** Formatting options for the logger name label. */
6
+ export interface LabelStyle {
7
+ width?: number;
8
+ margin?: number;
9
+ align?: 'left' | 'right';
10
+ }
11
+ /** Config namespace for console logger exporters. */
12
+ export declare namespace ConsoleExporter {
13
+ interface Config {
14
+ colors?: false | ColorSupportLevel;
15
+ maxLength?: number;
16
+ levels?: Record<string, number>;
17
+ showDiff?: boolean;
18
+ showTime?: string;
19
+ label?: LabelStyle;
20
+ }
21
+ }
22
+ /** Shared console log exporter implementation used by Node and browser builds. */
23
+ export declare class ConsoleExporter implements Exporter {
24
+ ctx: Context;
25
+ static readonly name = "logger-console";
26
+ static readonly Config: z<ConsoleExporter.Config>;
27
+ colors: false | ColorSupportLevel;
28
+ maxLength?: number;
29
+ levels?: Record<string, number>;
30
+ showDiff: boolean;
31
+ showTime: string;
32
+ label?: LabelStyle;
33
+ timestamp: number;
34
+ formatters: Record<string, Formatter>;
35
+ constructor(ctx: Context, config?: ConsoleExporter.Config);
36
+ getDefaults(): {
37
+ colors: false | ColorSupportLevel;
38
+ showTime: string;
39
+ showDiff: boolean;
40
+ };
41
+ export(message: Message): void;
42
+ render(message: Message): string;
43
+ }
44
+ export default ConsoleExporter;
45
+ //# sourceMappingURL=shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAU,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAEnF,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAExC,mEAAmE;AACnE,MAAM,MAAM,iBAAiB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAE7C,oDAAoD;AACpD,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CACzB;AAED,qDAAqD;AACrD,yBAAiB,eAAe,CAAC;IAC/B,UAAiB,MAAM;QACrB,MAAM,CAAC,EAAE,KAAK,GAAG,iBAAiB,CAAA;QAClC,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QAC/B,QAAQ,CAAC,EAAE,OAAO,CAAA;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,KAAK,CAAC,EAAE,UAAU,CAAA;KACnB;CACF;AAED,kFAAkF;AAClF,qBAAa,eAAgB,YAAW,QAAQ;IA0B3B,GAAG,EAAE,OAAO;IAzB/B,MAAM,CAAC,QAAQ,CAAC,IAAI,oBAAmB;IAEvC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,CAWlB;IAE/B,MAAM,EAAG,KAAK,GAAG,iBAAiB,CAAA;IAClC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,QAAQ,EAAG,OAAO,CAAA;IAClB,QAAQ,EAAG,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IAEjB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAK;gBAEvB,GAAG,EAAE,OAAO,EAAE,MAAM,GAAE,eAAe,CAAC,MAAW;IAMpE,WAAW;gBAEU,KAAK,GAAG,iBAAiB;;;;IAM9C,MAAM,CAAC,OAAO,EAAE,OAAO;IAKvB,MAAM,CAAC,OAAO,EAAE,OAAO;CAyBxB;AAED,eAAe,eAAe,CAAA"}
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@deepseek-ai/cordis-plugin-logger-console",
3
+ "description": "Console logger exporter for cordis",
4
+ "version": "1.0.1-rc.1",
5
+ "publishConfig": {
6
+ "access": "restricted"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
11
+ "directory": "vendor/logger-console"
12
+ },
13
+ "type": "module",
14
+ "main": "lib/index.js",
15
+ "types": "lib/types/shared.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./lib/types/shared.d.ts",
19
+ "node": "./lib/index.js",
20
+ "default": "./lib/browser.js"
21
+ },
22
+ "./src/*": "./src/*",
23
+ "./package.json": "./package.json"
24
+ },
25
+ "files": [
26
+ "lib/index.js",
27
+ "lib/browser.js",
28
+ "lib/types/**/*.d.ts",
29
+ "lib/types/**/*.d.ts.map",
30
+ "src"
31
+ ],
32
+ "author": "Shigma <shigma10826@gmail.com>",
33
+ "license": "MIT",
34
+ "peerDependencies": {
35
+ "@deepseek-ai/cordis": "^4.0.1-rc.1"
36
+ },
37
+ "dependencies": {
38
+ "supports-color": "^9.4.0",
39
+ "@deepseek-ai/cosmokit": "^1.8.2-rc.1",
40
+ "@deepseek-ai/schemastery": "^3.18.1-rc.1"
41
+ }
42
+ }
package/src/browser.ts ADDED
@@ -0,0 +1,17 @@
1
+ import { Message } from '@deepseek-ai/cordis'
2
+ import { ConsoleExporter as Base } from './shared.ts'
3
+
4
+ /** Re-export shared console exporter config and base implementation. */
5
+ export * from './shared.ts'
6
+
7
+ /** Browser console exporter that dispatches to native console methods. */
8
+ export class ConsoleExporter extends Base {
9
+ export(message: Message) {
10
+ const prefix = `[${message.type[0].toUpperCase()}] ${message.name}`
11
+ const method = message.type === 'error' ? 'error' : message.type === 'warn' ? 'warn' : 'log'
12
+ // eslint-disable-next-line no-console
13
+ console[method](prefix, ...message.args)
14
+ }
15
+ }
16
+
17
+ export default ConsoleExporter
package/src/index.ts ADDED
@@ -0,0 +1,28 @@
1
+ import { Formatter } from '@deepseek-ai/cordis'
2
+ import { inspect } from 'node:util'
3
+ import supportsColor from 'supports-color'
4
+ import { ConsoleExporter as Base } from './shared.ts'
5
+
6
+ /** Re-export shared console exporter config and base implementation. */
7
+ export * from './shared.ts'
8
+
9
+ const inspectFormatter: Formatter = (value, target) => {
10
+ return inspect(value, { colors: !!target.colors, depth: Infinity, compact: true, breakLength: Infinity })
11
+ }
12
+
13
+ /** Node console exporter with `util.inspect` object formatting. */
14
+ export class ConsoleExporter extends Base {
15
+ formatters: Record<string, Formatter> = {
16
+ o: inspectFormatter,
17
+ O: inspectFormatter,
18
+ }
19
+
20
+ getDefaults() {
21
+ return {
22
+ ...super.getDefaults(),
23
+ colors: (supportsColor.stdout ? supportsColor.stdout.level : 0) as false | 0 | 1 | 2 | 3,
24
+ }
25
+ }
26
+ }
27
+
28
+ export default ConsoleExporter
package/src/shared.ts ADDED
@@ -0,0 +1,100 @@
1
+ import { Context, Exporter, Formatter, Logger, Message } from '@deepseek-ai/cordis'
2
+ import { Time } from '@deepseek-ai/cosmokit'
3
+ import z from '@deepseek-ai/schemastery'
4
+
5
+ /** Terminal color support level compatible with supports-color. */
6
+ export type ColorSupportLevel = 0 | 1 | 2 | 3
7
+
8
+ /** Formatting options for the logger name label. */
9
+ export interface LabelStyle {
10
+ width?: number
11
+ margin?: number
12
+ align?: 'left' | 'right'
13
+ }
14
+
15
+ /** Config namespace for console logger exporters. */
16
+ export namespace ConsoleExporter {
17
+ export interface Config {
18
+ colors?: false | ColorSupportLevel
19
+ maxLength?: number
20
+ levels?: Record<string, number>
21
+ showDiff?: boolean
22
+ showTime?: string
23
+ label?: LabelStyle
24
+ }
25
+ }
26
+
27
+ /** Shared console log exporter implementation used by Node and browser builds. */
28
+ export class ConsoleExporter implements Exporter {
29
+ static readonly name = 'logger-console'
30
+
31
+ static readonly Config: z<ConsoleExporter.Config> = z.object({
32
+ colors: z.union([z.const(false), z.number()]),
33
+ maxLength: z.number(),
34
+ levels: z.dict(z.number()),
35
+ showDiff: z.boolean().default(false),
36
+ showTime: z.string().default('yyyy-MM-dd hh:mm:ss '),
37
+ label: z.object({
38
+ width: z.number(),
39
+ margin: z.number(),
40
+ align: z.union(['left', 'right']),
41
+ }),
42
+ }) as z<ConsoleExporter.Config>
43
+
44
+ colors!: false | ColorSupportLevel
45
+ maxLength?: number
46
+ levels?: Record<string, number>
47
+ showDiff!: boolean
48
+ showTime!: string
49
+ label?: LabelStyle
50
+ timestamp: number
51
+
52
+ formatters: Record<string, Formatter> = {}
53
+
54
+ constructor(public ctx: Context, config: ConsoleExporter.Config = {}) {
55
+ Object.assign(this, this.getDefaults(), config)
56
+ this.timestamp = Date.now()
57
+ ctx.logger.exporter(this)
58
+ }
59
+
60
+ getDefaults() {
61
+ return {
62
+ colors: false as false | ColorSupportLevel,
63
+ showTime: 'yyyy-MM-dd hh:mm:ss ',
64
+ showDiff: false,
65
+ }
66
+ }
67
+
68
+ export(message: Message) {
69
+ // eslint-disable-next-line no-console
70
+ console.log(this.render(message))
71
+ }
72
+
73
+ render(message: Message) {
74
+ const prefix = `[${message.type[0].toUpperCase()}]`
75
+ const space = ' '.repeat(this.label?.margin ?? 1)
76
+ let indent = 3 + space.length, output = ''
77
+ if (this.showTime) {
78
+ indent += this.showTime.length
79
+ output += Logger.color(this, 8, Time.template(this.showTime))
80
+ }
81
+ const code = Logger.code(message.name, this.colors)
82
+ const label = Logger.color(this, code, message.name, ';1')
83
+ const padLength = (this.label?.width ?? 0) + label.length - message.name.length
84
+ if (this.label?.align === 'right') {
85
+ output += label.padStart(padLength) + space + prefix + space
86
+ indent += (this.label.width ?? 0) + space.length
87
+ } else {
88
+ output += prefix + space + label.padEnd(padLength) + space
89
+ }
90
+ output += Logger.format(this, message).replace(/\n/g, '\n' + ' '.repeat(indent))
91
+ if (this.showDiff && this.timestamp) {
92
+ const diff = message.ts - this.timestamp
93
+ output += Logger.color(this, code, ' +' + Time.format(diff))
94
+ }
95
+ this.timestamp = message.ts
96
+ return output
97
+ }
98
+ }
99
+
100
+ export default ConsoleExporter