vedatrace 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +53 -5
- package/dist/index.d.cts +18 -5
- package/dist/index.d.mts +18 -5
- package/dist/index.mjs +52 -6
- package/dist/integrations/express.d.cts +1 -1
- package/dist/integrations/express.d.mts +1 -1
- package/dist/integrations/nextjs.d.cts +1 -1
- package/dist/integrations/nextjs.d.mts +1 -1
- package/dist/integrations/react.d.cts +1 -1
- package/dist/integrations/react.d.mts +1 -1
- package/dist/transports/index.d.cts +1 -1
- package/dist/transports/index.d.mts +1 -1
- package/dist/{types-CcdFb-vY.d.cts → types-DUNRMOTv.d.cts} +9 -1
- package/dist/{types-CcdFb-vY.d.mts → types-DUNRMOTv.d.mts} +9 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5,13 +5,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var transports_index = require('./transports/index.cjs');
|
|
6
6
|
|
|
7
7
|
class VedaTraceBatcher {
|
|
8
|
-
constructor(transports, config, onError, onSuccess, immediateFlush = false) {
|
|
8
|
+
constructor(transports, config, onError, onSuccess, immediateFlush = false, autoStart = false) {
|
|
9
9
|
this.transports = transports;
|
|
10
10
|
this.config = config;
|
|
11
11
|
this.onError = onError;
|
|
12
12
|
this.onSuccess = onSuccess;
|
|
13
13
|
this.immediateFlush = immediateFlush;
|
|
14
|
-
|
|
14
|
+
if (autoStart && !immediateFlush) {
|
|
15
|
+
this.startFlushTimer();
|
|
16
|
+
}
|
|
15
17
|
}
|
|
16
18
|
queue = [];
|
|
17
19
|
flushTimer = null;
|
|
@@ -100,6 +102,12 @@ class VedaTraceBatcher {
|
|
|
100
102
|
this.flushTimer = null;
|
|
101
103
|
}
|
|
102
104
|
}
|
|
105
|
+
/** Start the flush timer (for manual control in edge runtimes) */
|
|
106
|
+
start() {
|
|
107
|
+
if (!this.flushTimer && !this.immediateFlush) {
|
|
108
|
+
this.startFlushTimer();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
103
111
|
/** Delay helper */
|
|
104
112
|
delay(ms) {
|
|
105
113
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -110,12 +118,39 @@ class VedaTraceBatcher {
|
|
|
110
118
|
}
|
|
111
119
|
}
|
|
112
120
|
|
|
121
|
+
function detectRuntime() {
|
|
122
|
+
if (typeof process !== "undefined" && process.versions?.node) {
|
|
123
|
+
return "node";
|
|
124
|
+
}
|
|
125
|
+
if (typeof globalThis !== "undefined" && "navigator" in globalThis && typeof self === "undefined") {
|
|
126
|
+
return "browser";
|
|
127
|
+
}
|
|
128
|
+
if (typeof caches !== "undefined") {
|
|
129
|
+
return "cloudflare";
|
|
130
|
+
}
|
|
131
|
+
const maybeDeno = globalThis;
|
|
132
|
+
if (maybeDeno?.version) {
|
|
133
|
+
return "deno";
|
|
134
|
+
}
|
|
135
|
+
const maybeBun = globalThis;
|
|
136
|
+
if (maybeBun?.Bun) {
|
|
137
|
+
return "bun";
|
|
138
|
+
}
|
|
139
|
+
return "edge";
|
|
140
|
+
}
|
|
141
|
+
function isEdgeRuntime() {
|
|
142
|
+
const runtime = detectRuntime();
|
|
143
|
+
return runtime === "cloudflare" || runtime === "deno" || runtime === "bun" || runtime === "edge";
|
|
144
|
+
}
|
|
145
|
+
|
|
113
146
|
const SDK_VERSION = "1.0.0";
|
|
114
147
|
class VedaTraceLogger {
|
|
115
148
|
batcher = null;
|
|
149
|
+
runtime;
|
|
116
150
|
config;
|
|
117
151
|
childDefaults;
|
|
118
152
|
constructor(config = {}, childDefaults = {}) {
|
|
153
|
+
this.runtime = config.runtime ?? detectRuntime();
|
|
119
154
|
this.childDefaults = childDefaults;
|
|
120
155
|
this.config = {
|
|
121
156
|
service: config.service,
|
|
@@ -238,7 +273,13 @@ class VedaTraceLogger {
|
|
|
238
273
|
this.batcher.stop();
|
|
239
274
|
}
|
|
240
275
|
}
|
|
241
|
-
/**
|
|
276
|
+
/** Start the flush timer (for manual control in edge runtimes) */
|
|
277
|
+
start() {
|
|
278
|
+
if (this.batcher) {
|
|
279
|
+
this.batcher.start();
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
/** Detect runtime environment (legacy, kept for compatibility) */
|
|
242
283
|
detectEnvironment() {
|
|
243
284
|
if (typeof globalThis !== "undefined" && "navigator" in globalThis) {
|
|
244
285
|
return "browser";
|
|
@@ -326,6 +367,9 @@ function redactPii(value, mask) {
|
|
|
326
367
|
|
|
327
368
|
function vedatrace(config = {}) {
|
|
328
369
|
const logger = new VedaTraceLogger(config);
|
|
370
|
+
const isEdge = isEdgeRuntime();
|
|
371
|
+
const shouldImmediateFlush = config.immediateFlush ?? isEdge;
|
|
372
|
+
const shouldAutoStart = config.autoStart ?? !isEdge;
|
|
329
373
|
if (config.apiKey && (!config.transports || config.transports.length === 0)) {
|
|
330
374
|
const httpConfig = { apiKey: config.apiKey };
|
|
331
375
|
if (config.endpoint) httpConfig.endpoint = config.endpoint;
|
|
@@ -334,13 +378,15 @@ function vedatrace(config = {}) {
|
|
|
334
378
|
[httpTransport],
|
|
335
379
|
{
|
|
336
380
|
batchSize: config.batchSize ?? 100,
|
|
337
|
-
flushInterval: config.flushInterval ?? 1e3,
|
|
381
|
+
flushInterval: config.flushInterval ?? (isEdge ? 1e3 : 5e3),
|
|
338
382
|
maxRetries: config.maxRetries ?? 3,
|
|
339
383
|
retryDelay: config.retryDelay ?? 1e3,
|
|
340
384
|
unrefTimer: config.unrefTimer
|
|
341
385
|
},
|
|
342
386
|
config.onError,
|
|
343
|
-
config.onSuccess
|
|
387
|
+
config.onSuccess,
|
|
388
|
+
shouldImmediateFlush,
|
|
389
|
+
shouldAutoStart
|
|
344
390
|
);
|
|
345
391
|
logger.setBatcher(batcher);
|
|
346
392
|
if (typeof process !== "undefined") {
|
|
@@ -372,6 +418,8 @@ exports.VedaTraceHttpTransport = transports_index.VedaTraceHttpTransport;
|
|
|
372
418
|
exports.VedaTraceBatcher = VedaTraceBatcher;
|
|
373
419
|
exports.VedaTraceLogger = VedaTraceLogger;
|
|
374
420
|
exports.default = vedatrace;
|
|
421
|
+
exports.detectRuntime = detectRuntime;
|
|
375
422
|
exports.devVedatrace = devVedatrace;
|
|
423
|
+
exports.isEdgeRuntime = isEdgeRuntime;
|
|
376
424
|
exports.redact = redact;
|
|
377
425
|
exports.vedatrace = vedatrace;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as VedaTraceTransport, B as BatcherConfig, I as InternalLogEntry, V as VedaTraceLoggerInterface, a as VedaTraceConfig, L as LogMetadata,
|
|
2
|
-
export {
|
|
1
|
+
import { b as VedaTraceTransport, B as BatcherConfig, I as InternalLogEntry, V as VedaTraceLoggerInterface, R as RuntimeType$1, a as VedaTraceConfig, L as LogMetadata, c as RedactionConfig } from './types-DUNRMOTv.cjs';
|
|
2
|
+
export { d as VedaTraceLevel, e as VedaTraceLog } from './types-DUNRMOTv.cjs';
|
|
3
3
|
export { ConsoleFormat, ConsoleTransportConfig, HttpTransportConfig, VedaTraceConsoleTransport, VedaTraceHttpTransport } from './transports/index.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -17,7 +17,7 @@ declare class VedaTraceBatcher {
|
|
|
17
17
|
private flushTimer;
|
|
18
18
|
private isFlushing;
|
|
19
19
|
private pendingFlush;
|
|
20
|
-
constructor(transports: VedaTraceTransport[], config: BatcherConfig, onError?: ((error: Error) => void) | undefined, onSuccess?: (() => void) | undefined, immediateFlush?: boolean);
|
|
20
|
+
constructor(transports: VedaTraceTransport[], config: BatcherConfig, onError?: ((error: Error) => void) | undefined, onSuccess?: (() => void) | undefined, immediateFlush?: boolean, autoStart?: boolean);
|
|
21
21
|
/** Add log to queue */
|
|
22
22
|
add(log: InternalLogEntry): void;
|
|
23
23
|
/** Flush logs to all transports */
|
|
@@ -28,6 +28,8 @@ declare class VedaTraceBatcher {
|
|
|
28
28
|
private startFlushTimer;
|
|
29
29
|
/** Stop the flush timer */
|
|
30
30
|
stop(): void;
|
|
31
|
+
/** Start the flush timer (for manual control in edge runtimes) */
|
|
32
|
+
start(): void;
|
|
31
33
|
/** Delay helper */
|
|
32
34
|
private delay;
|
|
33
35
|
/** Get current queue size */
|
|
@@ -40,6 +42,7 @@ declare class VedaTraceBatcher {
|
|
|
40
42
|
|
|
41
43
|
declare class VedaTraceLogger implements VedaTraceLoggerInterface {
|
|
42
44
|
private batcher;
|
|
45
|
+
runtime: RuntimeType$1;
|
|
43
46
|
private config;
|
|
44
47
|
private childDefaults;
|
|
45
48
|
constructor(config?: VedaTraceConfig, childDefaults?: LogMetadata);
|
|
@@ -65,7 +68,9 @@ declare class VedaTraceLogger implements VedaTraceLoggerInterface {
|
|
|
65
68
|
flush(): Promise<void>;
|
|
66
69
|
/** Stop the batcher and flush timer */
|
|
67
70
|
stop(): void;
|
|
68
|
-
/**
|
|
71
|
+
/** Start the flush timer (for manual control in edge runtimes) */
|
|
72
|
+
start(): void;
|
|
73
|
+
/** Detect runtime environment (legacy, kept for compatibility) */
|
|
69
74
|
private detectEnvironment;
|
|
70
75
|
}
|
|
71
76
|
|
|
@@ -78,6 +83,14 @@ declare class VedaTraceLogger implements VedaTraceLoggerInterface {
|
|
|
78
83
|
*/
|
|
79
84
|
declare function redact(obj: unknown, config?: RedactionConfig): unknown;
|
|
80
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Runtime environment detection utility
|
|
88
|
+
* Detects Node.js, Browser, Cloudflare Workers, Deno, Bun
|
|
89
|
+
*/
|
|
90
|
+
type RuntimeType = "node" | "browser" | "cloudflare" | "deno" | "bun" | "edge";
|
|
91
|
+
declare function detectRuntime(): RuntimeType;
|
|
92
|
+
declare function isEdgeRuntime(): boolean;
|
|
93
|
+
|
|
81
94
|
/**
|
|
82
95
|
* VedaTrace SDK - Universal JavaScript logging
|
|
83
96
|
*
|
|
@@ -112,4 +125,4 @@ declare function vedatrace(config?: VedaTraceConfig): VedaTraceLoggerInterface;
|
|
|
112
125
|
*/
|
|
113
126
|
declare function devVedatrace(config?: Omit<VedaTraceConfig, "apiKey" | "transports">): VedaTraceLoggerInterface;
|
|
114
127
|
|
|
115
|
-
export { BatcherConfig, InternalLogEntry, LogMetadata, RedactionConfig, VedaTraceBatcher, VedaTraceConfig, VedaTraceLogger, VedaTraceLoggerInterface, VedaTraceTransport, vedatrace as default, devVedatrace, redact, vedatrace };
|
|
128
|
+
export { BatcherConfig, InternalLogEntry, LogMetadata, RedactionConfig, RuntimeType$1 as RuntimeType, VedaTraceBatcher, VedaTraceConfig, VedaTraceLogger, VedaTraceLoggerInterface, VedaTraceTransport, vedatrace as default, detectRuntime, devVedatrace, isEdgeRuntime, redact, vedatrace };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as VedaTraceTransport, B as BatcherConfig, I as InternalLogEntry, V as VedaTraceLoggerInterface, a as VedaTraceConfig, L as LogMetadata,
|
|
2
|
-
export {
|
|
1
|
+
import { b as VedaTraceTransport, B as BatcherConfig, I as InternalLogEntry, V as VedaTraceLoggerInterface, R as RuntimeType$1, a as VedaTraceConfig, L as LogMetadata, c as RedactionConfig } from './types-DUNRMOTv.mjs';
|
|
2
|
+
export { d as VedaTraceLevel, e as VedaTraceLog } from './types-DUNRMOTv.mjs';
|
|
3
3
|
export { ConsoleFormat, ConsoleTransportConfig, HttpTransportConfig, VedaTraceConsoleTransport, VedaTraceHttpTransport } from './transports/index.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -17,7 +17,7 @@ declare class VedaTraceBatcher {
|
|
|
17
17
|
private flushTimer;
|
|
18
18
|
private isFlushing;
|
|
19
19
|
private pendingFlush;
|
|
20
|
-
constructor(transports: VedaTraceTransport[], config: BatcherConfig, onError?: ((error: Error) => void) | undefined, onSuccess?: (() => void) | undefined, immediateFlush?: boolean);
|
|
20
|
+
constructor(transports: VedaTraceTransport[], config: BatcherConfig, onError?: ((error: Error) => void) | undefined, onSuccess?: (() => void) | undefined, immediateFlush?: boolean, autoStart?: boolean);
|
|
21
21
|
/** Add log to queue */
|
|
22
22
|
add(log: InternalLogEntry): void;
|
|
23
23
|
/** Flush logs to all transports */
|
|
@@ -28,6 +28,8 @@ declare class VedaTraceBatcher {
|
|
|
28
28
|
private startFlushTimer;
|
|
29
29
|
/** Stop the flush timer */
|
|
30
30
|
stop(): void;
|
|
31
|
+
/** Start the flush timer (for manual control in edge runtimes) */
|
|
32
|
+
start(): void;
|
|
31
33
|
/** Delay helper */
|
|
32
34
|
private delay;
|
|
33
35
|
/** Get current queue size */
|
|
@@ -40,6 +42,7 @@ declare class VedaTraceBatcher {
|
|
|
40
42
|
|
|
41
43
|
declare class VedaTraceLogger implements VedaTraceLoggerInterface {
|
|
42
44
|
private batcher;
|
|
45
|
+
runtime: RuntimeType$1;
|
|
43
46
|
private config;
|
|
44
47
|
private childDefaults;
|
|
45
48
|
constructor(config?: VedaTraceConfig, childDefaults?: LogMetadata);
|
|
@@ -65,7 +68,9 @@ declare class VedaTraceLogger implements VedaTraceLoggerInterface {
|
|
|
65
68
|
flush(): Promise<void>;
|
|
66
69
|
/** Stop the batcher and flush timer */
|
|
67
70
|
stop(): void;
|
|
68
|
-
/**
|
|
71
|
+
/** Start the flush timer (for manual control in edge runtimes) */
|
|
72
|
+
start(): void;
|
|
73
|
+
/** Detect runtime environment (legacy, kept for compatibility) */
|
|
69
74
|
private detectEnvironment;
|
|
70
75
|
}
|
|
71
76
|
|
|
@@ -78,6 +83,14 @@ declare class VedaTraceLogger implements VedaTraceLoggerInterface {
|
|
|
78
83
|
*/
|
|
79
84
|
declare function redact(obj: unknown, config?: RedactionConfig): unknown;
|
|
80
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Runtime environment detection utility
|
|
88
|
+
* Detects Node.js, Browser, Cloudflare Workers, Deno, Bun
|
|
89
|
+
*/
|
|
90
|
+
type RuntimeType = "node" | "browser" | "cloudflare" | "deno" | "bun" | "edge";
|
|
91
|
+
declare function detectRuntime(): RuntimeType;
|
|
92
|
+
declare function isEdgeRuntime(): boolean;
|
|
93
|
+
|
|
81
94
|
/**
|
|
82
95
|
* VedaTrace SDK - Universal JavaScript logging
|
|
83
96
|
*
|
|
@@ -112,4 +125,4 @@ declare function vedatrace(config?: VedaTraceConfig): VedaTraceLoggerInterface;
|
|
|
112
125
|
*/
|
|
113
126
|
declare function devVedatrace(config?: Omit<VedaTraceConfig, "apiKey" | "transports">): VedaTraceLoggerInterface;
|
|
114
127
|
|
|
115
|
-
export { BatcherConfig, InternalLogEntry, LogMetadata, RedactionConfig, VedaTraceBatcher, VedaTraceConfig, VedaTraceLogger, VedaTraceLoggerInterface, VedaTraceTransport, vedatrace as default, devVedatrace, redact, vedatrace };
|
|
128
|
+
export { BatcherConfig, InternalLogEntry, LogMetadata, RedactionConfig, RuntimeType$1 as RuntimeType, VedaTraceBatcher, VedaTraceConfig, VedaTraceLogger, VedaTraceLoggerInterface, VedaTraceTransport, vedatrace as default, detectRuntime, devVedatrace, isEdgeRuntime, redact, vedatrace };
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { VedaTraceHttpTransport, VedaTraceConsoleTransport } from './transports/index.mjs';
|
|
2
2
|
|
|
3
3
|
class VedaTraceBatcher {
|
|
4
|
-
constructor(transports, config, onError, onSuccess, immediateFlush = false) {
|
|
4
|
+
constructor(transports, config, onError, onSuccess, immediateFlush = false, autoStart = false) {
|
|
5
5
|
this.transports = transports;
|
|
6
6
|
this.config = config;
|
|
7
7
|
this.onError = onError;
|
|
8
8
|
this.onSuccess = onSuccess;
|
|
9
9
|
this.immediateFlush = immediateFlush;
|
|
10
|
-
|
|
10
|
+
if (autoStart && !immediateFlush) {
|
|
11
|
+
this.startFlushTimer();
|
|
12
|
+
}
|
|
11
13
|
}
|
|
12
14
|
queue = [];
|
|
13
15
|
flushTimer = null;
|
|
@@ -96,6 +98,12 @@ class VedaTraceBatcher {
|
|
|
96
98
|
this.flushTimer = null;
|
|
97
99
|
}
|
|
98
100
|
}
|
|
101
|
+
/** Start the flush timer (for manual control in edge runtimes) */
|
|
102
|
+
start() {
|
|
103
|
+
if (!this.flushTimer && !this.immediateFlush) {
|
|
104
|
+
this.startFlushTimer();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
99
107
|
/** Delay helper */
|
|
100
108
|
delay(ms) {
|
|
101
109
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -106,12 +114,39 @@ class VedaTraceBatcher {
|
|
|
106
114
|
}
|
|
107
115
|
}
|
|
108
116
|
|
|
117
|
+
function detectRuntime() {
|
|
118
|
+
if (typeof process !== "undefined" && process.versions?.node) {
|
|
119
|
+
return "node";
|
|
120
|
+
}
|
|
121
|
+
if (typeof globalThis !== "undefined" && "navigator" in globalThis && typeof self === "undefined") {
|
|
122
|
+
return "browser";
|
|
123
|
+
}
|
|
124
|
+
if (typeof caches !== "undefined") {
|
|
125
|
+
return "cloudflare";
|
|
126
|
+
}
|
|
127
|
+
const maybeDeno = globalThis;
|
|
128
|
+
if (maybeDeno?.version) {
|
|
129
|
+
return "deno";
|
|
130
|
+
}
|
|
131
|
+
const maybeBun = globalThis;
|
|
132
|
+
if (maybeBun?.Bun) {
|
|
133
|
+
return "bun";
|
|
134
|
+
}
|
|
135
|
+
return "edge";
|
|
136
|
+
}
|
|
137
|
+
function isEdgeRuntime() {
|
|
138
|
+
const runtime = detectRuntime();
|
|
139
|
+
return runtime === "cloudflare" || runtime === "deno" || runtime === "bun" || runtime === "edge";
|
|
140
|
+
}
|
|
141
|
+
|
|
109
142
|
const SDK_VERSION = "1.0.0";
|
|
110
143
|
class VedaTraceLogger {
|
|
111
144
|
batcher = null;
|
|
145
|
+
runtime;
|
|
112
146
|
config;
|
|
113
147
|
childDefaults;
|
|
114
148
|
constructor(config = {}, childDefaults = {}) {
|
|
149
|
+
this.runtime = config.runtime ?? detectRuntime();
|
|
115
150
|
this.childDefaults = childDefaults;
|
|
116
151
|
this.config = {
|
|
117
152
|
service: config.service,
|
|
@@ -234,7 +269,13 @@ class VedaTraceLogger {
|
|
|
234
269
|
this.batcher.stop();
|
|
235
270
|
}
|
|
236
271
|
}
|
|
237
|
-
/**
|
|
272
|
+
/** Start the flush timer (for manual control in edge runtimes) */
|
|
273
|
+
start() {
|
|
274
|
+
if (this.batcher) {
|
|
275
|
+
this.batcher.start();
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
/** Detect runtime environment (legacy, kept for compatibility) */
|
|
238
279
|
detectEnvironment() {
|
|
239
280
|
if (typeof globalThis !== "undefined" && "navigator" in globalThis) {
|
|
240
281
|
return "browser";
|
|
@@ -322,6 +363,9 @@ function redactPii(value, mask) {
|
|
|
322
363
|
|
|
323
364
|
function vedatrace(config = {}) {
|
|
324
365
|
const logger = new VedaTraceLogger(config);
|
|
366
|
+
const isEdge = isEdgeRuntime();
|
|
367
|
+
const shouldImmediateFlush = config.immediateFlush ?? isEdge;
|
|
368
|
+
const shouldAutoStart = config.autoStart ?? !isEdge;
|
|
325
369
|
if (config.apiKey && (!config.transports || config.transports.length === 0)) {
|
|
326
370
|
const httpConfig = { apiKey: config.apiKey };
|
|
327
371
|
if (config.endpoint) httpConfig.endpoint = config.endpoint;
|
|
@@ -330,13 +374,15 @@ function vedatrace(config = {}) {
|
|
|
330
374
|
[httpTransport],
|
|
331
375
|
{
|
|
332
376
|
batchSize: config.batchSize ?? 100,
|
|
333
|
-
flushInterval: config.flushInterval ?? 1e3,
|
|
377
|
+
flushInterval: config.flushInterval ?? (isEdge ? 1e3 : 5e3),
|
|
334
378
|
maxRetries: config.maxRetries ?? 3,
|
|
335
379
|
retryDelay: config.retryDelay ?? 1e3,
|
|
336
380
|
unrefTimer: config.unrefTimer
|
|
337
381
|
},
|
|
338
382
|
config.onError,
|
|
339
|
-
config.onSuccess
|
|
383
|
+
config.onSuccess,
|
|
384
|
+
shouldImmediateFlush,
|
|
385
|
+
shouldAutoStart
|
|
340
386
|
);
|
|
341
387
|
logger.setBatcher(batcher);
|
|
342
388
|
if (typeof process !== "undefined") {
|
|
@@ -363,4 +409,4 @@ function devVedatrace(config = {}) {
|
|
|
363
409
|
});
|
|
364
410
|
}
|
|
365
411
|
|
|
366
|
-
export { VedaTraceBatcher, VedaTraceConsoleTransport, VedaTraceHttpTransport, VedaTraceLogger, vedatrace as default, devVedatrace, redact, vedatrace };
|
|
412
|
+
export { VedaTraceBatcher, VedaTraceConsoleTransport, VedaTraceHttpTransport, VedaTraceLogger, vedatrace as default, detectRuntime, devVedatrace, isEdgeRuntime, redact, vedatrace };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Request, Response, NextFunction } from 'express';
|
|
2
|
-
import { V as VedaTraceLoggerInterface, a as VedaTraceConfig, L as LogMetadata } from '../types-
|
|
2
|
+
import { V as VedaTraceLoggerInterface, a as VedaTraceConfig, L as LogMetadata } from '../types-DUNRMOTv.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Express.js middleware integration for VedaTrace
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Request, Response, NextFunction } from 'express';
|
|
2
|
-
import { V as VedaTraceLoggerInterface, a as VedaTraceConfig, L as LogMetadata } from '../types-
|
|
2
|
+
import { V as VedaTraceLoggerInterface, a as VedaTraceConfig, L as LogMetadata } from '../types-DUNRMOTv.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Express.js middleware integration for VedaTrace
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode, ReactElement } from 'react';
|
|
2
|
-
import { a as VedaTraceConfig, V as VedaTraceLoggerInterface, L as LogMetadata } from '../types-
|
|
2
|
+
import { a as VedaTraceConfig, V as VedaTraceLoggerInterface, L as LogMetadata } from '../types-DUNRMOTv.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* React integration for VedaTrace
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode, ReactElement } from 'react';
|
|
2
|
-
import { a as VedaTraceConfig, V as VedaTraceLoggerInterface, L as LogMetadata } from '../types-
|
|
2
|
+
import { a as VedaTraceConfig, V as VedaTraceLoggerInterface, L as LogMetadata } from '../types-DUNRMOTv.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* React integration for VedaTrace
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as VedaTraceLevel, b as VedaTraceTransport, I as InternalLogEntry } from '../types-DUNRMOTv.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Console transport for development/debugging
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as VedaTraceLevel, b as VedaTraceTransport, I as InternalLogEntry } from '../types-DUNRMOTv.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Console transport for development/debugging
|
|
@@ -51,6 +51,10 @@ interface VedaTraceConfig {
|
|
|
51
51
|
immediateFlush?: boolean;
|
|
52
52
|
/** Unref the flush timer (Node.js only, default: false) */
|
|
53
53
|
unrefTimer?: boolean;
|
|
54
|
+
/** Auto-start the flush timer (default: true, auto-disabled for edge runtimes) */
|
|
55
|
+
autoStart?: boolean;
|
|
56
|
+
/** Force a specific runtime (auto-detected by default) */
|
|
57
|
+
runtime?: RuntimeType;
|
|
54
58
|
}
|
|
55
59
|
/** Redaction configuration */
|
|
56
60
|
interface RedactionConfig {
|
|
@@ -61,6 +65,8 @@ interface RedactionConfig {
|
|
|
61
65
|
/** Enable automatic PII detection */
|
|
62
66
|
autoDetectPii?: boolean;
|
|
63
67
|
}
|
|
68
|
+
/** Runtime environment type */
|
|
69
|
+
type RuntimeType = "node" | "browser" | "cloudflare" | "deno" | "bun" | "edge";
|
|
64
70
|
/** Transport interface for sending logs */
|
|
65
71
|
interface VedaTraceTransport {
|
|
66
72
|
/** Transport name */
|
|
@@ -112,6 +118,8 @@ interface VedaTraceLoggerInterface {
|
|
|
112
118
|
child(defaults: LogMetadata): VedaTraceLoggerInterface;
|
|
113
119
|
flush(): Promise<void>;
|
|
114
120
|
stop(): void;
|
|
121
|
+
start(): void;
|
|
122
|
+
runtime: RuntimeType;
|
|
115
123
|
}
|
|
116
124
|
|
|
117
|
-
export type { BatcherConfig as B, InternalLogEntry as I, LogMetadata as L,
|
|
125
|
+
export type { BatcherConfig as B, InternalLogEntry as I, LogMetadata as L, RuntimeType as R, VedaTraceLoggerInterface as V, VedaTraceConfig as a, VedaTraceTransport as b, RedactionConfig as c, VedaTraceLevel as d, VedaTraceLog as e };
|
|
@@ -51,6 +51,10 @@ interface VedaTraceConfig {
|
|
|
51
51
|
immediateFlush?: boolean;
|
|
52
52
|
/** Unref the flush timer (Node.js only, default: false) */
|
|
53
53
|
unrefTimer?: boolean;
|
|
54
|
+
/** Auto-start the flush timer (default: true, auto-disabled for edge runtimes) */
|
|
55
|
+
autoStart?: boolean;
|
|
56
|
+
/** Force a specific runtime (auto-detected by default) */
|
|
57
|
+
runtime?: RuntimeType;
|
|
54
58
|
}
|
|
55
59
|
/** Redaction configuration */
|
|
56
60
|
interface RedactionConfig {
|
|
@@ -61,6 +65,8 @@ interface RedactionConfig {
|
|
|
61
65
|
/** Enable automatic PII detection */
|
|
62
66
|
autoDetectPii?: boolean;
|
|
63
67
|
}
|
|
68
|
+
/** Runtime environment type */
|
|
69
|
+
type RuntimeType = "node" | "browser" | "cloudflare" | "deno" | "bun" | "edge";
|
|
64
70
|
/** Transport interface for sending logs */
|
|
65
71
|
interface VedaTraceTransport {
|
|
66
72
|
/** Transport name */
|
|
@@ -112,6 +118,8 @@ interface VedaTraceLoggerInterface {
|
|
|
112
118
|
child(defaults: LogMetadata): VedaTraceLoggerInterface;
|
|
113
119
|
flush(): Promise<void>;
|
|
114
120
|
stop(): void;
|
|
121
|
+
start(): void;
|
|
122
|
+
runtime: RuntimeType;
|
|
115
123
|
}
|
|
116
124
|
|
|
117
|
-
export type { BatcherConfig as B, InternalLogEntry as I, LogMetadata as L,
|
|
125
|
+
export type { BatcherConfig as B, InternalLogEntry as I, LogMetadata as L, RuntimeType as R, VedaTraceLoggerInterface as V, VedaTraceConfig as a, VedaTraceTransport as b, RedactionConfig as c, VedaTraceLevel as d, VedaTraceLog as e };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vedatrace",
|
|
3
3
|
"description": "Universal JavaScript logging SDK for VedaTrace - type-safe, lightweight, and developer-friendly",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.9",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"setup": "rm -rf node_modules && npm i && git init && husky",
|
|
7
7
|
"prepublishOnly": "npm run build",
|