@zudojs/observability 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +38 -0
  3. package/dist/exporter/exporter.console.d.ts +34 -0
  4. package/dist/exporter/exporter.console.d.ts.map +1 -0
  5. package/dist/exporter/exporter.console.js +94 -0
  6. package/dist/exporter/exporter.console.js.map +1 -0
  7. package/dist/exporter/index.d.ts +7 -0
  8. package/dist/exporter/index.d.ts.map +1 -0
  9. package/dist/exporter/index.js +7 -0
  10. package/dist/exporter/index.js.map +1 -0
  11. package/dist/index.d.ts +42 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +55 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/logLevel/index.d.ts +7 -0
  16. package/dist/logLevel/index.d.ts.map +1 -0
  17. package/dist/logLevel/index.js +7 -0
  18. package/dist/logLevel/index.js.map +1 -0
  19. package/dist/logLevel/logLevel.type.d.ts +16 -0
  20. package/dist/logLevel/logLevel.type.d.ts.map +1 -0
  21. package/dist/logLevel/logLevel.type.js +42 -0
  22. package/dist/logLevel/logLevel.type.js.map +1 -0
  23. package/dist/logRecord/index.d.ts +7 -0
  24. package/dist/logRecord/index.d.ts.map +1 -0
  25. package/dist/logRecord/index.js +7 -0
  26. package/dist/logRecord/index.js.map +1 -0
  27. package/dist/logRecord/logRecord.core.d.ts +18 -0
  28. package/dist/logRecord/logRecord.core.d.ts.map +1 -0
  29. package/dist/logRecord/logRecord.core.js +49 -0
  30. package/dist/logRecord/logRecord.core.js.map +1 -0
  31. package/dist/logger/index.d.ts +7 -0
  32. package/dist/logger/index.d.ts.map +1 -0
  33. package/dist/logger/index.js +7 -0
  34. package/dist/logger/index.js.map +1 -0
  35. package/dist/logger/logger.core.d.ts +32 -0
  36. package/dist/logger/logger.core.d.ts.map +1 -0
  37. package/dist/logger/logger.core.js +81 -0
  38. package/dist/logger/logger.core.js.map +1 -0
  39. package/dist/metrics/counter/counter.core.d.ts +22 -0
  40. package/dist/metrics/counter/counter.core.d.ts.map +1 -0
  41. package/dist/metrics/counter/counter.core.js +34 -0
  42. package/dist/metrics/counter/counter.core.js.map +1 -0
  43. package/dist/metrics/counter/index.d.ts +7 -0
  44. package/dist/metrics/counter/index.d.ts.map +1 -0
  45. package/dist/metrics/counter/index.js +7 -0
  46. package/dist/metrics/counter/index.js.map +1 -0
  47. package/dist/metrics/gauge/gauge.core.d.ts +23 -0
  48. package/dist/metrics/gauge/gauge.core.d.ts.map +1 -0
  49. package/dist/metrics/gauge/gauge.core.js +37 -0
  50. package/dist/metrics/gauge/gauge.core.js.map +1 -0
  51. package/dist/metrics/gauge/index.d.ts +7 -0
  52. package/dist/metrics/gauge/index.d.ts.map +1 -0
  53. package/dist/metrics/gauge/index.js +7 -0
  54. package/dist/metrics/gauge/index.js.map +1 -0
  55. package/dist/metrics/histogram/histogram.core.d.ts +30 -0
  56. package/dist/metrics/histogram/histogram.core.d.ts.map +1 -0
  57. package/dist/metrics/histogram/histogram.core.js +48 -0
  58. package/dist/metrics/histogram/histogram.core.js.map +1 -0
  59. package/dist/metrics/histogram/index.d.ts +7 -0
  60. package/dist/metrics/histogram/index.d.ts.map +1 -0
  61. package/dist/metrics/histogram/index.js +7 -0
  62. package/dist/metrics/histogram/index.js.map +1 -0
  63. package/dist/metrics/index.d.ts +10 -0
  64. package/dist/metrics/index.d.ts.map +1 -0
  65. package/dist/metrics/index.js +10 -0
  66. package/dist/metrics/index.js.map +1 -0
  67. package/dist/metrics/metrics.registry.d.ts +23 -0
  68. package/dist/metrics/metrics.registry.d.ts.map +1 -0
  69. package/dist/metrics/metrics.registry.js +93 -0
  70. package/dist/metrics/metrics.registry.js.map +1 -0
  71. package/dist/noop/index.d.ts +7 -0
  72. package/dist/noop/index.d.ts.map +1 -0
  73. package/dist/noop/index.js +7 -0
  74. package/dist/noop/index.js.map +1 -0
  75. package/dist/noop/noopObservability.core.d.ts +31 -0
  76. package/dist/noop/noopObservability.core.d.ts.map +1 -0
  77. package/dist/noop/noopObservability.core.js +103 -0
  78. package/dist/noop/noopObservability.core.js.map +1 -0
  79. package/dist/observability/index.d.ts +7 -0
  80. package/dist/observability/index.d.ts.map +1 -0
  81. package/dist/observability/index.js +7 -0
  82. package/dist/observability/index.js.map +1 -0
  83. package/dist/observability/observability.core.d.ts +28 -0
  84. package/dist/observability/observability.core.d.ts.map +1 -0
  85. package/dist/observability/observability.core.js +90 -0
  86. package/dist/observability/observability.core.js.map +1 -0
  87. package/dist/processor/index.d.ts +7 -0
  88. package/dist/processor/index.d.ts.map +1 -0
  89. package/dist/processor/index.js +7 -0
  90. package/dist/processor/index.js.map +1 -0
  91. package/dist/processor/processor.batch.d.ts +35 -0
  92. package/dist/processor/processor.batch.d.ts.map +1 -0
  93. package/dist/processor/processor.batch.js +77 -0
  94. package/dist/processor/processor.batch.js.map +1 -0
  95. package/dist/propagation/index.d.ts +7 -0
  96. package/dist/propagation/index.d.ts.map +1 -0
  97. package/dist/propagation/index.js +7 -0
  98. package/dist/propagation/index.js.map +1 -0
  99. package/dist/propagation/propagation.core.d.ts +24 -0
  100. package/dist/propagation/propagation.core.d.ts.map +1 -0
  101. package/dist/propagation/propagation.core.js +73 -0
  102. package/dist/propagation/propagation.core.js.map +1 -0
  103. package/dist/redaction/index.d.ts +7 -0
  104. package/dist/redaction/index.d.ts.map +1 -0
  105. package/dist/redaction/index.js +7 -0
  106. package/dist/redaction/index.js.map +1 -0
  107. package/dist/redaction/redaction.core.d.ts +19 -0
  108. package/dist/redaction/redaction.core.d.ts.map +1 -0
  109. package/dist/redaction/redaction.core.js +67 -0
  110. package/dist/redaction/redaction.core.js.map +1 -0
  111. package/dist/sampling/index.d.ts +7 -0
  112. package/dist/sampling/index.d.ts.map +1 -0
  113. package/dist/sampling/index.js +7 -0
  114. package/dist/sampling/index.js.map +1 -0
  115. package/dist/sampling/sampler.type.d.ts +35 -0
  116. package/dist/sampling/sampler.type.d.ts.map +1 -0
  117. package/dist/sampling/sampler.type.js +68 -0
  118. package/dist/sampling/sampler.type.js.map +1 -0
  119. package/dist/tracing/index.d.ts +8 -0
  120. package/dist/tracing/index.d.ts.map +1 -0
  121. package/dist/tracing/index.js +8 -0
  122. package/dist/tracing/index.js.map +1 -0
  123. package/dist/tracing/span/index.d.ts +8 -0
  124. package/dist/tracing/span/index.d.ts.map +1 -0
  125. package/dist/tracing/span/index.js +8 -0
  126. package/dist/tracing/span/index.js.map +1 -0
  127. package/dist/tracing/span/span.core.d.ts +42 -0
  128. package/dist/tracing/span/span.core.d.ts.map +1 -0
  129. package/dist/tracing/span/span.core.js +105 -0
  130. package/dist/tracing/span/span.core.js.map +1 -0
  131. package/dist/tracing/span/spanContext.type.d.ts +16 -0
  132. package/dist/tracing/span/spanContext.type.d.ts.map +1 -0
  133. package/dist/tracing/span/spanContext.type.js +32 -0
  134. package/dist/tracing/span/spanContext.type.js.map +1 -0
  135. package/dist/tracing/tracer/index.d.ts +7 -0
  136. package/dist/tracing/tracer/index.d.ts.map +1 -0
  137. package/dist/tracing/tracer/index.js +7 -0
  138. package/dist/tracing/tracer/index.js.map +1 -0
  139. package/dist/tracing/tracer/tracer.core.d.ts +31 -0
  140. package/dist/tracing/tracer/tracer.core.d.ts.map +1 -0
  141. package/dist/tracing/tracer/tracer.core.js +62 -0
  142. package/dist/tracing/tracer/tracer.core.js.map +1 -0
  143. package/dist/types.d.ts +10 -0
  144. package/dist/types.d.ts.map +1 -0
  145. package/dist/types.js +10 -0
  146. package/dist/types.js.map +1 -0
  147. package/package.json +52 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Zudojs Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # @zudojs/observability
