evlog 2.11.1 → 2.12.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.
Files changed (150) hide show
  1. package/README.md +4 -2
  2. package/dist/{_drain-YH8ERc5l.mjs → _drain-CmCtsuF6.mjs} +1 -1
  3. package/dist/{_drain-YH8ERc5l.mjs.map → _drain-CmCtsuF6.mjs.map} +1 -1
  4. package/dist/{_http-C_2wbJw3.mjs → _http-CHSsrWDJ.mjs} +2 -2
  5. package/dist/{_http-C_2wbJw3.mjs.map → _http-CHSsrWDJ.mjs.map} +1 -1
  6. package/dist/{_severity-BZhz3f9e.mjs → _severity-CQijvfhU.mjs} +1 -1
  7. package/dist/{_severity-BZhz3f9e.mjs.map → _severity-CQijvfhU.mjs.map} +1 -1
  8. package/dist/adapters/axiom.d.mts +1 -1
  9. package/dist/adapters/axiom.mjs +2 -2
  10. package/dist/adapters/better-stack.d.mts +1 -1
  11. package/dist/adapters/better-stack.mjs +2 -2
  12. package/dist/adapters/datadog.d.mts +1 -1
  13. package/dist/adapters/datadog.mjs +2 -2
  14. package/dist/adapters/fs.d.mts +1 -1
  15. package/dist/adapters/fs.mjs +1 -1
  16. package/dist/adapters/hyperdx.d.mts +1 -1
  17. package/dist/adapters/hyperdx.mjs +2 -2
  18. package/dist/adapters/otlp.d.mts +1 -1
  19. package/dist/adapters/otlp.mjs +3 -3
  20. package/dist/adapters/posthog.d.mts +1 -1
  21. package/dist/adapters/posthog.mjs +2 -2
  22. package/dist/adapters/sentry.d.mts +1 -1
  23. package/dist/adapters/sentry.mjs +3 -3
  24. package/dist/ai/index.d.mts +144 -5
  25. package/dist/ai/index.d.mts.map +1 -1
  26. package/dist/ai/index.mjs +108 -5
  27. package/dist/ai/index.mjs.map +1 -1
  28. package/dist/browser.d.mts +13 -52
  29. package/dist/browser.d.mts.map +1 -1
  30. package/dist/browser.mjs +5 -81
  31. package/dist/browser.mjs.map +1 -1
  32. package/dist/client.d.mts +2 -2
  33. package/dist/client.mjs +2 -2
  34. package/dist/{dist-BFn8qsRC.mjs → dist-Do8P4zWd.mjs} +1 -1
  35. package/dist/{dist-BFn8qsRC.mjs.map → dist-Do8P4zWd.mjs.map} +1 -1
  36. package/dist/elysia/index.d.mts +2 -2
  37. package/dist/elysia/index.mjs +1 -1
  38. package/dist/enrichers.d.mts +1 -1
  39. package/dist/{error-plrBYLQk.d.mts → error-WRz4_F3W.d.mts} +2 -2
  40. package/dist/{error-plrBYLQk.d.mts.map → error-WRz4_F3W.d.mts.map} +1 -1
  41. package/dist/error.d.mts +1 -1
  42. package/dist/{errors-gH4C9KSC.mjs → errors-BJRXUfMg.mjs} +1 -1
  43. package/dist/{errors-gH4C9KSC.mjs.map → errors-BJRXUfMg.mjs.map} +1 -1
  44. package/dist/{errors-bPoj9UZk.d.mts → errors-J2kt7mZh.d.mts} +2 -2
  45. package/dist/{errors-bPoj9UZk.d.mts.map → errors-J2kt7mZh.d.mts.map} +1 -1
  46. package/dist/express/index.d.mts +2 -2
  47. package/dist/express/index.mjs +2 -2
  48. package/dist/fastify/index.d.mts +2 -2
  49. package/dist/fastify/index.mjs +2 -2
  50. package/dist/{headers-BSi3UHKL.mjs → headers-ht4yS2mx.mjs} +6 -4
  51. package/dist/headers-ht4yS2mx.mjs.map +1 -0
  52. package/dist/hono/index.d.mts +2 -2
  53. package/dist/hono/index.mjs +1 -1
  54. package/dist/http.d.mts +65 -0
  55. package/dist/http.d.mts.map +1 -0
  56. package/dist/http.mjs +94 -0
  57. package/dist/http.mjs.map +1 -0
  58. package/dist/index.d.mts +7 -6
  59. package/dist/index.mjs +3 -2
  60. package/dist/{logger-CG1eop2_.d.mts → logger-Bm0k3Hf3.d.mts} +2 -2
  61. package/dist/{logger-CG1eop2_.d.mts.map → logger-Bm0k3Hf3.d.mts.map} +1 -1
  62. package/dist/logger-DY0X5oQd.mjs +704 -0
  63. package/dist/logger-DY0X5oQd.mjs.map +1 -0
  64. package/dist/logger.d.mts +1 -1
  65. package/dist/logger.mjs +1 -361
  66. package/dist/{middleware-DojmTj9Y.d.mts → middleware-D_igVy93.d.mts} +9 -2
  67. package/dist/middleware-D_igVy93.d.mts.map +1 -0
  68. package/dist/nestjs/index.d.mts +2 -2
  69. package/dist/nestjs/index.mjs +2 -2
  70. package/dist/next/client.d.mts +9 -3
  71. package/dist/next/client.d.mts.map +1 -1
  72. package/dist/next/client.mjs +5 -3
  73. package/dist/next/client.mjs.map +1 -1
  74. package/dist/next/index.d.mts +9 -4
  75. package/dist/next/index.d.mts.map +1 -1
  76. package/dist/next/index.mjs +3 -2
  77. package/dist/next/index.mjs.map +1 -1
  78. package/dist/next/instrumentation.d.mts +3 -1
  79. package/dist/next/instrumentation.d.mts.map +1 -1
  80. package/dist/next/instrumentation.mjs +2 -1
  81. package/dist/next/instrumentation.mjs.map +1 -1
  82. package/dist/nitro/errorHandler.mjs +2 -2
  83. package/dist/nitro/module.d.mts +2 -2
  84. package/dist/nitro/plugin.mjs +7 -4
  85. package/dist/nitro/plugin.mjs.map +1 -1
  86. package/dist/nitro/v3/errorHandler.mjs +3 -3
  87. package/dist/nitro/v3/index.d.mts +2 -2
  88. package/dist/nitro/v3/module.d.mts +1 -1
  89. package/dist/nitro/v3/plugin.mjs +8 -5
  90. package/dist/nitro/v3/plugin.mjs.map +1 -1
  91. package/dist/nitro/v3/useLogger.d.mts +1 -1
  92. package/dist/{nitro-CfGx0wDJ.d.mts → nitro-BeRXZcBd.d.mts} +13 -2
  93. package/dist/nitro-BeRXZcBd.d.mts.map +1 -0
  94. package/dist/{nitro-Dpq5ZmcM.mjs → nitro-OmT_M4Pb.mjs} +2 -2
  95. package/dist/nitro-OmT_M4Pb.mjs.map +1 -0
  96. package/dist/{nitroConfigBridge-fidbf-Y_.mjs → nitroConfigBridge-C37lXaNm.mjs} +1 -1
  97. package/dist/{nitroConfigBridge-fidbf-Y_.mjs.map → nitroConfigBridge-C37lXaNm.mjs.map} +1 -1
  98. package/dist/nuxt/module.d.mts +26 -1
  99. package/dist/nuxt/module.d.mts.map +1 -1
  100. package/dist/nuxt/module.mjs +7 -2
  101. package/dist/nuxt/module.mjs.map +1 -1
  102. package/dist/{parseError-B_qXj8x4.d.mts → parseError-DhXS_vzM.d.mts} +2 -2
  103. package/dist/parseError-DhXS_vzM.d.mts.map +1 -0
  104. package/dist/react-router/index.d.mts +2 -2
  105. package/dist/react-router/index.mjs +2 -2
  106. package/dist/{routes-CE3_c-iZ.mjs → routes-CGPmbzCZ.mjs} +1 -1
  107. package/dist/{routes-CE3_c-iZ.mjs.map → routes-CGPmbzCZ.mjs.map} +1 -1
  108. package/dist/runtime/client/log.d.mts +7 -2
  109. package/dist/runtime/client/log.d.mts.map +1 -1
  110. package/dist/runtime/client/log.mjs +24 -6
  111. package/dist/runtime/client/log.mjs.map +1 -1
  112. package/dist/runtime/client/plugin.mjs +1 -0
  113. package/dist/runtime/client/plugin.mjs.map +1 -1
  114. package/dist/runtime/server/routes/_evlog/ingest.post.mjs +1 -1
  115. package/dist/runtime/server/useLogger.d.mts +1 -1
  116. package/dist/runtime/utils/parseError.d.mts +2 -2
  117. package/dist/runtime/utils/parseError.mjs +1 -1
  118. package/dist/{source-location-B1VVgXkh.mjs → source-location-DRvDDqfq.mjs} +1 -1
  119. package/dist/{source-location-B1VVgXkh.mjs.map → source-location-DRvDDqfq.mjs.map} +1 -1
  120. package/dist/{storage-B6NPh8rV.mjs → storage-DpLJYMoc.mjs} +1 -1
  121. package/dist/{storage-B6NPh8rV.mjs.map → storage-DpLJYMoc.mjs.map} +1 -1
  122. package/dist/sveltekit/index.d.mts +2 -2
  123. package/dist/sveltekit/index.mjs +4 -4
  124. package/dist/toolkit.d.mts +3 -3
  125. package/dist/toolkit.mjs +4 -4
  126. package/dist/{types-v_JkG_D7.d.mts → types-D5OwxZCw.d.mts} +71 -2
  127. package/dist/types-D5OwxZCw.d.mts.map +1 -0
  128. package/dist/types.d.mts +2 -2
  129. package/dist/{useLogger-TjKH37BO.d.mts → useLogger-Dcj1Nrsa.d.mts} +2 -2
  130. package/dist/{useLogger-TjKH37BO.d.mts.map → useLogger-Dcj1Nrsa.d.mts.map} +1 -1
  131. package/dist/utils-Bnc95-VC.d.mts +54 -0
  132. package/dist/utils-Bnc95-VC.d.mts.map +1 -0
  133. package/dist/utils.d.mts +2 -50
  134. package/dist/utils.mjs +13 -1
  135. package/dist/utils.mjs.map +1 -1
  136. package/dist/vite/index.d.mts +5 -1
  137. package/dist/vite/index.d.mts.map +1 -1
  138. package/dist/vite/index.mjs +3 -1
  139. package/dist/vite/index.mjs.map +1 -1
  140. package/dist/workers.d.mts +1 -1
  141. package/dist/workers.mjs +1 -1
  142. package/package.json +9 -1
  143. package/dist/headers-BSi3UHKL.mjs.map +0 -1
  144. package/dist/logger.mjs.map +0 -1
  145. package/dist/middleware-DojmTj9Y.d.mts.map +0 -1
  146. package/dist/nitro-CfGx0wDJ.d.mts.map +0 -1
  147. package/dist/nitro-Dpq5ZmcM.mjs.map +0 -1
  148. package/dist/parseError-B_qXj8x4.d.mts.map +0 -1
  149. package/dist/types-v_JkG_D7.d.mts.map +0 -1
  150. package/dist/utils.d.mts.map +0 -1
package/dist/types.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { C as TailSamplingContext, S as TailSamplingCondition, T as WideEvent, _ as RequestLoggerOptions, a as EnvironmentContext, b as SamplingRates, c as H3EventContext, d as Log, f as LogLevel, g as RequestLogger, h as RequestLogEntry, i as EnrichContext, l as IngestPayload, m as ParsedError, n as DeepPartial, o as ErrorOptions, p as LoggerConfig, r as DrainContext, s as FieldContext, t as BaseWideEvent, u as InternalFields, v as RouteConfig, w as TransportConfig, x as ServerEvent, y as SamplingConfig } from "./types-v_JkG_D7.mjs";
2
- export { BaseWideEvent, DeepPartial, DrainContext, EnrichContext, EnvironmentContext, ErrorOptions, FieldContext, H3EventContext, IngestPayload, InternalFields, Log, LogLevel, LoggerConfig, ParsedError, RequestLogEntry, RequestLogger, RequestLoggerOptions, RouteConfig, SamplingConfig, SamplingRates, ServerEvent, TailSamplingCondition, TailSamplingContext, TransportConfig, WideEvent };
1
+ import { C as TailSamplingCondition, E as WideEvent, S as ServerEvent, T as TransportConfig, _ as RequestLogger, a as EnvironmentContext, b as SamplingConfig, c as H3EventContext, d as Log, f as LogLevel, g as RequestLogEntry, h as RedactConfig, i as EnrichContext, l as IngestPayload, m as ParsedError, n as DeepPartial, o as ErrorOptions, p as LoggerConfig, r as DrainContext, s as FieldContext, t as BaseWideEvent, u as InternalFields, v as RequestLoggerOptions, w as TailSamplingContext, x as SamplingRates, y as RouteConfig } from "./types-D5OwxZCw.mjs";
2
+ export { BaseWideEvent, DeepPartial, DrainContext, EnrichContext, EnvironmentContext, ErrorOptions, FieldContext, H3EventContext, IngestPayload, InternalFields, Log, LogLevel, LoggerConfig, ParsedError, RedactConfig, RequestLogEntry, RequestLogger, RequestLoggerOptions, RouteConfig, SamplingConfig, SamplingRates, ServerEvent, TailSamplingCondition, TailSamplingContext, TransportConfig, WideEvent };
@@ -1,4 +1,4 @@
1
- import { g as RequestLogger, x as ServerEvent } from "./types-v_JkG_D7.mjs";
1
+ import { S as ServerEvent, _ as RequestLogger } from "./types-D5OwxZCw.mjs";
2
2
 
