@yadsh/dsh-plugin-log 0.1.0 → 0.2.0

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/README.md CHANGED
@@ -6,6 +6,7 @@ discovery.
6
6
 
7
7
  ```ts
8
8
  import {
9
+ createHostLoggerSink,
9
10
  getPluginLogger,
10
11
  getRegisteredPluginLoggers,
11
12
  setPluginLogFormat,
@@ -13,7 +14,10 @@ import {
13
14
  subscribePluginLoggerRegistry,
14
15
  } from "@yadsh/dsh-plugin-log";
15
16
 
16
- const log = getPluginLogger({ pluginId: "dsh-example" });
17
+ const log = getPluginLogger({
18
+ pluginId: "dsh-example",
19
+ consoleSink: createHostLoggerSink(ctx.logger),
20
+ });
17
21
  log.info("example.ready");
18
22
 
19
23
  const unsubscribe = subscribePluginLoggerRegistry((loggers) => {
@@ -0,0 +1,15 @@
1
+ import type { PluginConsoleSink } from "./plugin-logger.js";
2
+ /** Minimal DSH/Cordis host logger surface used by plugin console mirrors. */
3
+ export interface HostLoggerLike {
4
+ info(message: string, ...values: unknown[]): unknown;
5
+ warn(message: string, ...values: unknown[]): unknown;
6
+ error(message: string, ...values: unknown[]): unknown;
7
+ debug?(message: string, ...values: unknown[]): unknown;
8
+ }
9
+ /**
10
+ * Adapt a DSH/Cordis context logger to the shared plugin logger's console
11
+ * mirror. Trace falls back to debug, debug falls back to info, and fatal is
12
+ * routed through error because the host exposes four severity methods.
13
+ */
14
+ export declare function createHostLoggerSink(host: HostLoggerLike): PluginConsoleSink;
15
+ //# sourceMappingURL=host-logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-logger.d.ts","sourceRoot":"","sources":["../src/host-logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE1E,6EAA6E;AAC7E,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IACrD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IACrD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IACtD,KAAK,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;CACxD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,cAAc,GAAG,iBAAiB,CAa5E"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Adapt a DSH/Cordis context logger to the shared plugin logger's console
3
+ * mirror. Trace falls back to debug, debug falls back to info, and fatal is
4
+ * routed through error because the host exposes four severity methods.
5
+ */
6
+ export function createHostLoggerSink(host) {
7
+ return (level, message) => {
8
+ if (level === "trace" || level === "debug") {
9
+ if (typeof host.debug === "function")
10
+ host.debug(message);
11
+ else
12
+ host.info(message);
13
+ }
14
+ else if (level === "info") {
15
+ host.info(message);
16
+ }
17
+ else if (level === "warn") {
18
+ host.warn(message);
19
+ }
20
+ else {
21
+ host.error(message);
22
+ }
23
+ };
24
+ }
25
+ //# sourceMappingURL=host-logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-logger.js","sourceRoot":"","sources":["../src/host-logger.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAoB;IACvD,OAAO,CAAC,KAAmB,EAAE,OAAe,EAAQ,EAAE;QACpD,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,OAAO,EAAE,CAAC;YAC3C,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,UAAU;gBAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;;gBACrD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1B,CAAC;aAAM,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC;YAC5B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACrB,CAAC;aAAM,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC;YAC5B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACrB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACtB,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
package/lib/index.d.ts CHANGED
@@ -2,5 +2,6 @@
2
2
  * Public server-side API for `@yadsh/dsh-plugin-log`.
3
3
  */
4
4
  export * from "./dsh-home.js";
5
+ export * from "./host-logger.js";
5
6
  export * from "./plugin-logger.js";
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
package/lib/index.js CHANGED
@@ -2,5 +2,6 @@
2
2
  * Public server-side API for `@yadsh/dsh-plugin-log`.
3
3
  */
4
4
  export * from "./dsh-home.js";
5
+ export * from "./host-logger.js";
5
6
  export * from "./plugin-logger.js";
6
7
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yadsh/dsh-plugin-log",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Shared structured file logging and runtime logger discovery for DSH plugins",
5
5
  "homepage": "https://github.com/xarleyn/dsh-plugins/tree/main/packages/plugin-log#readme",
6
6
  "bugs": {
@@ -27,23 +27,15 @@
27
27
  "README.md",
28
28
  "LICENSE"
29
29
  ],
30
- "scripts": {
31
- "build": "tsc",
32
- "lint": "eslint src tests",
33
- "test": "vitest run",
34
- "typecheck": "tsc --noEmit",
35
- "prepack": "pnpm run build",
36
- "check": "pnpm run lint && pnpm run typecheck && pnpm run test && pnpm run build"
37
- },
38
30
  "dependencies": {
39
31
  "pino": "^10.3.1"
40
32
  },
41
33
  "devDependencies": {
42
- "@types/node": "catalog:tooling",
43
- "@yadsh/dsh-config": "workspace:^",
44
- "eslint": "catalog:tooling",
45
- "typescript": "catalog:tooling",
46
- "vitest": "catalog:tooling"
34
+ "@types/node": "^26.4.0",
35
+ "eslint": "10.9.1",
36
+ "typescript": "^5.9.2",
37
+ "vitest": "^4.1.11",
38
+ "@yadsh/dsh-config": "^0.0.0"
47
39
  },
48
40
  "publishConfig": {
49
41
  "access": "public",
@@ -51,5 +43,12 @@
51
43
  },
52
44
  "engines": {
53
45
  "node": ">=20"
46
+ },
47
+ "scripts": {
48
+ "build": "tsc",
49
+ "lint": "eslint src tests",
50
+ "test": "vitest run",
51
+ "typecheck": "tsc --noEmit",
52
+ "check": "pnpm run lint && pnpm run typecheck && pnpm run test && pnpm run build"
54
53
  }
55
- }
54
+ }