2
+
3
+ Structured logging, metrics, tracing, context propagation, and exporters for Zudojs applications.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @zudojs/observability
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```typescript
14
+ import { createTracer, createMetricsRegistry } from "@zudojs/observability";
15
+
16
+ const tracer = createTracer({ service: "api" });
17
+ const metrics = createMetricsRegistry();
18
+
19
+ const span = tracer.startSpan("handle-request");
20
+ span.setAttribute("http.method", "GET");
21
+ await handleRequest();
22
+ span.end();
23
+ ```
24
+
25
+ ## Features
26
+
27
+ - Distributed tracing with span management
28
+ - Metrics registry (counters, gauges, histograms)
29
+ - Context propagation
30
+ - Log correlation with trace IDs
31
+ - Exporters (OTLP, Prometheus, etc.)
32
+
33
+ ## Use Cases
34
+
35
+ - Distributed tracing
36
+ - Performance monitoring
37
+ - Error tracking
38
+ - SLA and SLO monitoring
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @zudojs/observability — Console Exporter
3
+ *
4
+ * Exports telemetry to the console for development and debugging.
5
+ */
6
+ import type { LogExporter, LogRecord, MetricExporter, MetricSnapshot, ReadableSpan, SpanExporter } from "../types.js";
7
+ /**
8
+ * Exports completed spans to the console.
9
+ */
10
+ export declare class ConsoleSpanExporter implements SpanExporter {
11
+ export(spans: readonly ReadableSpan[]): Promise<void>;
12
+ shutdown(): Promise<void>;
13
+ }
14
+ /**
15
+ * Exports log records to the console.
16
+ */
17
+ export declare class ConsoleLogExporter implements LogExporter {
18
+ export(records: readonly LogRecord[]): Promise<void>;
19
+ shutdown(): Promise<void>;
20
+ }
21
+ /**
22
+ * Exports metric snapshots to the console.
23
+ */
24
+ export declare class ConsoleMetricExporter implements MetricExporter {
25
+ export(snapshots: readonly MetricSnapshot[]): Promise<void>;
26
+ shutdown(): Promise<void>;
27
+ }
28
+ /** Creates a console span exporter. */
29
+ export declare function createConsoleSpanExporter(): ConsoleSpanExporter;
30
+ /** Creates a console log exporter. */
31
+ export declare function createConsoleLogExporter(): ConsoleLogExporter;
32
+ /** Creates a console metric exporter. */
33
+ export declare function createConsoleMetricExporter(): ConsoleMetricExporter;
34
+ //# sourceMappingURL=exporter.console.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exporter.console.d.ts","sourceRoot":"","sources":["../../src/exporter/exporter.console.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,cAAc,EACd,cAAc,EACd,YAAY,EACZ,YAAY,EACb,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,qBAAa,mBAAoB,YAAW,YAAY;IAChD,MAAM,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAwB1D;IAEK,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAE9B;CACF;AAED;;GAEG;AACH,qBAAa,kBAAmB,YAAW,WAAW;IAC9C,MAAM,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBzD;IAEK,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAE9B;CACF;AAED;;GAEG;AACH,qBAAa,qBAAsB,YAAW,cAAc;IACpD,MAAM,CAAC,SAAS,EAAE,SAAS,cAAc,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBhE;IAEK,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAE9B;CACF;AAED,uCAAuC;AACvC,wBAAgB,yBAAyB,IAAI,mBAAmB,CAE/D;AAED,sCAAsC;AACtC,wBAAgB,wBAAwB,IAAI,kBAAkB,CAE7D;AAED,yCAAyC;AACzC,wBAAgB,2BAA2B,IAAI,qBAAqB,CAEnE"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * @zudojs/observability — Console Exporter
3
+ *
4
+ * Exports telemetry to the console for development and debugging.
5
+ */
6
+ /**
7
+ * Exports completed spans to the console.
8
+ */
9
+ export class ConsoleSpanExporter {
10
+ async export(spans) {
11
+ for (const span of spans) {
12
+ console.log(JSON.stringify({
13
+ type: "span",
14
+ name: span.name,
15
+ traceId: span.context.traceId,
16
+ spanId: span.context.spanId,
17
+ parentSpanId: span.context.parentSpanId,
18
+ kind: span.kind,
19
+ status: span.status,
20
+ duration: `${span.duration}ms`,
21
+ startTime: span.startTime.toISOString(),
22
+ endTime: span.endTime.toISOString(),
23
+ attributes: span.attributes,
24
+ events: span.events,
25
+ resource: span.resource,
26
+ }, null, 2));
27
+ }
28
+ }
29
+ async shutdown() {
30
+ // No resources to clean up
31
+ }
32
+ }
33
+ /**
34
+ * Exports log records to the console.
35
+ */
36
+ export class ConsoleLogExporter {
37
+ async export(records) {
38
+ for (const record of records) {
39
+ const output = {
40
+ timestamp: record.timestamp.toISOString(),
41
+ level: record.levelName,
42
+ logger: record.loggerName,
43
+ message: record.message,
44
+ ...(record.context ? { context: record.context } : {}),
45
+ ...(record.error ? { error: record.error } : {}),
46
+ };
47
+ if (record.level >= 4) {
48
+ console.error(JSON.stringify(output, null, 2));
49
+ }
50
+ else if (record.level >= 3) {
51
+ console.warn(JSON.stringify(output, null, 2));
52
+ }
53
+ else {
54
+ console.log(JSON.stringify(output, null, 2));
55
+ }
56
+ }
57
+ }
58
+ async shutdown() {
59
+ // No resources to clean up
60
+ }
61
+ }
62
+ /**
63
+ * Exports metric snapshots to the console.
64
+ */
65
+ export class ConsoleMetricExporter {
66
+ async export(snapshots) {
67
+ for (const snapshot of snapshots) {
68
+ console.log(JSON.stringify({
69
+ type: "metric",
70
+ metricType: snapshot.type,
71
+ name: snapshot.name,
72
+ value: snapshot.value,
73
+ labels: snapshot.labels,
74
+ timestamp: new Date().toISOString(),
75
+ }, null, 2));
76
+ }
77
+ }
78
+ async shutdown() {
79
+ // No resources to clean up
80
+ }
81
+ }
82
+ /** Creates a console span exporter. */
83
+ export function createConsoleSpanExporter() {
84
+ return new ConsoleSpanExporter();
85
+ }
86
+ /** Creates a console log exporter. */
87
+ export function createConsoleLogExporter() {
88
+ return new ConsoleLogExporter();
89
+ }
90
+ /** Creates a console metric exporter. */
91
+ export function createConsoleMetricExporter() {
92
+ return new ConsoleMetricExporter();
93
+ }
94
+ //# sourceMappingURL=exporter.console.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exporter.console.js","sourceRoot":"","sources":["../../src/exporter/exporter.console.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAC9B,KAAK,CAAC,MAAM,CAAC,KAA8B;QACzC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,OAAO,CAAC,GAAG,CACT,IAAI,CAAC,SAAS,CACZ;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO;gBAC7B,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;gBAC3B,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY;gBACvC,IAAI,EAAE,IAAI,CAAC,IAAI;gB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+ */
6
+ export { ConsoleSpanExporter, ConsoleLogExporter, ConsoleMetricExporter, createConsoleSpanExporter, createConsoleLogExporter, createConsoleMetricExporter, } from "./exporter.console.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exporter/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,yBAAyB,EACzB,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @zudojs/observability — Exporters
3
+ *
4
+ * Console exporters for spans, logs, and metrics.
5
+ */
6
+ export { ConsoleSpanExporter, ConsoleLogExporter, ConsoleMetricExporter, createConsoleSpanExporter, createConsoleLogExporter, createConsoleMetricExporter, } from "./exporter.console.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/exporter/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,yBAAyB,EACzB,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @zudojs/observability
3
+ *
4
+ * Structured logging, metrics, tracing, context propagation, and
5
+ * telemetry exporters for the Zudojs framework.
6
+ *
7
+ * Provides the instrumentation and abstraction layer without coupling
8
+ * to any specific telemetry provider. Exporters for OpenTelemetry,
9
+ * Prometheus, Datadog, etc. can be added as separate packages.
10
+ *
11
+ * ## Usage
12
+ *
13
+ * ```typescript
14
+ * import { createObservability, LogLevel } from "@zudojs/observability";
15
+ *
16
+ * const obs = createObservability({
17
+ * serviceName: "my-api",
18
+ * logLevel: LogLevel.INFO,
19
+ * });
20
+ *
21
+ * obs.logger.info("Server started", { port: 3000 });
22
+ * obs.metrics.counter("http.requests.total").increment();
23
+ * const span = obs.tracer.startSpan("handle-request");
24
+ * span.end();
25
+ * ```
26
+ *
27
+ * @packageDocumentation
28
+ */
29
+ export { LogLevel, SpanStatus, SpanKind, type LogLevelName, type LogRecord, type Logger, type LoggerOptions, type LogTransport, type PropagationContext, type PropagationContextOptions, type PropagationManager, type Counter, type Gauge, type Histogram, type MetricsRegistry, type MetricSnapshot, type Span, type SpanContext, type SpanEvent, type SpanOptions, type Tracer, type ReadableSpan, type SpanExporter, type LogExporter, type MetricExporter, type SpanProcessor, type SamplingResult, type Sampler, type RedactionConfig, type Observability, type ObservabilityConfig, } from "./types.js";
30
+ export { logLevelToName, logLevelFromName, shouldLog, getLogLevelNames, } from "./logLevel/index.js";
31
+ export { createLogRecord, createErrorLogRecord } from "./logRecord/index.js";
32
+ export { StructuredLogger, createStructuredLogger } from "./logger/index.js";
33
+ export { createPropagationContext, derivePropagationContext, getCurrentContext, AsyncPropagationManager, createPropagationManager, } from "./propagation/index.js";
34
+ export { DefaultCounter, createCounter, DefaultGauge, createGauge, DefaultHistogram, createHistogram, DefaultMetricsRegistry, createMetricsRegistry, } from "./metrics/index.js";
35
+ export { DefaultSpan, createSpan, createSpanContext, createChildSpanContext, DefaultTracer, createTracer, } from "./tracing/index.js";
36
+ export { AlwaysOnSampler, AlwaysOffSampler, ProbabilitySampler, ParentBasedSampler, createAlwaysOnSampler, createAlwaysOffSampler, createProbabilitySampler, createParentBasedSampler, } from "./sampling/index.js";
37
+ export { ConsoleSpanExporter, ConsoleLogExporter, ConsoleMetricExporter, createConsoleSpanExporter, createConsoleLogExporter, createConsoleMetricExporter, } from "./exporter/index.js";
38
+ export { BatchSpanProcessor, createBatchSpanProcessor, } from "./processor/index.js";
39
+ export { createRedactor, redactObject, isSensitiveField, } from "./redaction/index.js";
40
+ export { NoopObservability, createNoopObservability, noopLogger, noopCounter, noopGauge, noopHistogram, noopMetricsRegistry, noopSpan, noopTracer, noopPropagationManager, } from "./noop/index.js";
41
+ export { DefaultObservability, createObservability, } from "./observability/index.js";
42
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAIH,OAAO,EACL,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACvB,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,IAAI,EACT,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,OAAO,EACZ,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,mBAAmB,GACzB,MAAM,YAAY,CAAC;AAIpB,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAI7B,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAI7E,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAI7E,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,iBAAiB,EACjB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAIhC,OAAO,EACL,cAAc,EACd,aAAa,EACb,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EACL,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,aAAa,EACb,YAAY,GACb,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,qBAAqB,CAAC;AAI7B,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,yBAAyB,EACzB,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC;AAI7B,OAAO,EACL,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EACL,cAAc,EACd,YAAY,EACZ,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,UAAU,EACV,WAAW,EACX,SAAS,EACT,aAAa,EACb,mBAAmB,EACnB,QAAQ,EACR,UAAU,EACV,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @zudojs/observability
3
+ *
4
+ * Structured logging, metrics, tracing, context propagation, and
5
+ * telemetry exporters for the Zudojs framework.
6
+ *
7
+ * Provides the instrumentation and abstraction layer without coupling
8
+ * to any specific telemetry provider. Exporters for OpenTelemetry,
9
+ * Prometheus, Datadog, etc. can be added as separate packages.
10
+ *
11
+ * ## Usage
12
+ *
13
+ * ```typescript
14
+ * import { createObservability, LogLevel } from "@zudojs/observability";
15
+ *
16
+ * const obs = createObservability({
17
+ * serviceName: "my-api",
18
+ * logLevel: LogLevel.INFO,
19
+ * });
20
+ *
21
+ * obs.logger.info("Server started", { port: 3000 });
22
+ * obs.metrics.counter("http.requests.total").increment();
23
+ * const span = obs.tracer.startSpan("handle-request");
24
+ * span.end();
25
+ * ```
26
+ *
27
+ * @packageDocumentation
28
+ */
29
+ /* ─── Core Types ────────────────────────────────────────────────────────── */
30
+ export { LogLevel, SpanStatus, SpanKind, } from "./types.js";
31
+ /* ─── Log Level ─────────────────────────────────────────────────────────── */
32
+ export { logLevelToName, logLevelFromName, shouldLog, getLogLevelNames, } from "./logLevel/index.js";
33
+ /* ─── Log Record ────────────────────────────────────────────────────────── */
34
+ export { createLogRecord, createErrorLogRecord } from "./logRecord/index.js";
35
+ /* ─── Logger ────────────────────────────────────────────────────────────── */
36
+ export { StructuredLogger, createStructuredLogger } from "./logger/index.js";
37
+ /* ─── Propagation ───────────────────────────────────────────────────────── */
38
+ export { createPropagationContext, derivePropagationContext, getCurrentContext, AsyncPropagationManager, createPropagationManager, } from "./propagation/index.js";
39
+ /* ─── Metrics ───────────────────────────────────────────────────────────── */
40
+ export { DefaultCounter, createCounter, DefaultGauge, createGauge, DefaultHistogram, createHistogram, DefaultMetricsRegistry, createMetricsRegistry, } from "./metrics/index.js";
41
+ /* ─── Tracing ───────────────────────────────────────────────────────────── */
42
+ export { DefaultSpan, createSpan, createSpanContext, createChildSpanContext, DefaultTracer, createTracer, } from "./tracing/index.js";
43
+ /* ─── Sampling ──────────────────────────────────────────────────────────── */
44
+ export { AlwaysOnSampler, AlwaysOffSampler, ProbabilitySampler, ParentBasedSampler, createAlwaysOnSampler, createAlwaysOffSampler, createProbabilitySampler, createParentBasedSampler, } from "./sampling/index.js";
45
+ /* ─── Exporters ─────────────────────────────────────────────────────────── */
46
+ export { ConsoleSpanExporter, ConsoleLogExporter, ConsoleMetricExporter, createConsoleSpanExporter, createConsoleLogExporter, createConsoleMetricExporter, } from "./exporter/index.js";
47
+ /* ─── Processor ─────────────────────────────────────────────────────────── */
48
+ export { BatchSpanProcessor, createBatchSpanProcessor, } from "./processor/index.js";
49
+ /* ─── Redaction ─────────────────────────────────────────────────────────── */
50
+ export { createRedactor, redactObject, isSensitiveField, } from "./redaction/index.js";
51
+ /* ─── Noop ──────────────────────────────────────────────────────────────── */
52
+ export { NoopObservability, createNoopObservability, noopLogger, noopCounter, noopGauge, noopHistogram, noopMetricsRegistry, noopSpan, noopTracer, noopPropagationManager, } from "./noop/index.js";
53
+ /* ─── Observability Facade ──────────────────────────────────────────────── */
54
+ export { DefaultObservability, createObservability, } from "./observability/index.js";
55
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,+EAA+E;AAE/E,OAAO,EACL,QAAQ,EACR,UAAU,EACV,QAAQ,GA6BT,MAAM,YAAY,CAAC;AAEpB,+EAA+E;AAE/E,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,+EAA+E;AAE/E,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE7E,+EAA+E;AAE/E,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE7E,+EAA+E;AAE/E,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,iBAAiB,EACjB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAEhC,+EAA+E;AAE/E,OAAO,EACL,cAAc,EACd,aAAa,EACb,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAE5B,+EAA+E;AAE/E,OAAO,EACL,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,aAAa,EACb,YAAY,GACb,MAAM,oBAAoB,CAAC;AAE5B,+EAA+E;AAE/E,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,qBAAqB,CAAC;AAE7B,+EAA+E;AAE/E,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,yBAAyB,EACzB,wBAAwB,EACxB,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC;AAE7B,+EAA+E;AAE/E,OAAO,EACL,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAE9B,+EAA+E;AAE/E,OAAO,EACL,cAAc,EACd,YAAY,EACZ,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAE9B,+EAA+E;AAE/E,OAAO,EACL,iBAAiB,EACjB,uBAAuB,EACvB,UAAU,EACV,WAAW,EACX,SAAS,EACT,aAAa,EACb,mBAAmB,EACnB,QAAQ,EACR,UAAU,EACV,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AAEzB,+EAA+E;AAE/E,OAAO,EACL,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @zudojs/observability — Log Level
3
+ *
4
+ * Level names, conversion, and filtering utilities.
5
+ */
6
+ export { logLevelToName, logLevelFromName, shouldLog, getLogLevelNames, } from "./logLevel.type.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logLevel/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,gBAAgB,GACjB,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @zudojs/observability — Log Level
3
+ *
4
+ * Level names, conversion, and filtering utilities.
5
+ */
6
+ export { logLevelToName, logLevelFromName, shouldLog, getLogLevelNames, } from "./logLevel.type.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/logLevel/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,gBAAgB,GACjB,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @zudojs/observability — Log Level
3
+ *
4
+ * Utility functions for converting between log levels and names,
5
+ * and checking whether a message should be logged.
6
+ */
7
+ import { LogLevel, type LogLevelName } from "../types.js";
8
+ /** Converts a numeric level to its name. */
9
+ export declare function logLevelToName(level: LogLevel): LogLevelName;
10
+ /** Converts a level name to its numeric value. */
11
+ export declare function logLevelFromName(name: LogLevelName): LogLevel;
12
+ /** Returns true if a message at `messageLevel` should pass the `threshold`. */
13
+ export declare function shouldLog(threshold: LogLevel, messageLevel: LogLevel): boolean;
14
+ /** Returns all log level names. */
15
+ export declare function getLogLevelNames(): readonly LogLevelName[];
16
+ //# sourceMappingURL=logLevel.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logLevel.type.d.ts","sourceRoot":"","sources":["../../src/logLevel/logLevel.type.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAsB1D,4CAA4C;AAC5C,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,GAAG,YAAY,CAE5D;AAED,kDAAkD;AAClD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,YAAY,GAAG,QAAQ,CAE7D;AAED,+EAA+E;AAC/E,wBAAgB,SAAS,CACvB,SAAS,EAAE,QAAQ,EACnB,YAAY,EAAE,QAAQ,GACrB,OAAO,CAET;AAED,mCAAmC;AACnC,wBAAgB,gBAAgB,IAAI,SAAS,YAAY,EAAE,CAE1D"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @zudojs/observability — Log Level
3
+ *
4
+ * Utility functions for converting between log levels and names,
5
+ * and checking whether a message should be logged.
6
+ */
7
+ import { LogLevel } from "../types.js";
8
+ const LEVEL_NAMES = [
9
+ "trace",
10
+ "debug",
11
+ "info",
12
+ "warn",
13
+ "error",
14
+ "fatal",
15
+ "off",
16
+ ];
17
+ const NAME_TO_LEVEL = new Map([
18
+ ["trace", LogLevel.TRACE],
19
+ ["debug", LogLevel.DEBUG],
20
+ ["info", LogLevel.INFO],
21
+ ["warn", LogLevel.WARN],
22
+ ["error", LogLevel.ERROR],
23
+ ["fatal", LogLevel.FATAL],
24
+ ["off", LogLevel.OFF],
25
+ ]);
26
+ /** Converts a numeric level to its name. */
27
+ export function logLevelToName(level) {
28
+ return LEVEL_NAMES[level] ?? "off";
29
+ }
30
+ /** Converts a level name to its numeric value. */
31
+ export function logLevelFromName(name) {
32
+ return NAME_TO_LEVEL.get(name) ?? LogLevel.OFF;
33
+ }
34
+ /** Returns true if a message at `messageLevel` should pass the `threshold`. */
35
+ export function shouldLog(threshold, messageLevel) {
36
+ return messageLevel >= threshold;
37
+ }
38
+ /** Returns all log level names. */
39
+ export function getLogLevelNames() {
40
+ return LEVEL_NAMES;
41
+ }
42
+ //# sourceMappingURL=logLevel.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logLevel.type.js","sourceRoot":"","sources":["../../src/logLevel/logLevel.type.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAqB,MAAM,aAAa,CAAC;AAE1D,MAAM,WAAW,GAA4B;IAC3C,OAAO;IACP,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,KAAK;CACN,CAAC;AAEF,MAAM,aAAa,GAAwC,IAAI,GAAG,CAAC;IACjE,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC;IACzB,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC;IACzB,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC;IACzB,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC;IACzB,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC;CACtB,CAAC,CAAC;AAEH,4CAA4C;AAC5C,MAAM,UAAU,cAAc,CAAC,KAAe;IAC5C,OAAO,WAAW,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC;AACrC,CAAC;AAED,kDAAkD;AAClD,MAAM,UAAU,gBAAgB,CAAC,IAAkB;IACjD,OAAO,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC;AACjD,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,SAAS,CACvB,SAAmB,EACnB,YAAsB;IAEtB,OAAO,YAAY,IAAI,SAAS,CAAC;AACnC,CAAC;AAED,mCAAmC;AACnC,MAAM,UAAU,gBAAgB;IAC9B,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @zudojs/observability — Log Record
3
+ *
4
+ * Structured log record creation and error log records.
5
+ */
6
+ export { createLogRecord, createErrorLogRecord } from "./logRecord.core.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logRecord/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @zudojs/observability — Log Record
3
+ *
4
+ * Structured log record creation and error log records.
5
+ */
6
+ export { createLogRecord, createErrorLogRecord } from "./logRecord.core.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/logRecord/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @zudojs/observability — Log Record
3
+ *
4
+ * Factory functions for creating structured log records.
5
+ */
6
+ import type { LogRecord } from "../types.js";
7
+ import { LogLevel } from "../types.js";
8
+ /** Creates a structured log record. */
9
+ export declare function createLogRecord(options: {
10
+ readonly level: LogLevel;
11
+ readonly message: string;
12
+ readonly loggerName: string;
13
+ readonly context?: Record<string, unknown>;
14
+ readonly error?: Error;
15
+ }): LogRecord;
16
+ /** Creates a log record for an error. */
17
+ export declare function createErrorLogRecord(error: Error, level: LogLevel, loggerName: string): LogRecord;
18
+ //# sourceMappingURL=logRecord.core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logRecord.core.d.ts","sourceRoot":"","sources":["../../src/logRecord/logRecord.core.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAqB,MAAM,aAAa,CAAC;AAE1D,uCAAuC;AACvC,wBAAgB,eAAe,CAAC,OAAO,EAAE;IACvC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;CACxB,GAAG,SAAS,CAmBZ;AAED,yCAAyC;AACzC,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,QAAQ,EACf,UAAU,EAAE,MAAM,GACjB,SAAS,CAQX"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @zudojs/observability — Log Record
3
+ *
4
+ * Factory functions for creating structured log records.
5
+ */
6
+ import { LogLevel } from "../types.js";
7
+ /** Creates a structured log record. */
8
+ export function createLogRecord(options) {
9
+ const error = options.error
10
+ ? {
11
+ name: options.error.name,
12
+ message: options.error.message,
13
+ stack: options.error.stack,
14
+ cause: options.error.cause,
15
+ }
16
+ : undefined;
17
+ return {
18
+ level: options.level,
19
+ levelName: logLevelToNameInternal(options.level),
20
+ message: options.message,
21
+ timestamp: new Date(),
22
+ loggerName: options.loggerName,
23
+ context: options.context,
24
+ error,
25
+ };
26
+ }
27
+ /** Creates a log record for an error. */
28
+ export function createErrorLogRecord(error, level, loggerName) {
29
+ return createLogRecord({
30
+ level,
31
+ message: error.message,
32
+ loggerName,
33
+ context: { stack: error.stack },
34
+ error,
35
+ });
36
+ }
37
+ function logLevelToNameInternal(level) {
38
+ const names = {
39
+ [LogLevel.TRACE]: "trace",
40
+ [LogLevel.DEBUG]: "debug",
41
+ [LogLevel.INFO]: "info",
42
+ [LogLevel.WARN]: "warn",
43
+ [LogLevel.ERROR]: "error",
44
+ [LogLevel.FATAL]: "fatal",
45
+ [LogLevel.OFF]: "off",
46
+ };
47
+ return names[level] ?? "off";
48
+ }
49
+ //# sourceMappingURL=logRecord.core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logRecord.core.js","sourceRoot":"","sources":["../../src/logRecord/logRecord.core.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,QAAQ,EAAqB,MAAM,aAAa,CAAC;AAE1D,uCAAuC;AACvC,MAAM,UAAU,eAAe,CAAC,OAM/B;IACC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK;QACzB,CAAC,CAAC;YACE,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI;YACxB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,OAAO;YAC9B,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK;YAC1B,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK;SAC3B;QACH,CAAC,CAAC,SAAS,CAAC;IAEd,OAAO;QACL,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,SAAS,EAAE,sBAAsB,CAAC,OAAO,CAAC,KAAK,CAAC;QAChD,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,SAAS,EAAE,IAAI,IAAI,EAAE;QACrB,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,KAAK;KACN,CAAC;AACJ,CAAC;AAED,yCAAyC;AACzC,MAAM,UAAU,oBAAoB,CAClC,KAAY,EACZ,KAAe,EACf,UAAkB;IAElB,OAAO,eAAe,CAAC;QACrB,KAAK;QACL,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,UAAU;QACV,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE;QAC/B,KAAK;KACN,CAAC,CAAC;AACL,CAAC;AAED,SAAS,sBAAsB,CAAC,KAAe;IAC7C,MAAM,KAAK,GAAiC;QAC1C,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO;QACzB,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO;QACzB,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM;QACvB,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM;QACvB,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO;QACzB,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO;QACzB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK;KACtB,CAAC;IACF,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @zudojs/observability — Logger
3
+ *
4
+ * Structured logger with level filtering, child loggers, and transport support.
5
+ */
6
+ export { StructuredLogger, createStructuredLogger } from "./logger.core.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logger/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @zudojs/observability — Logger
3
+ *
4
+ * Structured logger with level filtering, child loggers, and transport support.
5
+ */
6
+ export { StructuredLogger, createStructuredLogger } from "./logger.core.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/logger/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @zudojs/observability — Logger Core
3
+ *
4
+ * Structured logger implementation with level filtering, transport support,
5
+ * child loggers, and persistent context.
6
+ */
7
+ import type { Logger, LoggerOptions } from "../types.js";
8
+ import { LogLevel } from "../types.js";
9
+ /**
10
+ * Core structured logger with level filtering, child loggers,
11
+ * persistent context, and transport support.
12
+ */
13
+ export declare class StructuredLogger implements Logger {
14
+ readonly name: string;
15
+ readonly level: LogLevel;
16
+ private readonly context;
17
+ private readonly transport;
18
+ constructor(options: LoggerOptions);
19
+ trace(message: string, context?: Record<string, unknown>): void;
20
+ debug(message: string, context?: Record<string, unknown>): void;
21
+ info(message: string, context?: Record<string, unknown>): void;
22
+ warn(message: string, context?: Record<string, unknown>): void;
23
+ error(message: string, context?: Record<string, unknown>): void;
24
+ fatal(message: string, context?: Record<string, unknown>): void;
25
+ child(name: string, context?: Record<string, unknown>): Logger;
26
+ isLevelEnabled(level: LogLevel): boolean;
27
+ flush(): Promise<void>;
28
+ private log;
29
+ }
30
+ /** Creates a structured logger. */
31
+ export declare function createStructuredLogger(options: LoggerOptions): Structu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