3
3
  //#region src/runtime/server/useLogger.d.ts
4
4
  /**
@@ -36,4 +36,4 @@ import { g as RequestLogger, x as ServerEvent } from "./types-v_JkG_D7.mjs";
36
36
  declare function useLogger<T extends object = Record<string, unknown>>(event: ServerEvent, service?: string): RequestLogger<T>;
37
37
  //#endregion
38
38
  export { useLogger as t };
39
- //# sourceMappingURL=useLogger-TjKH37BO.d.mts.map
39
+ //# sourceMappingURL=useLogger-Dcj1Nrsa.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLogger-TjKH37BO.d.mts","names":[],"sources":["../src/runtime/server/useLogger.ts"],"mappings":";;;;;AAkCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAgB,SAAA,oBAA6B,MAAA,kBAAA,CAAyB,KAAA,EAAO,WAAA,EAAa,OAAA,YAAmB,aAAA,CAAc,CAAA"}
1
+ {"version":3,"file":"useLogger-Dcj1Nrsa.d.mts","names":[],"sources":["../src/runtime/server/useLogger.ts"],"mappings":";;;;;AAkCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAgB,SAAA,oBAA6B,MAAA,kBAAA,CAAyB,KAAA,EAAO,WAAA,EAAa,OAAA,YAAmB,aAAA,CAAc,CAAA"}
@@ -0,0 +1,54 @@
1
+ import { a as EnvironmentContext, f as LogLevel } from "./types-D5OwxZCw.mjs";
2
+
3
+ //#region src/utils.d.ts
4
+ declare function formatDuration(ms: number): string;
5
+ declare function isServer(): boolean;
6
+ declare function isClient(): boolean;
7
+ declare function isDev(): boolean;
8
+ declare function detectEnvironment(): Partial<EnvironmentContext>;
9
+ /**
10
+ * True if `level` is at least as severe as `minLevel` (debug < info < warn < error).
11
+ */
12
+ declare function isLevelEnabled(level: LogLevel, minLevel: LogLevel): boolean;
13
+ declare function getConsoleMethod(level: LogLevel): LogLevel;
14
+ declare const colors: {
15
+ readonly reset: "\u001B[0m";
16
+ readonly bold: "\u001B[1m";
17
+ readonly dim: "\u001B[2m";
18
+ readonly red: "\u001B[31m";
19
+ readonly green: "\u001B[32m";
20
+ readonly yellow: "\u001B[33m";
21
+ readonly blue: "\u001B[34m";
22
+ readonly magenta: "\u001B[35m";
23
+ readonly cyan: "\u001B[36m";
24
+ readonly white: "\u001B[37m";
25
+ readonly gray: "\u001B[90m";
26
+ };
27
+ declare function getLevelColor(level: string): string;
28
+ declare const cssColors: {
29
+ readonly dim: "color: #6b7280";
30
+ readonly red: "color: #ef4444; font-weight: bold";
31
+ readonly green: "color: #22c55e";
32
+ readonly yellow: "color: #f59e0b; font-weight: bold";
33
+ readonly cyan: "color: #06b6d4; font-weight: bold";
34
+ readonly gray: "color: #6b7280; font-weight: bold";
35
+ readonly reset: "color: inherit; font-weight: normal";
36
+ };
37
+ declare function getCssLevelColor(level: string): string;
38
+ /**
39
+ * Escape `%` in strings interpolated into `console.log` format strings
40
+ * to prevent `%c`, `%s`, `%d` etc. in user data from being interpreted
41
+ * as formatting directives.
42
+ */
43
+ declare function escapeFormatString(str: string): string;
44
+ /** Headers that should never be passed to hooks for security */
45
+ declare const SENSITIVE_HEADERS: string[];
46
+ declare function filterSafeHeaders(headers: Record<string, string>): Record<string, string>;
47
+ /**
48
+ * Match a path against a glob pattern.
49
+ * Supports * (any chars except /) and ** (any chars including /).
50
+ */
51
+ declare function matchesPattern(path: string, pattern: string): boolean;
52
+ //#endregion
53
+ export { escapeFormatString as a, getConsoleMethod as c, isClient as d, isDev as f, matchesPattern as h, detectEnvironment as i, getCssLevelColor as l, isServer as m, colors as n, filterSafeHeaders as o, isLevelEnabled as p, cssColors as r, formatDuration as s, SENSITIVE_HEADERS as t, getLevelColor as u };
54
+ //# sourceMappingURL=utils-Bnc95-VC.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-Bnc95-VC.d.mts","names":[],"sources":["../src/utils.ts"],"mappings":";;;iBAEgB,cAAA,CAAe,EAAA;AAAA,iBAOf,QAAA,CAAA;AAAA,iBAIA,QAAA,CAAA;AAAA,iBAIA,KAAA,CAAA;AAAA,iBAUA,iBAAA,CAAA,GAAqB,OAAA,CAAQ,kBAAA;;;AAlB7C;iBA+CgB,cAAA,CAAe,KAAA,EAAO,QAAA,EAAU,QAAA,EAAU,QAAA;AAAA,iBAI1C,gBAAA,CAAiB,KAAA,EAAO,QAAA,GAAW,QAAA;AAAA,cAItC,MAAA;EAAA;;;;;;;;;;;;iBAgBG,aAAA,CAAc,KAAA;AAAA,cAIjB,SAAA;EAAA;;;;;;;;iBAYG,gBAAA,CAAiB,KAAA;;;;AApCjC;;iBA6CgB,kBAAA,CAAmB,GAAA;;cAKtB,iBAAA;AAAA,iBASG,iBAAA,CAAkB,OAAA,EAAS,MAAA,mBAAyB,MAAA;;;;AAvDpE;iBAyEgB,cAAA,CAAe,IAAA,UAAc,OAAA"}
package/dist/utils.d.mts CHANGED
@@ -1,50 +1,2 @@
1
- import { a as EnvironmentContext, f as LogLevel } from "./types-v_JkG_D7.mjs";
2
-
3
- //#region src/utils.d.ts
4
- declare function formatDuration(ms: number): string;
5
- declare function isServer(): boolean;
6
- declare function isClient(): boolean;
7
- declare function isDev(): boolean;
8
- declare function detectEnvironment(): Partial<EnvironmentContext>;
9
- declare function getConsoleMethod(level: LogLevel): LogLevel;
10
- declare const colors: {
11
- readonly reset: "\u001B[0m";
12
- readonly bold: "\u001B[1m";
13
- readonly dim: "\u001B[2m";
14
- readonly red: "\u001B[31m";
15
- readonly green: "\u001B[32m";
16
- readonly yellow: "\u001B[33m";
17
- readonly blue: "\u001B[34m";
18
- readonly magenta: "\u001B[35m";
19
- readonly cyan: "\u001B[36m";
20
- readonly white: "\u001B[37m";
21
- readonly gray: "\u001B[90m";
22
- };
23
- declare function getLevelColor(level: string): string;
24
- declare const cssColors: {
25
- readonly dim: "color: #6b7280";
26
- readonly red: "color: #ef4444; font-weight: bold";
27
- readonly green: "color: #22c55e";
28
- readonly yellow: "color: #f59e0b; font-weight: bold";
29
- readonly cyan: "color: #06b6d4; font-weight: bold";
30
- readonly gray: "color: #6b7280; font-weight: bold";
31
- readonly reset: "color: inherit; font-weight: normal";
32
- };
33
- declare function getCssLevelColor(level: string): string;
34
- /**
35
- * Escape `%` in strings interpolated into `console.log` format strings
36
- * to prevent `%c`, `%s`, `%d` etc. in user data from being interpreted
37
- * as formatting directives.
38
- */
39
- declare function escapeFormatString(str: string): string;
40
- /** Headers that should never be passed to hooks for security */
41
- declare const SENSITIVE_HEADERS: string[];
42
- declare function filterSafeHeaders(headers: Record<string, string>): Record<string, string>;
43
- /**
44
- * Match a path against a glob pattern.
45
- * Supports * (any chars except /) and ** (any chars including /).
46
- */
47
- declare function matchesPattern(path: string, pattern: string): boolean;
48
- //#endregion
49
- export { SENSITIVE_HEADERS, colors, cssColors, detectEnvironment, escapeFormatString, filterSafeHeaders, formatDuration, getConsoleMethod, getCssLevelColor, getLevelColor, isClient, isDev, isServer, matchesPattern };
50
- //# sourceMappingURL=utils.d.mts.map
1
+ import { a as escapeFormatString, c as getConsoleMethod, d as isClient, f as isDev, h as matchesPattern, i as detectEnvironment, l as getCssLevelColor, m as isServer, n as colors, o as filterSafeHeaders, p as isLevelEnabled, r as cssColors, s as formatDuration, t as SENSITIVE_HEADERS, u as getLevelColor } from "./utils-Bnc95-VC.mjs";
2
+ export { SENSITIVE_HEADERS, colors, cssColors, detectEnvironment, escapeFormatString, filterSafeHeaders, formatDuration, getConsoleMethod, getCssLevelColor, getLevelColor, isClient, isDev, isLevelEnabled, isServer, matchesPattern };
package/dist/utils.mjs CHANGED
@@ -25,6 +25,18 @@ function detectEnvironment() {
25
25
  region: env.VERCEL_REGION || env.AWS_REGION || env.FLY_REGION || env.CF_REGION
26
26
  };
27
27
  }
28
+ const LEVEL_ORDER = {
29
+ debug: 0,
30
+ info: 1,
31
+ warn: 2,
32
+ error: 3
33
+ };
34
+ /**
35
+ * True if `level` is at least as severe as `minLevel` (debug < info < warn < error).
36
+ */
37
+ function isLevelEnabled(level, minLevel) {
38
+ return LEVEL_ORDER[level] >= LEVEL_ORDER[minLevel];
39
+ }
28
40
  function getConsoleMethod(level) {
29
41
  return level;
30
42
  }
@@ -105,6 +117,6 @@ function matchesPattern(path, pattern) {
105
117
  return regex.test(path);
106
118
  }
107
119
  //#endregion
108
- export { SENSITIVE_HEADERS, colors, cssColors, detectEnvironment, escapeFormatString, filterSafeHeaders, formatDuration, getConsoleMethod, getCssLevelColor, getLevelColor, isClient, isDev, isServer, matchesPattern };
120
+ export { SENSITIVE_HEADERS, colors, cssColors, detectEnvironment, escapeFormatString, filterSafeHeaders, formatDuration, getConsoleMethod, getCssLevelColor, getLevelColor, isClient, isDev, isLevelEnabled, isServer, matchesPattern };
109
121
 
