@holz/log-collector 0.9.2-rc.8.sha-86a8ab4 → 0.10.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.
@@ -1,37 +1,30 @@
1
- import { Log } from '@holz/core';
2
- import { LogProcessor } from '@holz/core';
3
-
4
- declare interface Config {
5
- fallback: LogProcessor;
6
- }
7
-
8
- /**
9
- * Redirects logs to a global collector if one is configured. This is designed
10
- * with apps in mind, which may want to aggregate logs from multiple sources.
11
- */
12
- export declare const createLogCollector: (config: Config) => LogProcessor;
13
-
14
- declare interface InterceptorConfig {
15
- /** Plugin handling all logs captured by the interceptor. */
16
- processor: LogProcessor;
17
- /**
18
- * Only capture logs matching this function. Return `false` to use the
19
- * default log destination. Defaults to capture all logs.
20
- */
21
- condition?: (log: Log) => boolean;
22
- }
23
-
24
- /**
25
- * Overrides the default log destination for all loggers in the app. Call this
26
- * early on startup. If logs are sent before registering the collector, they
27
- * will be lost.
28
- */
29
- export declare const setGlobalLogCollector: ({ processor, condition: match, }: InterceptorConfig) => void;
30
-
31
- /**
32
- * Remove the global log collector restoring defaults. Safe to call regardless
33
- * of whether one is set.
34
- */
35
- export declare const unsetGlobalLogCollector: () => void;
36
-
37
- export { }
1
+ import { Log, LogProcessor } from "@holz/core";
2
+ /**
3
+ * Redirects logs to a global collector if one is configured. This is designed
4
+ * with apps in mind, which may want to aggregate logs from multiple sources.
5
+ */
6
+ export declare const createLogCollector: (config: Config) => LogProcessor;
7
+ interface Config {
8
+ fallback: LogProcessor;
9
+ }
10
+ /**
11
+ * Overrides the default log destination for all loggers in the app. Call this
12
+ * early on startup. If logs are sent before registering the collector, they
13
+ * will be lost.
14
+ */
15
+ export declare const setGlobalLogCollector: ({ processor, condition: match }: InterceptorConfig) => void;
16
+ /**
17
+ * Remove the global log collector restoring defaults. Safe to call regardless
18
+ * of whether one is set.
19
+ */
20
+ export declare const unsetGlobalLogCollector: () => void;
21
+ interface InterceptorConfig {
22
+ /** Plugin handling all logs captured by the interceptor. */
23
+ processor: LogProcessor;
24
+ /**
25
+ * Only capture logs matching this function. Return `false` to use the
26
+ * default log destination. Defaults to capture all logs.
27
+ */
28
+ condition?: (log: Log) => boolean;
29
+ }
30
+ export {};
@@ -1,4 +1,4 @@
1
- //#region src/global.ts
1
+ // src/global.ts
2
2
  var e = () => !0, t = ({ processor: t, condition: n = e }) => {
3
3
  r[i] = {
4
4
  processor: t,
@@ -10,5 +10,4 @@ var e = () => !0, t = ({ processor: t, condition: n = e }) => {
10
10
  let n = r[i];
11
11
  n?.condition(t) ? n.processor(t) : e.fallback(t);
12
12
  };
13
- //#endregion
14
13
  export { a as createLogCollector, t as setGlobalLogCollector, n as unsetGlobalLogCollector };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holz/log-collector",
3
- "version": "0.9.2-rc.8.sha-86a8ab4",
3
+ "version": "0.10.0",
4
4
  "description": "Send all logs to a central collector",
5
5
  "type": "module",
6
6
  "repository": {
@@ -12,12 +12,12 @@
12
12
  ".": {
13
13
  "source": "./src/index.ts",
14
14
  "types": "./dist/holz-log-collector.d.ts",
15
- "require": "./dist/holz-log-collector.cjs",
16
- "import": "./dist/holz-log-collector.js"
15
+ "default": "./dist/holz-log-collector.js"
17
16
  }
18
17
  },
19
18
  "publishConfig": {
20
- "access": "public"
19
+ "access": "public",
20
+ "timeout": 60000
21
21
  },
22
22
  "author": "Jesse Gibson",
23
23
  "license": "MIT",
@@ -40,18 +40,16 @@
40
40
  "test:types": "tsc"
41
41
  },
42
42
  "peerDependencies": {
43
- "@holz/core": "^0.8.0 || ^0.9.0"
43
+ "@holz/core": "^0.8.0 || ^0.9.0 || ^0.10.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@holz/core": "^0.9.2-rc.8.sha-86a8ab4",
47
- "@microsoft/api-extractor": "^7.58.8",
48
- "@types/node": "^24.0.0",
46
+ "@holz/core": "^0.10.0",
47
+ "@types/node": "^26.0.0",
49
48
  "@vitest/coverage-v8": "^5.0.0",
49
+ "rolldown-plugin-dts": "^0.28.8",
50
50
  "typescript": "^6.0.0",
51
51
  "vite": "^8.0.0",
52
- "vite-plugin-dts": "^5.0.0",
53
- "vite-tsconfig-paths": "^6.0.0",
54
52
  "vitest": "^5.0.0"
55
53
  },
56
- "gitHead": "86a8ab44b6c3b61ab3d3c508711c5457b76a341f"
54
+ "gitHead": "929ed730c793ac0e8e6d0d8bb1fa9bc5dfd2a7ae"
57
55
  }
package/src/global.ts CHANGED
@@ -10,7 +10,7 @@ const MATCH_ALL = () => true;
10
10
  export const setGlobalLogCollector = ({
11
11
  processor,
12
12
  condition: match = MATCH_ALL,
13
- }: InterceptorConfig) => {
13
+ }: InterceptorConfig): void => {
14
14
  globalScope[COLLECTOR_SYMBOL] = { processor, condition: match };
15
15
  };
16
16
 
@@ -18,7 +18,7 @@ export const setGlobalLogCollector = ({
18
18
  * Remove the global log collector restoring defaults. Safe to call regardless
19
19
  * of whether one is set.
20
20
  */
21
- export const unsetGlobalLogCollector = () => {
21
+ export const unsetGlobalLogCollector = (): void => {
22
22
  delete globalScope[COLLECTOR_SYMBOL];
23
23
  };
24
24
 
@@ -38,7 +38,9 @@ export const globalScope = globalThis as unknown as GlobalContext;
38
38
 
39
39
  // Stored in the global scope. Uses the symbol registry in case multiple
40
40
  // versions of Holz are loaded in the same context.
41
- export const COLLECTOR_SYMBOL = Symbol.for('@holz/log-collector');
41
+ export const COLLECTOR_SYMBOL: unique symbol = Symbol.for(
42
+ '@holz/log-collector',
43
+ );
42
44
 
43
45
  interface GlobalContext {
44
46
  [COLLECTOR_SYMBOL]?: Required<InterceptorConfig>;
@@ -1 +0,0 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=()=>!0,t=({processor:t,condition:n=e})=>{r[i]={processor:t,condition:n}},n=()=>{delete r[i]},r=globalThis,i=Symbol.for(`@holz/log-collector`),a=e=>t=>{let n=r[i];n?.condition(t)?n.processor(t):e.fallback(t)};exports.createLogCollector=a,exports.setGlobalLogCollector=t,exports.unsetGlobalLogCollector=n;