110
122
  //# sourceMappingURL=utils.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import type { EnvironmentContext, LogLevel } from './types'\n\nexport function formatDuration(ms: number): string {\n if (ms < 1000) {\n return `${Math.round(ms)}ms`\n }\n return `${(ms / 1000).toFixed(2)}s`\n}\n\nexport function isServer(): boolean {\n return typeof window === 'undefined'\n}\n\nexport function isClient(): boolean {\n return typeof window !== 'undefined'\n}\n\nexport function isDev(): boolean {\n if (typeof process !== 'undefined') {\n return process.env.NODE_ENV !== 'production'\n }\n if (typeof window !== 'undefined') {\n return true\n }\n return false\n}\n\nexport function detectEnvironment(): Partial<EnvironmentContext> {\n const env = typeof process !== 'undefined' ? process.env : {}\n const defaultEnvironment = isDev() ? 'development' : 'production'\n\n return {\n environment: env.NODE_ENV || defaultEnvironment,\n service: env.SERVICE_NAME || 'app',\n version: env.APP_VERSION,\n commitHash: env.COMMIT_SHA\n || env.GITHUB_SHA\n || env.VERCEL_GIT_COMMIT_SHA\n || env.CF_PAGES_COMMIT_SHA,\n region: env.VERCEL_REGION\n || env.AWS_REGION\n || env.FLY_REGION\n || env.CF_REGION,\n }\n}\n\nexport function getConsoleMethod(level: LogLevel): LogLevel {\n return level\n}\n\nexport const colors = {\n reset: '\\x1B[0m',\n bold: '\\x1B[1m',\n dim: '\\x1B[2m',\n red: '\\x1B[31m',\n green: '\\x1B[32m',\n yellow: '\\x1B[33m',\n blue: '\\x1B[34m',\n magenta: '\\x1B[35m',\n cyan: '\\x1B[36m',\n white: '\\x1B[37m',\n gray: '\\x1B[90m',\n} as const\n\nconst levelColorMap: Record<string, string> = { error: colors.red, warn: colors.yellow, info: colors.cyan, debug: colors.gray }\n\nexport function getLevelColor(level: string): string {\n return levelColorMap[level] ?? colors.white\n}\n\nexport const cssColors = {\n dim: 'color: #6b7280',\n red: 'color: #ef4444; font-weight: bold',\n green: 'color: #22c55e',\n yellow: 'color: #f59e0b; font-weight: bold',\n cyan: 'color: #06b6d4; font-weight: bold',\n gray: 'color: #6b7280; font-weight: bold',\n reset: 'color: inherit; font-weight: normal',\n} as const\n\nconst cssLevelColorMap: Record<string, string> = { error: cssColors.red, warn: cssColors.yellow, info: cssColors.cyan, debug: cssColors.gray }\n\nexport function getCssLevelColor(level: string): string {\n return cssLevelColorMap[level] ?? cssColors.reset\n}\n\n/**\n * Escape `%` in strings interpolated into `console.log` format strings\n * to prevent `%c`, `%s`, `%d` etc. in user data from being interpreted\n * as formatting directives.\n */\nexport function escapeFormatString(str: string): string {\n return str.replace(/%/g, '%%')\n}\n\n/** Headers that should never be passed to hooks for security */\nexport const SENSITIVE_HEADERS = [\n 'authorization',\n 'cookie',\n 'set-cookie',\n 'x-api-key',\n 'x-auth-token',\n 'proxy-authorization',\n]\n\nexport function filterSafeHeaders(headers: Record<string, string>): Record<string, string> {\n const safeHeaders: Record<string, string> = {}\n\n for (const [key, value] of Object.entries(headers)) {\n if (!SENSITIVE_HEADERS.includes(key.toLowerCase())) {\n safeHeaders[key] = value\n }\n }\n\n return safeHeaders\n}\n\nconst patternCache = new Map<string, RegExp>()\n\n/**\n * Match a path against a glob pattern.\n * Supports * (any chars except /) and ** (any chars including /).\n */\nexport function matchesPattern(path: string, pattern: string): boolean {\n let regex = patternCache.get(pattern)\n if (!regex) {\n const regexPattern = pattern\n .replace(/[.+^${}()|[\\]\\\\]/g, '\\\\$&')\n .replace(/\\*\\*/g, '{{GLOBSTAR}}')\n .replace(/\\*/g, '[^/]*')\n .replace(/{{GLOBSTAR}}/g, '.*')\n .replace(/\\?/g, '[^/]')\n regex = new RegExp(`^${regexPattern}$`)\n patternCache.set(pattern, regex)\n }\n return regex.test(path)\n}\n"],"mappings":";AAEA,SAAgB,eAAe,IAAoB;AACjD,KAAI,KAAK,IACP,QAAO,GAAG,KAAK,MAAM,GAAG,CAAC;AAE3B,QAAO,IAAI,KAAK,KAAM,QAAQ,EAAE,CAAC;;AAGnC,SAAgB,WAAoB;AAClC,QAAO,OAAO,WAAW;;AAG3B,SAAgB,WAAoB;AAClC,QAAO,OAAO,WAAW;;AAG3B,SAAgB,Q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AAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,QAAQ,CAChD,KAAI,CAAC,kBAAkB,SAAS,IAAI,aAAa,CAAC,CAChD,aAAY,OAAO;AAIvB,QAAO;;AAGT,MAAM,+BAAe,IAAI,KAAqB;;;;;AAM9C,SAAgB,eAAe,MAAc,SAA0B;CACrE,IAAI,QAAQ,aAAa,IAAI,QAAQ;AACrC,KAAI,CAAC,OAAO;EACV,MAAM,eAAe,QAClB,QAAQ,qBAAqB,OAAO,CACpC,QAAQ,SAAS,eAAe,CAChC,QAAQ,OAAO,QAAQ,CACvB,QAAQ,iBAAiB,KAAK,CAC9B,QAAQ,OAAO,OAAO;AACzB,UAAQ,IAAI,OAAO,IAAI,aAAa,GAAG;AACvC,eAAa,IAAI,SAAS,MAAM;;AAElC,QAAO,MAAM,KAAK,KAAK"}
1
+ {"version":3,"file":"utils.mjs","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import type { EnvironmentContext, LogLevel } from './types'\n\nexport function formatDuration(ms: number): string {\n if (ms < 1000) {\n return `${Math.round(ms)}ms`\n }\n return `${(ms / 1000).toFixed(2)}s`\n}\n\nexport function isServer(): boolean {\n return typeof window === 'undefined'\n}\n\nexport function isClient(): boolean {\n return typeof window !== 'undefined'\n}\n\nexport function isDev(): boolean {\n if (typeof process !== 'undefined') {\n return process.env.NODE_ENV !== 'production'\n }\n if (typeof window !== 'undefined') {\n return true\n }\n return false\n}\n\nexport function detectEnvironment(): Partial<EnvironmentContext> {\n const env = typeof process !== 'undefined' ? process.env : {}\n const defaultEnvironment = isDev() ? 'development' : 'production'\n\n return {\n environment: env.NODE_ENV || defaultEnvironment,\n service: env.SERVICE_NAME || 'app',\n version: env.APP_VERSION,\n commitHash: env.COMMIT_SHA\n || env.GITHUB_SHA\n || env.VERCEL_GIT_COMMIT_SHA\n || env.CF_PAGES_COMMIT_SHA,\n region: env.VERCEL_REGION\n || env.AWS_REGION\n || env.FLY_REGION\n || env.CF_REGION,\n }\n}\n\nconst LEVEL_ORDER: Record<LogLevel, number> = {\n debug: 0,\n info: 1,\n warn: 2,\n error: 3,\n}\n\n/**\n * True if `level` is at least as severe as `minLevel` (debug < info < warn < error).\n */\nexport function isLevelEnabled(level: LogLevel, minLevel: LogLevel): boolean {\n return LEVEL_ORDER[level] >= LEVEL_ORDER[minLevel]\n}\n\nexport function getConsoleMethod(level: LogLevel): LogLevel {\n return level\n}\n\nexport const colors = {\n reset: '\\x1B[0m',\n bold: '\\x1B[1m',\n dim: '\\x1B[2m',\n red: '\\x1B[31m',\n green: '\\x1B[32m',\n yellow: '\\x1B[33m',\n blue: '\\x1B[34m',\n magenta: '\\x1B[35m',\n cyan: '\\x1B[36m',\n white: '\\x1B[37m',\n gray: '\\x1B[90m',\n} as const\n\nconst levelColorMap: Record<string, string> = { error: colors.red, warn: colors.yellow, info: colors.cyan, debug: colors.gray }\n\nexport function getLevelColor(level: string): string {\n return levelColorMap[level] ?? colors.white\n}\n\nexport const cssColors = {\n dim: 'color: #6b7280',\n red: 'color: #ef4444; font-weight: bold',\n green: 'color: #22c55e',\n yellow: 'color: #f59e0b; font-weight: bold',\n cyan: 'color: #06b6d4; font-weight: bold',\n gray: 'color: #6b7280; font-weight: bold',\n reset: 'color: inherit; font-weight: normal',\n} as const\n\nconst cssLevelColorMap: Record<string, string> = { error: cssColors.red, warn: cssColors.yellow, info: cssColors.cyan, debug: cssColors.gray }\n\nexport function getCssLevelColor(level: string): string {\n return cssLevelColorMap[level] ?? cssColors.reset\n}\n\n/**\n * Escape `%` in strings interpolated into `console.log` format strings\n * to prevent `%c`, `%s`, `%d` etc. in user data from being interpreted\n * as formatting directives.\n */\nexport function escapeFormatString(str: string): string {\n return str.replace(/%/g, '%%')\n}\n\n/** Headers that should never be passed to hooks for security */\nexport const SENSITIVE_HEADERS = [\n 'authorization',\n 'cookie',\n 'set-cookie',\n 'x-api-key',\n 'x-auth-token',\n 'proxy-authorization',\n]\n\nexport function filterSafeHeaders(headers: Record<string, string>): Record<string, string> {\n const safeHeaders: Record<string, string> = {}\n\n for (const [key, value] of Object.entries(headers)) {\n if (!SENSITIVE_HEADERS.includes(key.toLowerCase())) {\n safeHeaders[key] = value\n }\n }\n\n return safeHeaders\n}\n\nconst patternCache = new Map<string, RegExp>()\n\n/**\n * Match a path against a glob pattern.\n * Supports * (any chars except /) and ** (any chars including /).\n */\nexport function matchesPattern(path: string, pattern: string): boolean {\n let regex = patternCache.get(pattern)\n if (!regex) {\n const regexPattern = pattern\n .replace(/[.+^${}()|[\\]\\\\]/g, '\\\\$&')\n .replace(/\\*\\*/g, '{{GLOBSTAR}}')\n .replace(/\\*/g, '[^/]*')\n .replace(/{{GLOBSTAR}}/g, '.*')\n .replace(/\\?/g, '[^/]')\n regex = new RegExp(`^${regexPattern}$`)\n patternCache.set(pattern, regex)\n }\n return regex.test(path)\n}\n"],"mappings":";AAEA,SAAgB,eAAe,IAAoB;AACjD,KAAI,KAAK,IACP,QAAO,GAAG,KAAK,MAAM,GAAG,CAAC;AAE3B,QAAO,IAAI,KAAK,KAAM,QAAQ,EAAE,CAAC;;AAGnC,SAAgB,WAAoB;AAClC,QAAO,OAAO,WAAW;;AAG3B,SAAgB,WAAoB;AAClC,QAAO,OAAO,WAAW;;AAG3B,SAAgB,QAAiB;AAC/B,KAAI,OAAO,YAAY,YACrB,QAAO,QAAQ,IAAI,aAAa;AAElC,KAAI,OAAO,WAAW,YACpB,QAAO;AAET,QAAO;;AAGT,SAAgB,oBAAiD;CAC/D,MAAM,MAAM,OAAO,YAAY,cAAc,QAAQ,MAAM,EAAE;CAC7D,MAAM,qBAAqB,OAAO,GAAG,gBAAgB;AAErD,QAAO;EACL,aAAa,IAAI,YAAY;EAC7B,SAAS,IAAI,gBAAgB;EAC7B,SAAS,IAAI;EACb,YAAY,IAAI,cACX,IAAI,cACJ,IAAI,yBACJ,IAAI;EACT,QAAQ,IAAI,iBACP,IAAI,cACJ,IAAI,cACJ,IAAI;EACV;;AAGH,MAAM,cAAwC;CAC5C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CACpC,QAAQ,SAAS,eAAe,CAChC,QAAQ,OAAO,QAAQ,CACvB,QAAQ,iBAAiB,KAAK,CAC9B,QAAQ,OAAO,OAAO;AACzB,UAAQ,IAAI,OAAO,IAAI,aAAa,GAAG;AACvC,eAAa,IAAI,SAAS,MAAM;;AAElC,QAAO,MAAM,KAAK,KAAK"}
@@ -1,4 +1,4 @@
1
- import { f as LogLevel, w as TransportConfig, y as SamplingConfig } from "../types-v_JkG_D7.mjs";
1
+ import { T as TransportConfig, b as SamplingConfig, f as LogLevel } from "../types-D5OwxZCw.mjs";
2
2
  import { Plugin } from "vite";
3
3
 
4
4
  //#region src/vite/types.d.ts
@@ -15,6 +15,8 @@ interface ClientOptions {
15
15
  pretty?: boolean;
16
16
  /** Enable console output on client @default true */
17
17
  console?: boolean;
18
+ /** Minimum severity for client `log` calls (debug < info < warn < error) @default 'debug' */
19
+ minLevel?: LogLevel;
18
20
  /** Transport configuration for sending client logs to the server */
19
21
  transport?: TransportConfig;
20
22
  }
@@ -31,6 +33,8 @@ interface EvlogViteOptions {
31
33
  silent?: boolean;
32
34
  /** Sampling configuration */
33
35
  sampling?: SamplingConfig;
36
+ /** Minimum severity for the global `log` API (not request wide events) @default 'debug' */
37
+ minLevel?: LogLevel;
34
38
  /** Emit JSON strings or raw objects @default true */
35
39
  stringify?: boolean;
36
40
  /** Opt-in auto-imports for log, createEvlogError, parseError */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/vite/types.ts","../../src/vite/auto-init.ts","../../src/vite/auto-imports.ts","../../src/vite/client-inject.ts","../../src/vite/strip.ts","../../src/vite/source-location.ts","../../src/vite/index.ts"],"mappings":";;;;UAEiB,kBAAA;;EAEf,OAAA;EAFe;EAIf,GAAA;AAAA;AAAA,UAGe,aAAA;EAHZ;EAKH,OAAA;EAF4B;EAI5B,MAAA;EAI2B;EAF3B,OAAA;EAFA;EAIA,SAAA,GAAY,eAAA;AAAA;AAAA,UAGG,gBAAA;EAHY;EAK3B,OAAA;EAFe;EAIf,WAAA;;EAEA,OAAA;EAUwB;EARxB,MAAA;EAcS;EAZT,MAAA;EAYsB;EAVtB,QAAA,GAAW,cAAA;EARX;EAUA,SAAA;EANA;EAQA,WAAA,aAAwB,kBAAA;EAJxB;EAMA,KAAA,GAAQ,QAAA;EAJR;EAMA,cAAA;EAJwB;EAMxB,MAAA,GAAS,aAAA;AAAA;;;iBCvCK,oBAAA,CAAqB,OAAA,EAAS,gBAAA,GAAmB,MAAA;;;iBCejD,uBAAA,CAAwB,OAAA,GAAS,kBAAA,GAA0B,MAAA;;;iBCf3D,wBAAA,CAAyB,aAAA,EAAe,aAAA,GAAgB,MAAA;;;iBCExD,iBAAA,CAAkB,MAAA,EAAQ,QAAA,KAAa,MAAA;;;iBCAvC,0BAAA,CAA2B,OAAA,aAAoB,MAAA;;;;;ALH/D;;;;;AAOA;;;;;;;;iBMcwB,KAAA,CAAM,OAAA,GAAS,gBAAA,GAAwB,MAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/vite/types.ts","../../src/vite/auto-init.ts","../../src/vite/auto-imports.ts","../../src/vite/client-inject.ts","../../src/vite/strip.ts","../../src/vite/source-location.ts","../../src/vite/index.ts"],"mappings":";;;;UAEiB,kBAAA;;EAEf,OAAA;EAFe;EAIf,GAAA;AAAA;AAAA,UAGe,aAAA;EAHZ;EAKH,OAAA;EAF4B;EAI5B,MAAA;EAM2B;EAJ3B,OAAA;EAFA;EAIA,QAAA,GAAW,QAAA;EAAX;EAEA,SAAA,GAAY,eAAA;AAAA;AAAA,UAGG,gBAAA;EAHY;EAK3B,OAAA;EAFe;EAIf,WAAA;;EAEA,OAAA;EAQW;EANX,MAAA;EAYQ;EAVR,MAAA;EAcsB;EAZtB,QAAA,GAAW,cAAA;EAVX;EAYA,QAAA,GAAW,QAAA;EARX;EAUA,SAAA;EANA;EAQA,WAAA,aAAwB,kBAAA;EANb;EAQX,KAAA,GAAQ,QAAA;EANG;EAQX,cAAA;EAJA;EAMA,MAAA,GAAS,aAAA;AAAA;;;iBC3CK,oBAAA,CAAqB,OAAA,EAAS,gBAAA,GAAmB,MAAA;;;iBCejD,uBAAA,CAAwB,OAAA,GAAS,kBAAA,GAA0B,MAAA;;;iBCf3D,wBAAA,CAAyB,aAAA,EAAe,aAAA,GAAgB,MAAA;;;iBCExD,iBAAA,CAAkB,MAAA,EAAQ,QAAA,KAAa,MAAA;;;iBCAvC,0BAAA,CAA2B,OAAA,aAAoB,MAAA;;;;;ALH/D;;;;;AAOA;;;;;;;;iBMcwB,KAAA,CAAM,OAAA,GAAS,gBAAA,GAAwB,MAAA"}
@@ -1,4 +1,4 @@
1
- import { a as walk, i as shouldTransform, n as createStripPlugin, o as MagicString, r as TRANSFORM_FILTER, t as createSourceLocationPlugin } from "../source-location-B1VVgXkh.mjs";
1
+ import { a as walk, i as shouldTransform, n as createStripPlugin, o as MagicString, r as TRANSFORM_FILTER, t as createSourceLocationPlugin } from "../source-location-DRvDDqfq.mjs";
2
2
  import { resolve } from "node:path";
3
3
  import { existsSync, writeFileSync } from "node:fs";
4
4
  //#region src/vite/auto-init.ts
@@ -21,6 +21,7 @@ function buildConfig(options) {
21
21
  if (options.pretty !== void 0) config.pretty = options.pretty;
22
22
  if (options.silent !== void 0) config.silent = options.silent;
23
23
  if (options.sampling) config.sampling = options.sampling;
24
+ if (options.minLevel !== void 0) config.minLevel = options.minLevel;
24
25
  if (options.stringify !== void 0) config.stringify = options.stringify;
25
26
  return config;
26
27
  }
@@ -164,6 +165,7 @@ function createClientInjectPlugin(clientOptions) {
164
165
  config.service = clientOptions.service ?? "client";
165
166
  if (clientOptions.console !== void 0) config.console = clientOptions.console;
166
167
  config.pretty = clientOptions.pretty ?? isDev;
168
+ if (clientOptions.minLevel !== void 0) config.minLevel = clientOptions.minLevel;
167
169
  if (clientOptions.transport) config.transport = clientOptions.transport;
168
170
  return [{
169
171
  tag: "script",
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/vite/auto-init.ts","../../src/vite/auto-imports.ts","../../src/vite/client-inject.ts","../../src/vite/index.ts"],"sourcesContent":["import type { Plugin } from 'vite'\nimport type { EvlogViteOptions } from './types'\n\nexport function createAutoInitPlugin(options: EvlogViteOptions): Plugin {\n const config = buildConfig(options)\n\n return {\n name: 'evlog:auto-init',\n config() {\n return {\n define: {\n __EVLOG_CONFIG__: JSON.stringify(config),\n },\n }\n },\n }\n}\n\nfunction buildConfig(options: EvlogViteOptions): Record<string, unknown> {\n const env: Record<string, unknown> = {}\n if (options.service) env.service = options.service\n if (options.environment) env.environment = options.environment\n\n const config: Record<string, unknown> = {}\n if (Object.keys(env).length > 0) config.env = env\n if (options.enabled !== undefined) config.enabled = options.enabled\n if (options.pretty !== undefined) config.pretty = options.pretty\n if (options.silent !== undefined) config.silent = options.silent\n if (options.sampling) config.sampling = options.sampling\n if (options.stringify !== undefined) config.stringify = options.stringify\n\n return config\n}\n","import { existsSync, writeFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport type { Plugin } from 'vite'\nimport MagicString from 'magic-string'\nimport type { AutoImportsOptions } from './types'\nimport { TRANSFORM_FILTER, shouldTransform, walk } from './utils'\n\nconst DEFAULT_IMPORTS = ['log', 'createEvlogError', 'parseError']\nconst LOG_METHODS = ['info', 'error', 'warn', 'debug']\n\nconst IMPORT_SOURCES: Record<string, string> = {\n log: 'evlog',\n createEvlogError: 'evlog',\n parseError: 'evlog',\n setIdentity: 'evlog/client',\n clearIdentity: 'evlog/client',\n}\n\nexport function createAutoImportsPlugin(options: AutoImportsOptions = {}): Plugin {\n const symbols = options.imports ?? DEFAULT_IMPORTS\n\n return {\n name: 'evlog:auto-imports',\n\n configResolved(config) {\n if (options.dts === false) return\n if (typeof options.dts === 'string') {\n writeFileSync(resolve(config.root, options.dts), generateDts(symbols))\n return\n }\n const srcDir = resolve(config.root, 'src')\n const dir = existsSync(srcDir) ? srcDir : config.root\n writeFileSync(resolve(dir, 'auto-imports.d.ts'), generateDts(symbols))\n },\n\n transform: {\n filter: TRANSFORM_FILTER,\n handler(code, id) {\n if (!shouldTransform(id)) return\n if (!symbols.some(s => code.includes(s))) return\n\n let ast: any\n try {\n ast = (this as any).parse(code)\n } catch {\n return\n }\n\n const declared = collectTopLevelDeclarations(ast)\n const needed = detectUsedSymbols(ast, symbols, declared)\n\n if (needed.size === 0) return\n\n const grouped = groupBySource(needed)\n const s = new MagicString(code)\n\n for (const [source, names] of grouped) {\n s.prepend(`import { ${names.join(', ')} } from '${source}'\\n`)\n }\n\n return { code: s.toString(), map: s.generateMap({ hires: true }) }\n },\n },\n }\n}\n\nfunction collectBindingNames(pattern: any, out: Set<string>): void {\n if (!pattern) return\n if (pattern.type === 'Identifier') {\n out.add(pattern.name)\n } else if (pattern.type === 'ObjectPattern') {\n for (const prop of pattern.properties) {\n collectBindingNames(prop.type === 'RestElement' ? prop.argument : prop.value, out)\n }\n } else if (pattern.type === 'ArrayPattern') {\n for (const el of pattern.elements) {\n if (el) collectBindingNames(el, out)\n }\n } else if (pattern.type === 'AssignmentPattern') {\n collectBindingNames(pattern.left, out)\n } else if (pattern.type === 'RestElement') {\n collectBindingNames(pattern.argument, out)\n }\n}\n\nfunction collectTopLevelDeclarations(ast: any): Set<string> {\n const declared = new Set<string>()\n for (const node of ast.body) {\n if (node.type === 'VariableDeclaration') {\n for (const decl of node.declarations) {\n collectBindingNames(decl.id, declared)\n }\n }\n if (node.type === 'FunctionDeclaration' && node.id?.name) {\n declared.add(node.id.name)\n }\n if (node.type === 'ImportDeclaration') {\n for (const spec of node.specifiers ?? []) {\n if (spec.local?.name) declared.add(spec.local.name)\n }\n }\n }\n return declared\n}\n\nfunction detectUsedSymbols(ast: any, symbols: string[], declared: Set<string>): Set<string> {\n const needed = new Set<string>()\n\n walk(ast, (node: any) => {\n if (\n symbols.includes('log')\n && !declared.has('log')\n && node.type === 'MemberExpression'\n && node.object?.type === 'Identifier'\n && node.object.name === 'log'\n && node.property?.type === 'Identifier'\n && LOG_METHODS.includes(node.property.name)\n ) {\n needed.add('log')\n }\n\n if (\n node.type === 'CallExpression'\n && node.callee?.type === 'Identifier'\n && symbols.includes(node.callee.name)\n && !declared.has(node.callee.name)\n ) {\n needed.add(node.callee.name)\n }\n })\n\n return needed\n}\n\nfunction groupBySource(symbols: Set<string>): Map<string, string[]> {\n const map = new Map<string, string[]>()\n for (const sym of symbols) {\n const source = IMPORT_SOURCES[sym] ?? 'evlog'\n const list = map.get(source) ?? []\n list.push(sym)\n map.set(source, list)\n }\n return map\n}\n\nfunction generateDts(symbols: string[]): string {\n const lines = [\n '/* eslint-disable */',\n '// Generated by evlog/vite — do not edit',\n 'export {}',\n 'declare global {',\n ]\n\n for (const sym of symbols) {\n switch (sym) {\n case 'log':\n lines.push(' const log: import(\\'evlog\\').Log')\n break\n case 'createEvlogError':\n lines.push(' const createEvlogError: typeof import(\\'evlog\\').createEvlogError')\n break\n case 'parseError':\n lines.push(' const parseError: typeof import(\\'evlog\\').parseError')\n break\n case 'setIdentity':\n lines.push(' const setIdentity: (identity: Record<string, unknown>) => void')\n break\n case 'clearIdentity':\n lines.push(' const clearIdentity: () => void')\n break\n default:\n lines.push(` const ${sym}: typeof import('evlog').${sym}`)\n break\n }\n }\n\n lines.push('}', '')\n return lines.join('\\n')\n}\n","import type { Plugin } from 'vite'\nimport type { ClientOptions } from './types'\n\nexport function createClientInjectPlugin(clientOptions: ClientOptions): Plugin {\n let isDev = true\n\n return {\n name: 'evlog:client-inject',\n\n configResolved(config) {\n isDev = config.command === 'serve'\n },\n\n transformIndexHtml() {\n const config: Record<string, unknown> = {}\n config.service = clientOptions.service ?? 'client'\n if (clientOptions.console !== undefined) config.console = clientOptions.console\n config.pretty = clientOptions.pretty ?? isDev\n if (clientOptions.transport) config.transport = clientOptions.transport\n\n const configJson = JSON.stringify(config)\n\n return [\n {\n tag: 'script',\n attrs: { type: 'module' },\n children: `import{initLog}from'evlog/client'\\ninitLog(${configJson})`,\n injectTo: 'head-prepend',\n },\n ]\n },\n }\n}\n","import type { Plugin } from 'vite'\nimport type { EvlogViteOptions } from './types'\nimport { createAutoInitPlugin } from './auto-init'\nimport { createAutoImportsPlugin } from './auto-imports'\nimport { createClientInjectPlugin } from './client-inject'\nimport { createStripPlugin } from './strip'\nimport { createSourceLocationPlugin } from './source-location'\n\n/**\n * evlog Vite plugin — brings Nuxt-level DX to any Vite-based framework.\n *\n * @example\n * ```ts\n * // vite.config.ts\n * import evlog from 'evlog/vite'\n *\n * export default defineConfig({\n * plugins: [\n * evlog({ service: 'my-app' }),\n * ],\n * })\n * ```\n */\nexport default function evlog(options: EvlogViteOptions = {}): Plugin[] {\n const plugins: Plugin[] = []\n\n plugins.push(createAutoInitPlugin(options))\n\n if (options.autoImports) {\n const autoImportOpts = typeof options.autoImports === 'object' ? options.autoImports : {}\n plugins.push(createAutoImportsPlugin(autoImportOpts))\n }\n\n if (options.client) {\n plugins.push(createClientInjectPlugin(options.client))\n }\n\n const stripLevels = options.strip ?? ['debug']\n if (stripLevels.length > 0) {\n plugins.push(createStripPlugin(stripLevels))\n }\n\n if (options.sourceLocation) {\n const enabled = options.sourceLocation === 'dev' ? undefined : true\n plugins.push(createSourceLocationPlugin(enabled))\n }\n\n return plugins\n}\n\nexport { createAutoInitPlugin } from './auto-init'\nexport { createAutoImportsPlugin } from './auto-imports'\nexport { createClientInjectPlugin } from './client-inject'\nexport { createStripPlugin } from './strip'\nexport { createSourceLocationPlugin } from './source-location'\nexport type { EvlogViteOptions, AutoImportsOptions, ClientOptions } from './types'\n"],"mappings":";;;;AAGA,SAAgB,qBAAqB,SAAmC;CACtE,MAAM,SAAS,YAAY,QAAQ;AAEnC,QAAO;EACL,MAAM;EACN,SAAS;AACP,UAAO,EACL,QAAQ,EACN,kBAAkB,KAAK,UAAU,OAAO,EACzC,EACF;;EAEJ;;AAGH,SAAS,YAAY,SAAoD;CACvE,MAAM,MAA+B,EAAE;AACvC,KAAI,QAAQ,QAAS,KAAI,UAAU,QAAQ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AAEZ,QAAO;EACL,MAAM;EAEN,eAAe,QAAQ;AACrB,WAAQ,OAAO,YAAY;;EAG7B,qBAAqB;GACnB,MAAM,SAAkC,EAAE;AAC1C,UAAO,UAAU,cAAc,WAAW;AAC1C,OAAI,cAAc,YAAY,KAAA,EAAW,QAAO,UAAU,cAAc;AACxE,UAAO,SAAS,cAAc,UAAU;AACxC,OAAI,cAAc,UAAW,QAAO,YAAY,cAAc;AAI9D,UAAO,CACL;IACE,KAAK;IACL,OAAO,EAAE,MAAM,UAAU;IACzB,UAAU,8CANK,KAAK,UAAU,OAAO,CAM8B;IACnE,UAAU;IACX,CACF;;EAEJ;;;;;;;;;;;;;;;;;;;ACRH,SAAwB,MAAM,UAA4B,EAAE,EAAY;CACtE,MAAM,UAAoB,EAAE;AAE5B,SAAQ,KAAK,qBAAqB,QAAQ,CAAC;AAE3C,KAAI,QAAQ,aAAa;EACvB,MAAM,iBAAiB,OAAO,QAAQ,gBAAgB,WAAW,QAAQ,cAAc,EAAE;AACzF,UAAQ,KAAK,wBAAwB,eAAe,CAAC;;AAGvD,KAAI,QAAQ,OACV,SAAQ,KAAK,yBAAyB,QAAQ,OAAO,CAAC;CAGxD,MAAM,cAAc,QAAQ,SAAS,CAAC,QAAQ;AAC9C,KAAI,YAAY,SAAS,EACvB,SAAQ,KAAK,kBAAkB,YAAY,CAAC;AAG9C,KAAI,QAAQ,gBAAgB;EAC1B,MAAM,UAAU,QAAQ,mBAAmB,QAAQ,KAAA,IAAY;AAC/D,UAAQ,KAAK,2BAA2B,QAAQ,CAAC;;AAGnD,QAAO"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/vite/auto-init.ts","../../src/vite/auto-imports.ts","../../src/vite/client-inject.ts","../../src/vite/index.ts"],"sourcesContent":["import type { Plugin } from 'vite'\nimport type { EvlogViteOptions } from './types'\n\nexport function createAutoInitPlugin(options: EvlogViteOptions): Plugin {\n const config = buildConfig(options)\n\n return {\n name: 'evlog:auto-init',\n config() {\n return {\n define: {\n __EVLOG_CONFIG__: JSON.stringify(config),\n },\n }\n },\n }\n}\n\nfunction buildConfig(options: EvlogViteOptions): Record<string, unknown> {\n const env: Record<string, unknown> = {}\n if (options.service) env.service = options.service\n if (options.environment) env.environment = options.environment\n\n const config: Record<string, unknown> = {}\n if (Object.keys(env).length > 0) config.env = env\n if (options.enabled !== undefined) config.enabled = options.enabled\n if (options.pretty !== undefined) config.pretty = options.pretty\n if (options.silent !== undefined) config.silent = options.silent\n if (options.sampling) config.sampling = options.sampling\n if (options.minLevel !== undefined) config.minLevel = options.minLevel\n if (options.stringify !== undefined) config.stringify = options.stringify\n\n return config\n}\n","import { existsSync, writeFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport type { Plugin } from 'vite'\nimport MagicString from 'magic-string'\nimport type { AutoImportsOptions } from './types'\nimport { TRANSFORM_FILTER, shouldTransform, walk } from './utils'\n\nconst DEFAULT_IMPORTS = ['log', 'createEvlogError', 'parseError']\nconst LOG_METHODS = ['info', 'error', 'warn', 'debug']\n\nconst IMPORT_SOURCES: Record<string, string> = {\n log: 'evlog',\n createEvlogError: 'evlog',\n parseError: 'evlog',\n setIdentity: 'evlog/client',\n clearIdentity: 'evlog/client',\n}\n\nexport function createAutoImportsPlugin(options: AutoImportsOptions = {}): Plugin {\n const symbols = options.imports ?? DEFAULT_IMPORTS\n\n return {\n name: 'evlog:auto-imports',\n\n configResolved(config) {\n if (options.dts === false) return\n if (typeof options.dts === 'string') {\n writeFileSync(resolve(config.root, options.dts), generateDts(symbols))\n return\n }\n const srcDir = resolve(config.root, 'src')\n const dir = existsSync(srcDir) ? srcDir : config.root\n writeFileSync(resolve(dir, 'auto-imports.d.ts'), generateDts(symbols))\n },\n\n transform: {\n filter: TRANSFORM_FILTER,\n handler(code, id) {\n if (!shouldTransform(id)) return\n if (!symbols.some(s => code.includes(s))) return\n\n let ast: any\n try {\n ast = (this as any).parse(code)\n } catch {\n return\n }\n\n const declared = collectTopLevelDeclarations(ast)\n const needed = detectUsedSymbols(ast, symbols, declared)\n\n if (needed.size === 0) return\n\n const grouped = groupBySource(needed)\n const s = new MagicString(code)\n\n for (const [source, names] of grouped) {\n s.prepend(`import { ${names.join(', ')} } from '${source}'\\n`)\n }\n\n return { code: s.toString(), map: s.generateMap({ hires: true }) }\n },\n },\n }\n}\n\nfunction collectBindingNames(pattern: any, out: Set<string>): void {\n if (!pattern) return\n if (pattern.type === 'Identifier') {\n out.add(pattern.name)\n } else if (pattern.type === 'ObjectPattern') {\n for (const prop of pattern.properties) {\n collectBindingNames(prop.type === 'RestElement' ? prop.argument : prop.value, out)\n }\n } else if (pattern.type === 'ArrayPattern') {\n for (const el of pattern.elements) {\n if (el) collectBindingNames(el, out)\n }\n } else if (pattern.type === 'AssignmentPattern') {\n collectBindingNames(pattern.left, out)\n } else if (pattern.type === 'RestElement') {\n collectBindingNames(pattern.argument, out)\n }\n}\n\nfunction collectTopLevelDeclarations(ast: any): Set<string> {\n const declared = new Set<string>()\n for (const node of ast.body) {\n if (node.type === 'VariableDeclaration') {\n for (const decl of node.declarations) {\n collectBindingNames(decl.id, declared)\n }\n }\n if (node.type === 'FunctionDeclaration' && node.id?.name) {\n declared.add(node.id.name)\n }\n if (node.type === 'ImportDeclaration') {\n for (const spec of node.specifiers ?? []) {\n if (spec.local?.name) declared.add(spec.local.name)\n }\n }\n }\n return declared\n}\n\nfunction detectUsedSymbols(ast: any, symbols: string[], declared: Set<string>): Set<string> {\n const needed = new Set<string>()\n\n walk(ast, (node: any) => {\n if (\n symbols.includes('log')\n && !declared.has('log')\n && node.type === 'MemberExpression'\n && node.object?.type === 'Identifier'\n && node.object.name === 'log'\n && node.property?.type === 'Identifier'\n && LOG_METHODS.includes(node.property.name)\n ) {\n needed.add('log')\n }\n\n if (\n node.type === 'CallExpression'\n && node.callee?.type === 'Identifier'\n && symbols.includes(node.callee.name)\n && !declared.has(node.callee.name)\n ) {\n needed.add(node.callee.name)\n }\n })\n\n return needed\n}\n\nfunction groupBySource(symbols: Set<string>): Map<string, string[]> {\n const map = new Map<string, string[]>()\n for (const sym of symbols) {\n const source = IMPORT_SOURCES[sym] ?? 'evlog'\n const list = map.get(source) ?? []\n list.push(sym)\n map.set(source, list)\n }\n return map\n}\n\nfunction generateDts(symbols: string[]): string {\n const lines = [\n '/* eslint-disable */',\n '// Generated by evlog/vite — do not edit',\n 'export {}',\n 'declare global {',\n ]\n\n for (const sym of symbols) {\n switch (sym) {\n case 'log':\n lines.push(' const log: import(\\'evlog\\').Log')\n break\n case 'createEvlogError':\n lines.push(' const createEvlogError: typeof import(\\'evlog\\').createEvlogError')\n break\n case 'parseError':\n lines.push(' const parseError: typeof import(\\'evlog\\').parseError')\n break\n case 'setIdentity':\n lines.push(' const setIdentity: (identity: Record<string, unknown>) => void')\n break\n case 'clearIdentity':\n lines.push(' const clearIdentity: () => void')\n break\n default:\n lines.push(` const ${sym}: typeof import('evlog').${sym}`)\n break\n }\n }\n\n lines.push('}', '')\n return lines.join('\\n')\n}\n","import type { Plugin } from 'vite'\nimport type { ClientOptions } from './types'\n\nexport function createClientInjectPlugin(clientOptions: ClientOptions): Plugin {\n let isDev = true\n\n return {\n name: 'evlog:client-inject',\n\n configResolved(config) {\n isDev = config.command === 'serve'\n },\n\n transformIndexHtml() {\n const config: Record<string, unknown> = {}\n config.service = clientOptions.service ?? 'client'\n if (clientOptions.console !== undefined) config.console = clientOptions.console\n config.pretty = clientOptions.pretty ?? isDev\n if (clientOptions.minLevel !== undefined) config.minLevel = clientOptions.minLevel\n if (clientOptions.transport) config.transport = clientOptions.transport\n\n const configJson = JSON.stringify(config)\n\n return [\n {\n tag: 'script',\n attrs: { type: 'module' },\n children: `import{initLog}from'evlog/client'\\ninitLog(${configJson})`,\n injectTo: 'head-prepend',\n },\n ]\n },\n }\n}\n","import type { Plugin } from 'vite'\nimport type { EvlogViteOptions } from './types'\nimport { createAutoInitPlugin } from './auto-init'\nimport { createAutoImportsPlugin } from './auto-imports'\nimport { createClientInjectPlugin } from './client-inject'\nimport { createStripPlugin } from './strip'\nimport { createSourceLocationPlugin } from './source-location'\n\n/**\n * evlog Vite plugin — brings Nuxt-level DX to any Vite-based framework.\n *\n * @example\n * ```ts\n * // vite.config.ts\n * import evlog from 'evlog/vite'\n *\n * export default defineConfig({\n * plugins: [\n * evlog({ service: 'my-app' }),\n * ],\n * })\n * ```\n */\nexport default function evlog(options: EvlogViteOptions = {}): Plugin[] {\n const plugins: Plugin[] = []\n\n plugins.push(createAutoInitPlugin(options))\n\n if (options.autoImports) {\n const autoImportOpts = typeof options.autoImports === 'object' ? options.autoImports : {}\n plugins.push(createAutoImportsPlugin(autoImportOpts))\n }\n\n if (options.client) {\n plugins.push(createClientInjectPlugin(options.client))\n }\n\n const stripLevels = options.strip ?? ['debug']\n if (stripLevels.length > 0) {\n plugins.push(createStripPlugin(stripLevels))\n }\n\n if (options.sourceLocation) {\n const enabled = options.sourceLocation === 'dev' ? undefined : true\n plugins.push(createSourceLocationPlugin(enabled))\n }\n\n return plugins\n}\n\nexport { createAutoInitPlugin } from './auto-init'\nexport { createAutoImportsPlugin } from './auto-imports'\nexport { createClientInjectPlugin } from './client-inject'\nexport { createStripPlugin } from './strip'\nexport { createSourceLocationPlugin } from './source-location'\nexport type { EvlogViteOptions, AutoImportsOptions, ClientOptions } from './types'\n"],"mappings":";;;;AAGA,SAAgB,qBAAqB,SAAmC;CACtE,MAAM,SAAS,YAAY,QAAQ;AAEnC,QAAO;EACL,MAAM;EACN,SAAS;AACP,UAAO,EACL,QAAQ,EACN,kBAAkB,KAAK,UAAU,OAAO,EACzC,EACF;;EAEJ;;AAGH,SAAS,YAAY,SAAoD;CACvE,MAAM,MAA+B,EAAE;AACvC,KAAI,QAAQ,QAAS,KAAI,UAAU,QAAQ;AAC3C,KAAI,QAAQ,YAAa,KAAI,cAAc,QAAQ;CAEnD,MAAM,SAAkC,EAAE;AAC1C,KAAI,OAAO,KAAK,IAAI,CAAC,SAAS,EAAG,QAAO,MAAM;AAC9C,KA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ACnB,MAAM,SAAkC,EAAE;AAC1C,UAAO,UAAU,cAAc,WAAW;AAC1C,OAAI,cAAc,YAAY,KAAA,EAAW,QAAO,UAAU,cAAc;AACxE,UAAO,SAAS,cAAc,UAAU;AACxC,OAAI,cAAc,aAAa,KAAA,EAAW,QAAO,WAAW,cAAc;AAC1E,OAAI,cAAc,UAAW,QAAO,YAAY,cAAc;AAI9D,UAAO,CACL;IACE,KAAK;IACL,OAAO,EAAE,MAAM,UAAU;IACzB,UAAU,8CANK,KAAK,UAAU,OAAO,CAM8B;IACnE,UAAU;IACX,CACF;;EAEJ;;;;;;;;;;;;;;;;;;;ACTH,SAAwB,MAAM,UAA4B,EAAE,EAAY;CACtE,MAAM,UAAoB,EAAE;AAE5B,SAAQ,KAAK,qBAAqB,QAAQ,CAAC;AAE3C,KAAI,QAAQ,aAAa;EACvB,MAAM,iBAAiB,OAAO,QAAQ,gBAAgB,WAAW,QAAQ,cAAc,EAAE;AACzF,UAAQ,KAAK,wBAAwB,eAAe,CAAC;;AAGvD,KAAI,QAAQ,OACV,SAAQ,KAAK,yBAAyB,QAAQ,OAAO,CAAC;CAGxD,MAAM,cAAc,QAAQ,SAAS,CAAC,QAAQ;AAC9C,KAAI,YAAY,SAAS,EACvB,SAAQ,KAAK,kBAAkB,YAAY,CAAC;AAG9C,KAAI,QAAQ,gBAAgB;EAC1B,MAAM,UAAU,QAAQ,mBAAmB,QAAQ,KAAA,IAAY;AAC/D,UAAQ,KAAK,2BAA2B,QAAQ,CAAC;;AAGnD,QAAO"}
@@ -1,4 +1,4 @@
1
- import { g as RequestLogger, p as LoggerConfig } from "./types-v_JkG_D7.mjs";
1
+ import { _ as RequestLogger, p as LoggerConfig } from "./types-D5OwxZCw.mjs";
2
2
 
3
3
  //#region src/workers/index.d.ts
4
4
  /**
package/dist/workers.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { createRequestLogger, initLogger } from "./logger.mjs";
1
+ import { o as initLogger, r as createRequestLogger } from "./logger-DY0X5oQd.mjs";
2
2
  //#region src/workers/index.ts
3
3
  function isRecord(value) {
4
4
  return typeof value === "object" && value !== null && !Array.isArray(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evlog",
3
- "version": "2.11.1",
3
+ "version": "2.12.0",
4
4
  "description": "Wide event logging library with structured error handling. Inspired by LoggingSucks.",
5
5
  "author": "HugoRCD <contact@hrcd.fr>",
6
6
  "homepage": "https://evlog.dev",
@@ -109,6 +109,11 @@
109
109
  "import": "./dist/pipeline.mjs",
110
110
  "default": "./dist/pipeline.mjs"
111
111
  },
112
+ "./http": {
113
+ "types": "./dist/http.d.mts",
114
+ "import": "./dist/http.mjs",
115
+ "default": "./dist/http.mjs"
116
+ },
112
117
  "./browser": {
113
118
  "types": "./dist/browser.d.mts",
114
119
  "import": "./dist/browser.mjs",
@@ -234,6 +239,9 @@
234
239
  "pipeline": [
235
240
  "./dist/pipeline.d.mts"
236
241
  ],
242
+ "http": [
243
+ "./dist/http.d.mts"
244
+ ],
237
245
  "browser": [
238
246
  "./dist/browser.d.mts"
239
247
  ],
@@ -1 +0,0 @@
1
- {"version":3,"file":"headers-BSi3UHKL.mjs","names":[],"sources":["../src/shared/middleware.ts","../src/shared/headers.ts"],"sourcesContent":["import type { DrainContext, EnrichContext, RequestLogger, RouteConfig, TailSamplingContext, WideEvent } from '../types'\nimport { createRequestLogger, getGlobalDrain, isEnabled, shouldKeep } from '../logger'\nimport { extractErrorStatus } from './errors'\nimport { shouldLog, getServiceForPath } from './routes'\n\n/**\n * Base options shared by all framework integrations.\n *\n * Every framework-specific options interface (e.g. `EvlogExpressOptions`)\n * extends this type. If a framework needs extra fields it can add them\n * on top; otherwise the base is used as-is.\n *\n * @beta Part of `evlog/toolkit` — the public API for building custom integrations.\n */\nexport interface BaseEvlogOptions {\n /** Route patterns to include in logging (glob). If not set, all routes are logged */\n include?: string[]\n /** Route patterns to exclude from logging. Exclusions take precedence over inclusions */\n exclude?: string[]\n /** Route-specific service configuration */\n routes?: Record<string, RouteConfig>\n /**\n * Drain callback called with every emitted event.\n * Use with drain adapters (Axiom, OTLP, Sentry, etc.) or custom endpoints.\n */\n drain?: (ctx: DrainContext) => void | Promise<void>\n /**\n * Enrich callback called after emit, before drain.\n * Use to add derived context (geo, deployment info, user agent, etc.).\n */\n enrich?: (ctx: EnrichContext) => void | Promise<void>\n /**\n * Custom tail sampling callback.\n * Set `ctx.shouldKeep = true` to force-keep the log regardless of head sampling.\n */\n keep?: (ctx: TailSamplingContext) => void | Promise<void>\n}\n\n/**\n * Internal options consumed by `createMiddlewareLogger`.\n * Extends `BaseEvlogOptions` with the request-specific fields\n * that framework adapters must provide.\n */\nexport interface MiddlewareLoggerOptions extends BaseEvlogOptions {\n method: string\n path: string\n requestId?: string\n /** Pre-filtered safe request headers (used for enrich/drain context) */\n headers?: Record<string, string>\n}\n\nexport interface MiddlewareLoggerResult {\n logger: RequestLogger\n finish: (opts?: { status?: number; error?: Error }) => Promise<WideEvent | null>\n skipped: boolean\n}\n\nconst noopResult: MiddlewareLoggerResult = {\n logger: {\n set() {},\n error() {},\n info() {},\n warn() {},\n emit() {\n return null \n },\n getContext() {\n return {} \n },\n },\n finish: () => Promise.resolve(null),\n skipped: true,\n}\n\nasync function runEnrichAndDrain(\n emittedEvent: WideEvent,\n options: MiddlewareLoggerOptions,\n requestInfo: { method: string; path: string; requestId?: string },\n responseStatus?: number,\n): Promise<void> {\n if (options.enrich) {\n const enrichCtx: EnrichContext = {\n event: emittedEvent,\n request: requestInfo,\n headers: options.headers,\n response: { status: responseStatus },\n }\n try {\n await options.enrich(enrichCtx)\n } catch (err) {\n console.error('[evlog] enrich failed:', err)\n }\n }\n\n const drain = options.drain ?? getGlobalDrain()\n if (drain) {\n const drainCtx: DrainContext = {\n event: emittedEvent,\n request: requestInfo,\n headers: options.headers,\n }\n try {\n await drain(drainCtx)\n } catch (err) {\n console.error('[evlog] drain failed:', err)\n }\n }\n}\n\n/**\n * Create a middleware-aware request logger with full lifecycle management.\n *\n * Handles the complete pipeline shared across all framework integrations:\n * route filtering, logger creation, service overrides, duration tracking,\n * tail sampling evaluation, event emission, enrichment, and draining.\n *\n * Framework adapters only need to:\n * 1. Extract method/path/requestId/headers from the framework request\n * 2. Call `createMiddlewareLogger()` with those + user options\n * 3. Check `skipped` — if true, skip to next middleware\n * 4. Store `logger` in framework-specific context (e.g., `c.set('log', logger)`)\n * 5. Call `finish({ status })` or `finish({ error })` at response end\n *\n * @beta Part of `evlog/toolkit` — the public API for building custom integrations.\n */\nexport function createMiddlewareLogger(options: MiddlewareLoggerOptions): MiddlewareLoggerResult {\n if (!isEnabled()) return noopResult\n\n const { method, path, requestId, include, exclude, routes, keep } = options\n\n if (!shouldLog(path, include, exclude)) {\n return noopResult\n }\n\n const resolvedRequestId = requestId || crypto.randomUUID()\n\n const logger = createRequestLogger({\n method,\n path,\n requestId: resolvedRequestId,\n }, { _deferDrain: true })\n\n const routeService = getServiceForPath(path, routes)\n if (routeService) {\n logger.set({ service: routeService })\n }\n\n const startTime = Date.now()\n const requestInfo = { method, path, requestId: resolvedRequestId }\n\n const finish = async (opts?: { status?: number; error?: Error }): Promise<WideEvent | null> => {\n const { status, error } = opts ?? {}\n\n if (error) {\n logger.error(error)\n const errorStatus = extractErrorStatus(error)\n logger.set({ status: errorStatus })\n } else if (status !== undefined) {\n logger.set({ status })\n }\n\n const durationMs = Date.now() - startTime\n\n const resolvedStatus = error\n ? extractErrorStatus(error)\n : status ?? (logger.getContext().status as number | undefined)\n\n const tailCtx: TailSamplingContext = {\n status: resolvedStatus,\n duration: durationMs,\n path,\n method,\n context: logger.getContext(),\n shouldKeep: false,\n }\n\n if (keep) {\n await keep(tailCtx)\n }\n\n const forceKeep = tailCtx.shouldKeep || shouldKeep(tailCtx)\n const emittedEvent = logger.emit({ _forceKeep: forceKeep })\n\n if (emittedEvent && (options.enrich || options.drain || getGlobalDrain())) {\n await runEnrichAndDrain(emittedEvent, options, requestInfo, resolvedStatus)\n }\n\n return emittedEvent\n }\n\n return { logger, finish, skipped: false }\n}\n","import { filterSafeHeaders } from '../utils'\n\n/**\n * Extract headers from a Web API `Headers` object and filter out sensitive ones.\n * Works with any runtime that supports the standard `Headers` API (Hono, Elysia,\n * Nitro v3, Cloudflare Workers, Bun, Deno, etc.).\n */\nexport function extractSafeHeaders(headers: Headers): Record<string, string> {\n const raw: Record<string, string> = {}\n headers.forEach((value, key) => {\n raw[key] = value\n })\n return filterSafeHeaders(raw)\n}\n\n/**\n * Extract headers from Node.js `IncomingHttpHeaders` and filter out sensitive ones.\n * Works with Express, Fastify, and any Node.js HTTP server using `req.headers`.\n */\nexport function extractSafeNodeHeaders(headers: Record<string, string | string[] | undefined>): Record<string, string> {\n const raw: Record<string, string> = {}\n for (const [key, value] of Object.entries(headers)) {\n if (value === undefined) continue\n raw[key] = Array.isArray(value) ? value.join(', ') : value\n }\n return filterSafeHeaders(raw)\n}\n"],"mappings":";;;;;AAyDA,MAAM,aAAqC;CACzC,QAAQ;EACN,MAAM;EACN,QAAQ;EACR,OAAO;EACP,OAAO;EACP,OAAO;AACL,UAAO;;EAET,aAAa;AACX,UAAO,EAAE;;EAEZ;CACD,cAAc,QAAQ,QAAQ,KAAK;CACnC,SAAS;CACV;AAED,eAAe,kBACb,cACA,SACA,aACA,gBACe;AACf,KAAI,QAAQ,QAAQ;EAClB,MAAM,YAA2B;GAC/B,OAAO;GACP,SAAS;GACT,SAAS,QAAQ;GACjB,UAAU,EAAE,QAAQ,gBAAgB;GACrC;AACD,MAAI;AACF,SAAM,QAAQ,OAAO,UAAU;WACxB,KAAK;AACZ,WAAQ,MAAM,0BAA0B,IAAI;;;CAIhD,MAAM,QAAQ,QAAQ,SAAS,gBAAgB;AAC/C,KAAI,OAAO;EACT,MAAM,WAAyB;GAC7B,OAAO;GACP,SAAS;GACT,SAAS,QAAQ;GAClB;AACD,MAAI;AACF,SAAM,MAAM,SAAS;WACd,KAAK;AACZ,WAAQ,MAAM,yBAAyB,IAAI;;;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AE;EAAQ;EAAQ,SAAS;EAAO;;;;;;;;;ACvL3C,SAAgB,mBAAmB,SAA0C;CAC3E,MAAM,MAA8B,EAAE;AACtC,SAAQ,SAAS,OAAO,QAAQ;AAC9B,MAAI,OAAO;GACX;AACF,QAAO,kBAAkB,IAAI;;;;;;AAO/B,SAAgB,uBAAuB,SAAgF;CACrH,MAAM,MAA8B,EAAE;AACtC,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,QAAQ,EAAE;AAClD,MAAI,UAAU,KAAA,EAAW;AACzB,MAAI,OAAO,MAAM,QAAQ,MAAM,GAAG,MAAM,KAAK,KAAK,GAAG;;AAEvD,QAAO,kBAAkB,IAAI"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.mjs","names":[],"sources":["../src/logger.ts"],"sourcesContent":["import type { DrainContext, EnvironmentContext, FieldContext, Log, LogLevel, LoggerConfig, RequestLogger, RequestLoggerOptions, SamplingConfig, TailSamplingContext, WideEvent } from './types'\nimport { colors, cssColors, detectEnvironment, escapeFormatString, formatDuration, getConsoleMethod, getCssLevelColor, getLevelColor, isClient, isDev, matchesPattern } from './utils'\n\nfunction isPlainObject(val: unknown): val is Record<string, unknown> {\n return val !== null && typeof val === 'object' && !Array.isArray(val)\n}\n\nconst _tsDate = new Date()\nfunction isoNow(): string {\n _tsDate.setTime(Date.now())\n return _tsDate.toISOString()\n}\n\nfunction mergeInto(target: Record<string, unknown>, source: Record<string, unknown>): void {\n for (const key in source) {\n const sourceVal = source[key]\n if (sourceVal === undefined || sourceVal === null) continue\n const targetVal = target[key]\n if (isPlainObject(sourceVal) && isPlainObject(targetVal)) {\n mergeInto(targetVal, sourceVal)\n } else {\n target[key] = sourceVal\n }\n }\n}\n\nlet globalEnv: EnvironmentContext = {\n service: 'app',\n environment: 'development',\n}\n\nlet globalPretty = isDev()\nlet globalSampling: SamplingConfig = {}\nlet globalStringify = true\nlet globalDrain: ((ctx: DrainContext) => void | Promise<void>) | undefined\nlet globalEnabled = true\nlet globalSilent = false\nlet _locked = false\n\n/**\n * Initialize the logger with configuration.\n * Call this once at application startup.\n */\nexport function initLogger(config: LoggerConfig = {}): void {\n globalEnabled = config.enabled ?? true\n const detected = detectEnvironment()\n\n globalEnv = {\n service: config.env?.service ?? detected.service ?? 'app',\n environment: config.env?.environment ?? detected.environment ?? 'development',\n version: config.env?.version ?? detected.version,\n commitHash: config.env?.commitHash ?? detected.commitHash,\n region: config.env?.region ?? detected.region,\n }\n\n globalPretty = config.pretty ?? isDev()\n globalSampling = config.sampling ?? {}\n globalStringify = config.stringify ?? true\n globalDrain = config.drain\n globalSilent = config.silent ?? false\n\n if (globalSilent && !globalDrain && !config._suppressDrainWarning) {\n console.warn('[evlog] silent mode is enabled but no drain is configured. Events will be built and sampled but not output anywhere. Set a drain via initLogger({ drain }) or a framework hook (evlog:drain).')\n }\n}\n\n/**\n * Check if logging is globally enabled.\n */\nexport function isEnabled(): boolean {\n return globalEnabled\n}\n\n/**\n * @internal Lock the logger to prevent re-initialization.\n * Called by instrumentation register() after setting up the logger with drain.\n * Prevents configureHandler() from overwriting the drain config.\n */\nexport function lockLogger(): void {\n _locked = true\n}\n\n/**\n * @internal Check if the logger has been locked by instrumentation.\n */\nexport function isLoggerLocked(): boolean {\n return _locked\n}\n\n/**\n * @internal Get the globally configured drain callback.\n * Used by framework middleware to fall back to the global drain\n * when no middleware-level drain is provided.\n */\nexport function getGlobalDrain(): ((ctx: DrainContext) => void | Promise<void>) | undefined {\n return globalDrain\n}\n\n/**\n * Determine if a log at the given level should be emitted based on sampling config.\n * Error level defaults to 100% (always logged) unless explicitly configured otherwise.\n */\nfunction shouldSample(level: LogLevel): boolean {\n const { rates } = globalSampling\n if (!rates) {\n return true // No sampling configured, log everything\n }\n\n // Error defaults to 100% unless explicitly set\n const percentage = level === 'error' && rates.error === undefined\n ? 100\n : rates[level] ?? 100\n\n // 0% = never log, 100% = always log\n if (percentage <= 0) return false\n if (percentage >= 100) return true\n\n return Math.random() * 100 < percentage\n}\n\n/**\n * Evaluate tail sampling conditions to determine if a log should be force-kept.\n * Returns true if ANY condition matches (OR logic).\n */\nexport function shouldKeep(ctx: TailSamplingContext): boolean {\n const { keep } = globalSampling\n if (!keep?.length) return false\n\n return keep.some((condition) => {\n if (condition.status !== undefined && ctx.status !== undefined && ctx.status >= condition.status) {\n return true\n }\n if (condition.duration !== undefined && ctx.duration !== undefined && ctx.duration >= condition.duration) {\n return true\n }\n if (condition.path && ctx.path && matchesPattern(ctx.path, condition.path)) {\n return true\n }\n return false\n })\n}\n\nfunction emitWideEvent(level: LogLevel, event: Record<string, unknown>, deferDrain = false, ownsEvent = false): WideEvent | null {\n if (!globalEnabled) return null\n\n if (!ownsEvent && !shouldSample(level)) {\n return null\n }\n\n let formatted: WideEvent\n if (ownsEvent) {\n event.timestamp = isoNow()\n event.level = level\n if (event.service === undefined) event.service = globalEnv.service\n if (event.environment === undefined) event.environment = globalEnv.environment\n if (globalEnv.version !== undefined && event.version === undefined) event.version = globalEnv.version\n if (globalEnv.commitHash !== undefined && event.commitHash === undefined) event.commitHash = globalEnv.commitHash\n if (globalEnv.region !== undefined && event.region === undefined) event.region = globalEnv.region\n formatted = event as WideEvent\n } else {\n formatted = {\n timestamp: isoNow(),\n level,\n ...globalEnv,\n ...event,\n }\n }\n\n if (!globalSilent) {\n if (globalPretty) {\n prettyPrintWideEvent(formatted)\n } else if (globalStringify) {\n console[getConsoleMethod(level)](JSON.stringify(formatted))\n } else {\n console[getConsoleMethod(level)](formatted)\n }\n }\n\n if (globalDrain && !deferDrain) {\n Promise.resolve(globalDrain({ event: formatted })).catch((err) => {\n console.error('[evlog] drain failed:', err)\n })\n }\n\n return formatted\n}\n\nfunction emitTaggedLog(level: LogLevel, tag: string, message: string): void {\n if (!globalEnabled) return\n\n if (globalPretty && !globalSilent) {\n if (!shouldSample(level)) {\n return\n }\n\n if (isClient()) {\n const levelColor = getCssLevelColor(level)\n const timestamp = isoNow().slice(11, 23)\n console.log(\n `%c${timestamp}%c %c[${escapeFormatString(tag)}]%c ${escapeFormatString(message)}`,\n cssColors.dim,\n cssColors.reset,\n levelColor,\n cssColors.reset,\n )\n } else {\n const color = getLevelColor(level)\n const timestamp = isoNow().slice(11, 23)\n console.log(`${colors.dim}${timestamp}${colors.reset} ${color}[${tag}]${colors.reset} ${message}`)\n }\n\n return\n }\n emitWideEvent(level, { tag, message })\n}\n\nfunction formatValue(value: unknown): string {\n if (value === null || value === undefined) {\n return String(value)\n }\n if (typeof value === 'object') {\n // Flatten object to key=value pairs\n const pairs: string[] = []\n for (const [k, v] of Object.entries(value as Record<string, unknown>)) {\n if (v !== undefined && v !== null) {\n if (typeof v === 'object') {\n // For nested objects, show as JSON\n pairs.push(`${k}=${JSON.stringify(v)}`)\n } else {\n pairs.push(`${k}=${v}`)\n }\n }\n }\n return pairs.join(' ')\n }\n return String(value)\n}\n\nfunction prettyPrintWideEvent(event: Record<string, unknown>): void {\n const { timestamp, level, service, environment, version, ...rest } = event\n const ts = (timestamp as string).slice(11, 23)\n const browser = isClient()\n\n const parts: string[] = []\n const styles: string[] = []\n\n if (browser) {\n const lc = getCssLevelColor(level as string)\n parts.push(`%c${ts}%c %c${(level as string).toUpperCase()}%c %c[${escapeFormatString(String(service))}]%c`)\n styles.push(cssColors.dim, cssColors.reset, lc, cssColors.reset, cssColors.cyan, cssColors.reset)\n } else {\n const lc = getLevelColor(level as string)\n parts.push(`${colors.dim}${ts}${colors.reset} ${lc}${(level as string).toUpperCase()}${colors.reset} ${colors.cyan}[${service}]${colors.reset}`)\n }\n\n if (rest.method && rest.path) {\n parts.push(browser ? ` ${escapeFormatString(String(rest.method))} ${escapeFormatString(String(rest.path))}` : ` ${rest.method} ${rest.path}`)\n delete rest.method\n delete rest.path\n }\n\n if (rest.status) {\n const sc = browser\n ? ((rest.status as number) >= 400 ? cssColors.red : cssColors.green)\n : ((rest.status as number) >= 400 ? colors.red : colors.green)\n if (browser) {\n parts.push(` %c${rest.status}%c`)\n styles.push(sc, cssColors.reset)\n } else {\n parts.push(` ${sc}${rest.status}${colors.reset}`)\n }\n delete rest.status\n }\n\n if (rest.duration) {\n if (browser) {\n parts.push(` %c${escapeFormatString(`in ${rest.duration}`)}%c`)\n styles.push(cssColors.dim, cssColors.reset)\n } else {\n parts.push(` ${colors.dim}in ${rest.duration}${colors.reset}`)\n }\n delete rest.duration\n }\n\n console.log(parts.join(''), ...styles)\n\n const entries = Object.entries(rest).filter(([_, v]) => v !== undefined)\n const lastIndex = entries.length - 1\n\n entries.forEach(([key, value], index) => {\n const prefix = index === lastIndex ? '└─' : '├─'\n const val = formatValue(value)\n if (browser) {\n console.log(` %c${prefix}%c %c${escapeFormatString(key)}:%c ${escapeFormatString(val)}`, cssColors.dim, cssColors.reset, cssColors.cyan, cssColors.reset)\n } else {\n console.log(` ${colors.dim}${prefix}${colors.reset} ${colors.cyan}${key}:${colors.reset} ${val}`)\n }\n })\n}\n\nfunction createLogMethod(level: LogLevel) {\n return function logMethod(tagOrEvent: string | Record<string, unknown>, message?: string): void {\n if (typeof tagOrEvent === 'string' && message !== undefined) {\n emitTaggedLog(level, tagOrEvent, message)\n } else if (typeof tagOrEvent === 'object') {\n emitWideEvent(level, tagOrEvent)\n } else {\n emitTaggedLog(level, 'log', String(tagOrEvent))\n }\n }\n}\n\n/**\n * Simple logging API - as easy as console.log\n *\n * @example\n * ```ts\n * log.info('auth', 'User logged in')\n * log.error({ action: 'payment', error: 'failed' })\n * ```\n */\nconst _log: Log = {\n info: createLogMethod('info'),\n error: createLogMethod('error'),\n warn: createLogMethod('warn'),\n debug: createLogMethod('debug'),\n}\n\nexport { _log as log }\n\nconst noopLogger: RequestLogger = {\n set() {},\n error() {},\n info() {},\n warn() {},\n emit() {\n return null\n },\n getContext() {\n return {}\n },\n}\n\n/**\n * @internal Options for createLogger that are not part of the public API.\n */\ninterface CreateLoggerInternalOptions {\n /**\n * When true, the global drain is skipped on emit.\n * Used by framework middleware that runs its own enrich+drain pipeline.\n */\n _deferDrain?: boolean\n}\n\n/**\n * Create a scoped logger for building wide events.\n * Use this for any context: workflows, jobs, scripts, queues, etc.\n *\n * @example\n * ```ts\n * const log = createLogger({ jobId: job.id, queue: 'emails' })\n * log.set({ batch: { size: 50, processed: 12 } })\n * log.emit()\n * ```\n */\nexport function createLogger<T extends object = Record<string, unknown>>(initialContext: Record<string, unknown> = {}, internalOptions?: CreateLoggerInternalOptions): RequestLogger<T> {\n if (!globalEnabled) return noopLogger as RequestLogger<T>\n\n const deferDrain = internalOptions?._deferDrain ?? false\n const startTime = Date.now()\n const context: Record<string, unknown> = { ...initialContext }\n let hasError = false\n let hasWarn = false\n\n function addLog(level: 'info' | 'warn', message: string): void {\n if (!Array.isArray(context.requestLogs)) {\n context.requestLogs = []\n }\n (context.requestLogs as unknown[]).push({\n level,\n message,\n timestamp: isoNow(),\n })\n }\n\n return {\n set(data: FieldContext<T>): void {\n mergeInto(context, data as Record<string, unknown>)\n },\n\n error(error: Error | string, errorContext?: FieldContext<T>): void {\n hasError = true\n const err = typeof error === 'string' ? new Error(error) : error\n\n if (errorContext) {\n mergeInto(context, errorContext as Record<string, unknown>)\n }\n\n const errorObj: Record<string, unknown> = {\n name: err.name,\n message: err.message,\n stack: err.stack,\n }\n const errRecord = err as unknown as Record<string, unknown>\n for (const k of ['status', 'statusText', 'statusCode', 'statusMessage', 'data', 'cause', 'internal'] as const) {\n if (k in err) errorObj[k] = errRecord[k]\n }\n\n if (isPlainObject(context.error)) {\n mergeInto(context.error as Record<string, unknown>, errorObj)\n } else {\n context.error = errorObj\n }\n },\n\n info(message: string, infoContext?: FieldContext<T>): void {\n addLog('info', message)\n if (infoContext) {\n const { requestLogs: _, ...rest } = infoContext as Record<string, unknown>\n mergeInto(context, rest)\n }\n },\n\n warn(message: string, warnContext?: FieldContext<T>): void {\n hasWarn = true\n addLog('warn', message)\n if (warnContext) {\n const { requestLogs: _, ...rest } = warnContext as Record<string, unknown>\n mergeInto(context, rest)\n }\n },\n\n emit(overrides?: FieldContext<T> & { _forceKeep?: boolean }): WideEvent | null {\n const durationMs = Date.now() - startTime\n const level: LogLevel = hasError ? 'error' : hasWarn ? 'warn' : 'info'\n\n let forceKeep = false\n if (overrides?._forceKeep) {\n forceKeep = true\n } else if (globalSampling.keep?.length) {\n const status = (overrides as Record<string, unknown> | undefined)?.status ?? context.status\n forceKeep = shouldKeep({\n status: status as number | undefined,\n duration: durationMs,\n path: context.path as string | undefined,\n method: context.method as string | undefined,\n context,\n })\n }\n\n if (!forceKeep && !shouldSample(level)) {\n return null\n }\n\n if (overrides) {\n const obj = overrides as Record<string, unknown>\n for (const key in obj) {\n if (key !== '_forceKeep') context[key] = obj[key]\n }\n }\n context.duration = formatDuration(durationMs)\n\n return emitWideEvent(level, context, deferDrain, true)\n },\n\n getContext(): FieldContext<T> & Record<string, unknown> {\n return { ...context }\n },\n }\n}\n\n/**\n * Create a request-scoped logger for building wide events.\n * Convenience wrapper around `createLogger` that pre-populates HTTP request fields.\n *\n * @example\n * ```ts\n * const log = createRequestLogger({ method: 'POST', path: '/checkout' })\n * log.set({ user: { id: '123' } })\n * log.set({ cart: { items: 3 } })\n * log.emit()\n * ```\n */\nexport function createRequestLogger<T extends object = Record<string, unknown>>(options: RequestLoggerOptions = {}, internalOptions?: CreateLoggerInternalOptions): RequestLogger<T> {\n const initial: Record<string, unknown> = {}\n if (options.method !== undefined) initial.method = options.method\n if (options.path !== undefined) initial.path = options.path\n if (options.requestId !== undefined) initial.requestId = options.requestId\n return createLogger<T>(initial, internalOptions)\n}\n\n/**\n * Get the current environment context.\n */\nexport function getEnvironment(): EnvironmentContext {\n return { ...globalEnv }\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\ndeclare const __EVLOG_CONFIG__: import('./types').LoggerConfig | undefined\n\nif (typeof __EVLOG_CONFIG__ !== 'undefined') initLogger(__EVLOG_CONFIG__)\n"],"mappings":";;AAGA,SAAS,cAAc,KAA8C;AACnE,QAAO,QAAQ,QAAQ,OAAO,QAAQ,YAAY,C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"mappings":";;;;;AAcA;;;;;;;UAAiB,gBAAA;EAgByB;EAdxC,OAAA;EAmB4C;EAjB5C,OAAA;EAiBmD;EAfnD,MAAA,GAAS,MAAA,SAAe,WAAA;EAFxB;;;;EAOA,KAAA,IAAS,GAAA,EAAK,YAAA,YAAwB,OAAA;EAAxB;;;;EAKd,MAAA,IAAU,GAAA,EAAK,aAAA,YAAyB,OAAA;EAA9B;;;;EAKV,IAAA,IAAQ,GAAA,EAAK,mBAAA,YAA+B,OAAA;AAAA;;;AAQ9C;;;UAAiB,uBAAA,SAAgC,gBAAA;EAC/C,MAAA;EACA,IAAA;EACA,SAAA;EAAA;EAEA,OAAA,GAAU,MAAA;AAAA;AAAA,UAGK,sBAAA;EACf,MAAA,EAAQ,aAAA;EACR,MAAA,GAAS,IAAA;IAAS,MAAA;IAAiB,KAAA,GAAQ,KAAA;EAAA,MAAY,OAAA,CAAQ,SAAA;EAC/D,OAAA;AAAA;;;;;;;;;;;;;;;;AAuEF;iBAAgB,sBAAA,CAAuB,OAAA,EAAS,uBAAA,GAA0B,sBAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"nitro-CfGx0wDJ.d.mts","names":[],"sources":["../src/nitro.ts"],"mappings":";;UAKiB,kBAAA;;AAAjB;;;EAKE,OAAA;EAKM;;;EAAN,GAAA,GAAM,OAAA,CAAQ,kBAAA;EAuCW;;;;EAjCzB,MAAA;EANc;;;;;;;EAed,MAAA;EAwBA;;;;;EAjBA,OAAA;;;;;;EAOA,OAAA;;;;EAKA,MAAA,GAAS,MAAA,SAAe,WAAA;;;;EAKxB,QAAA,GAAW,cAAA;AAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"nitro-Dpq5ZmcM.mjs","names":[],"sources":["../src/nitro.ts"],"sourcesContent":["import type { EnvironmentContext, RouteConfig, SamplingConfig } from './types'\nimport { extractErrorStatus } from './shared/errors'\n\nexport { shouldLog, getServiceForPath } from './shared/routes'\n\nexport interface NitroModuleOptions {\n /**\n * Enable or disable all logging globally.\n * @default true\n */\n enabled?: boolean\n\n /**\n * Environment context overrides.\n */\n env?: Partial<EnvironmentContext>\n\n /**\n * Enable pretty printing.\n * @default true in development, false in production\n */\n pretty?: boolean\n\n /**\n * Suppress built-in console output.\n * When true, events are still built, sampled, and passed to drains,\n * but nothing is written to console. Use when drains own the output\n * channel (e.g., stdout-based platforms like GCP Cloud Run, AWS Lambda).\n * @default false\n */\n silent?: boolean\n\n /**\n * Route patterns to include in logging.\n * Supports glob patterns like '/api/**'.\n * If not set, all routes are logged.\n */\n include?: string[]\n\n /**\n * Route patterns to exclude from logging.\n * Supports glob patterns like '/_nitro/**'.\n * Exclusions take precedence over inclusions.\n */\n exclude?: string[]\n\n /**\n * Route-specific service configuration.\n */\n routes?: Record<string, RouteConfig>\n\n /**\n * Sampling configuration for filtering logs.\n */\n sampling?: SamplingConfig\n}\n\nexport interface EvlogConfig {\n enabled?: boolean\n env?: Record<string, unknown>\n pretty?: boolean\n silent?: boolean\n include?: string[]\n exclude?: string[]\n routes?: Record<string, RouteConfig>\n sampling?: SamplingConfig\n}\n\n/**\n * Resolve an EvlogError from an error or its cause chain.\n * Both Nitro v2 (h3) and v3 wrap thrown errors — this unwraps them.\n */\nexport function resolveEvlogError(error: Error): Error | null {\n if (error.name === 'EvlogError') return error\n if ((error.cause as Error)?.name === 'EvlogError') return error.cause as Error\n return null\n}\n\nexport { extractErrorStatus } from './shared/errors'\n\n/**\n * Build a standard evlog error JSON response body.\n * Used by both v2 and v3 error handlers to ensure consistent shape.\n */\nexport function serializeEvlogErrorResponse(error: Error, url: string): Record<string, unknown> {\n const status = extractErrorStatus(error)\n const { data } = error as { data?: unknown }\n const statusMessage = (error as { statusMessage?: string }).statusMessage || error.message\n return {\n url,\n status,\n statusCode: status,\n statusText: statusMessage,\n statusMessage,\n message: error.message,\n error: true,\n ...(data !== undefined && { data }),\n }\n}\n\n"],"mappings":";;;;;;AAwEA,SAAgB,kBAAkB,OAA4B;AAC5D,KAAI,MAAM,SAAS,aAAc,QAAO;AACxC,KAAK,MAAM,OAAiB,SAAS,aAAc,QAAO,MAAM;AAChE,QAAO;;;;;;AAST,SAAgB,4BAA4B,OAAc,KAAsC;CAC9F,MAAM,SAAS,mBAAmB,MAAM;CACxC,MAAM,EAAE,SAAS;CACjB,MAAM,gBAAiB,MAAqC,iBAAiB,MAAM;AACnF,QAAO;EACL;EACA;EACA,YAAY;EACZ,YAAY;EACZ;EACA,SAAS,MAAM;EACf,OAAO;EACP,GAAI,SAAS,KAAA,KAAa,EAAE,MAAM;EACnC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseError-B_qXj8x4.d.mts","names":[],"sources":["../src/runtime/utils/parseError.ts"],"mappings":";;;iBAMgB,UAAA,CAAW,KAAA,YAAiB,WAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types-v_JkG_D7.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";;YAGY,iBAAA;;;;;;;;;;;;;;IAcR,iBAAA,GAAoB,GAAA,EAAK,mBAAA,YAA+B,OAAA;IAAA;;;;;;;;;;;IAaxD,cAAA,GAAiB,GAAA,EAAK,aAAA,YAAyB,OAAA;IAkBK;;;;;;;;;;;;;;;;IAApD,aAAA,GAAgB,GAAA,EAAK,YAAA,YAAwB,OAAA;EAAA;AAAA;AAAA;EAAA,UAKrC,iBAAA;IACR,iBAAA,GAAoB,GAAA,EAAK,mBAAA,YAA+B,OAAA;IACxD,cAAA,GAAiB,GAAA,EAAK,aAAA,YAAyB,OAAA;IAC/C,aAAA,GAAgB,GAAA,EAAK,YAAA,YAAwB,OAAA;EAAA;AAAA;;AAOjD;;UAAiB,eAAA;EAiBiB;;;;EAZhC,OAAA;EAYgC;;AAMlC;;EAZE,QAAA;EAY4B;;;;EAN5B,WAAA,GAAc,kBAAA;AAAA;AAehB;;;AAAA,UATiB,aAAA;EACf,SAAA;EACA,KAAA;EAAA,CACC,GAAA;AAAA;;;AAqBH;UAfiB,aAAA;;EAEf,IAAA;EA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