@loglayer/transport-axiom 2.1.6 → 2.1.7
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 +174 -183
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +112 -105
- package/dist/index.d.ts +112 -105
- package/dist/index.js +150 -183
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,115 +1,122 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { BaseTransport, LogLayerTransportConfig, LogLayerTransportParams } from "@loglayer/transport";
|
|
2
|
+
import { Axiom } from "@axiomhq/js";
|
|
3
3
|
|
|
4
|
+
//#region src/AxiomTransport.d.ts
|
|
4
5
|
interface AxiomFieldNames {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Field name for the log level
|
|
8
|
+
* @default "level"
|
|
9
|
+
*/
|
|
10
|
+
level?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Field name for the log message
|
|
13
|
+
* @default "message"
|
|
14
|
+
*/
|
|
15
|
+
message?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Field name for the timestamp
|
|
18
|
+
* @default "timestamp"
|
|
19
|
+
*/
|
|
20
|
+
timestamp?: string;
|
|
20
21
|
}
|
|
21
22
|
interface AxiomLevelMap {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Mapping for the 'fatal' log level
|
|
25
|
+
* @example 60 or "FATAL"
|
|
26
|
+
*/
|
|
27
|
+
fatal?: string | number;
|
|
28
|
+
/**
|
|
29
|
+
* Mapping for the 'error' log level
|
|
30
|
+
* @example 50 or "ERROR"
|
|
31
|
+
*/
|
|
32
|
+
error?: string | number;
|
|
33
|
+
/**
|
|
34
|
+
* Mapping for the 'warn' log level
|
|
35
|
+
* @example 40 or "WARN"
|
|
36
|
+
*/
|
|
37
|
+
warn?: string | number;
|
|
38
|
+
/**
|
|
39
|
+
* Mapping for the 'info' log level
|
|
40
|
+
* @example 30 or "INFO"
|
|
41
|
+
*/
|
|
42
|
+
info?: string | number;
|
|
43
|
+
/**
|
|
44
|
+
* Mapping for the 'debug' log level
|
|
45
|
+
* @example 20 or "DEBUG"
|
|
46
|
+
*/
|
|
47
|
+
debug?: string | number;
|
|
48
|
+
/**
|
|
49
|
+
* Mapping for the 'trace' log level
|
|
50
|
+
* @example 10 or "TRACE"
|
|
51
|
+
*/
|
|
52
|
+
trace?: string | number;
|
|
52
53
|
}
|
|
53
54
|
interface AxiomTransportConfig extends LogLayerTransportConfig<Axiom> {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
55
|
+
/**
|
|
56
|
+
* The Axiom dataset name to send logs to
|
|
57
|
+
*/
|
|
58
|
+
dataset: string;
|
|
59
|
+
/**
|
|
60
|
+
* Custom field names for the log entry JSON
|
|
61
|
+
* Default: { level: "level", message: "message", timestamp: "timestamp" }
|
|
62
|
+
*/
|
|
63
|
+
fieldNames?: AxiomFieldNames;
|
|
64
|
+
/**
|
|
65
|
+
* Optional function to generate timestamps.
|
|
66
|
+
* If not provided, defaults to ISO string from new Date()
|
|
67
|
+
*/
|
|
68
|
+
timestampFn?: () => string | number;
|
|
69
|
+
/**
|
|
70
|
+
* Optional callback for error handling
|
|
71
|
+
*/
|
|
72
|
+
onError?: (error: Error) => void;
|
|
73
|
+
/**
|
|
74
|
+
* Custom mapping for log levels.
|
|
75
|
+
* Each log level can be mapped to either a string or number.
|
|
76
|
+
* Example: { error: 50, warn: 40, info: 30, debug: 20, trace: 10, fatal: 60 }
|
|
77
|
+
* Example: { error: "ERROR", warn: "WARN", info: "INFO", debug: "DEBUG", trace: "TRACE", fatal: "FATAL" }
|
|
78
|
+
*/
|
|
79
|
+
levelMap?: AxiomLevelMap;
|
|
79
80
|
}
|
|
80
81
|
declare class AxiomTransport extends BaseTransport<Axiom> implements Disposable {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
82
|
+
private dataset;
|
|
83
|
+
private fieldNames;
|
|
84
|
+
private timestampFn?;
|
|
85
|
+
private onError?;
|
|
86
|
+
private exitHandlers;
|
|
87
|
+
private isDisposing;
|
|
88
|
+
private isFlushing;
|
|
89
|
+
private levelMap?;
|
|
90
|
+
constructor(config: AxiomTransportConfig);
|
|
91
|
+
private setupExitHandlers;
|
|
92
|
+
shipToLogger({
|
|
93
|
+
logLevel,
|
|
94
|
+
messages,
|
|
95
|
+
data,
|
|
96
|
+
hasData
|
|
97
|
+
}: LogLayerTransportParams): any[];
|
|
98
|
+
/**
|
|
99
|
+
* Manually flush logs to Axiom.
|
|
100
|
+
* This is automatically called on process exit.
|
|
101
|
+
*/
|
|
102
|
+
private flush;
|
|
103
|
+
/**
|
|
104
|
+
* Synchronously flush logs to Axiom.
|
|
105
|
+
* This is used during process termination (SIGINT/SIGTERM) to ensure logs are written
|
|
106
|
+
* before the process exits.
|
|
107
|
+
* @private
|
|
108
|
+
*/
|
|
109
|
+
private flushSync;
|
|
110
|
+
/**
|
|
111
|
+
* Clean up resources and remove event listeners.
|
|
112
|
+
* This method:
|
|
113
|
+
* 1. Prevents new operations from starting
|
|
114
|
+
* 2. Flushes any pending logs
|
|
115
|
+
* 3. Removes event handlers
|
|
116
|
+
* 4. Waits for any in-progress operations to complete
|
|
117
|
+
*/
|
|
118
|
+
[Symbol.dispose](): Promise<void>;
|
|
113
119
|
}
|
|
114
|
-
|
|
120
|
+
//#endregion
|
|
115
121
|
export { AxiomTransport, type AxiomTransportConfig };
|
|
122
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,187 +1,154 @@
|
|
|
1
|
-
// src/AxiomTransport.ts
|
|
2
1
|
import { BaseTransport } from "@loglayer/transport";
|
|
2
|
+
|
|
3
|
+
//#region src/AxiomTransport.ts
|
|
3
4
|
var AxiomTransport = class extends BaseTransport {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
} finally {
|
|
150
|
-
this.isFlushing = false;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Clean up resources and remove event listeners.
|
|
155
|
-
* This method:
|
|
156
|
-
* 1. Prevents new operations from starting
|
|
157
|
-
* 2. Flushes any pending logs
|
|
158
|
-
* 3. Removes event handlers
|
|
159
|
-
* 4. Waits for any in-progress operations to complete
|
|
160
|
-
*/
|
|
161
|
-
[Symbol.dispose]() {
|
|
162
|
-
if (this.isDisposing) {
|
|
163
|
-
return Promise.resolve();
|
|
164
|
-
}
|
|
165
|
-
this.isDisposing = true;
|
|
166
|
-
for (const cleanup of this.exitHandlers) {
|
|
167
|
-
cleanup();
|
|
168
|
-
}
|
|
169
|
-
this.exitHandlers = [];
|
|
170
|
-
const checkAndFinish = async () => {
|
|
171
|
-
if (!this.isFlushing) {
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
175
|
-
return checkAndFinish();
|
|
176
|
-
};
|
|
177
|
-
return this.flush().then(() => checkAndFinish()).catch((error) => {
|
|
178
|
-
if (this.onError) {
|
|
179
|
-
this.onError(error);
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
export {
|
|
185
|
-
AxiomTransport
|
|
5
|
+
dataset;
|
|
6
|
+
fieldNames;
|
|
7
|
+
timestampFn;
|
|
8
|
+
onError;
|
|
9
|
+
exitHandlers = [];
|
|
10
|
+
isDisposing;
|
|
11
|
+
isFlushing;
|
|
12
|
+
levelMap;
|
|
13
|
+
constructor(config) {
|
|
14
|
+
super(config);
|
|
15
|
+
this.dataset = config.dataset;
|
|
16
|
+
this.fieldNames = {
|
|
17
|
+
level: config.fieldNames?.level ?? "level",
|
|
18
|
+
message: config.fieldNames?.message ?? "message",
|
|
19
|
+
timestamp: config.fieldNames?.timestamp ?? "timestamp"
|
|
20
|
+
};
|
|
21
|
+
this.timestampFn = config.timestampFn;
|
|
22
|
+
this.onError = config.onError;
|
|
23
|
+
this.isDisposing = false;
|
|
24
|
+
this.isFlushing = false;
|
|
25
|
+
this.levelMap = config.levelMap;
|
|
26
|
+
this.setupExitHandlers();
|
|
27
|
+
}
|
|
28
|
+
setupExitHandlers() {
|
|
29
|
+
const beforeExitHandler = async () => {
|
|
30
|
+
if (!this.isDisposing && !this.isFlushing) try {
|
|
31
|
+
await this.flush();
|
|
32
|
+
} catch (error) {
|
|
33
|
+
if (this.onError) this.onError(error);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
process.on("beforeExit", beforeExitHandler);
|
|
37
|
+
this.exitHandlers.push(() => process.off("beforeExit", beforeExitHandler));
|
|
38
|
+
const sigintHandler = () => {
|
|
39
|
+
if (!this.isDisposing && !this.isFlushing) {
|
|
40
|
+
try {
|
|
41
|
+
this.flushSync();
|
|
42
|
+
} catch (error) {
|
|
43
|
+
if (this.onError) this.onError(error);
|
|
44
|
+
}
|
|
45
|
+
process.exit(130);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
process.on("SIGINT", sigintHandler);
|
|
49
|
+
this.exitHandlers.push(() => process.off("SIGINT", sigintHandler));
|
|
50
|
+
const sigtermHandler = () => {
|
|
51
|
+
if (!this.isDisposing && !this.isFlushing) {
|
|
52
|
+
try {
|
|
53
|
+
this.flushSync();
|
|
54
|
+
} catch (error) {
|
|
55
|
+
if (this.onError) this.onError(error);
|
|
56
|
+
}
|
|
57
|
+
process.exit(143);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
process.on("SIGTERM", sigtermHandler);
|
|
61
|
+
this.exitHandlers.push(() => process.off("SIGTERM", sigtermHandler));
|
|
62
|
+
const exitHandler = () => {
|
|
63
|
+
if (!this.isDisposing && !this.isFlushing) {
|
|
64
|
+
this.isFlushing = true;
|
|
65
|
+
try {
|
|
66
|
+
this.flushSync();
|
|
67
|
+
} catch (error) {
|
|
68
|
+
if (this.onError) this.onError(error);
|
|
69
|
+
} finally {
|
|
70
|
+
this.isFlushing = false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
process.on("exit", exitHandler);
|
|
75
|
+
this.exitHandlers.push(() => process.off("exit", exitHandler));
|
|
76
|
+
}
|
|
77
|
+
shipToLogger({ logLevel, messages, data, hasData }) {
|
|
78
|
+
if (this.isDisposing) return messages;
|
|
79
|
+
const message = messages.join(" ");
|
|
80
|
+
const mappedLevel = this.levelMap?.[logLevel] ?? logLevel;
|
|
81
|
+
const logEntry = {
|
|
82
|
+
[this.fieldNames.message]: message,
|
|
83
|
+
[this.fieldNames.level]: mappedLevel,
|
|
84
|
+
[this.fieldNames.timestamp]: this.timestampFn ? this.timestampFn() : (/* @__PURE__ */ new Date()).toISOString()
|
|
85
|
+
};
|
|
86
|
+
if (data && hasData) Object.assign(logEntry, data);
|
|
87
|
+
try {
|
|
88
|
+
this.logger.ingest(this.dataset, [logEntry]);
|
|
89
|
+
} catch (error) {
|
|
90
|
+
if (this.onError) this.onError(error);
|
|
91
|
+
}
|
|
92
|
+
return messages;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Manually flush logs to Axiom.
|
|
96
|
+
* This is automatically called on process exit.
|
|
97
|
+
*/
|
|
98
|
+
async flush() {
|
|
99
|
+
if (this.isFlushing || this.isDisposing) return;
|
|
100
|
+
this.isFlushing = true;
|
|
101
|
+
try {
|
|
102
|
+
await this.logger.flush();
|
|
103
|
+
} catch (error) {
|
|
104
|
+
if (this.onError) this.onError(error);
|
|
105
|
+
} finally {
|
|
106
|
+
this.isFlushing = false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Synchronously flush logs to Axiom.
|
|
111
|
+
* This is used during process termination (SIGINT/SIGTERM) to ensure logs are written
|
|
112
|
+
* before the process exits.
|
|
113
|
+
* @private
|
|
114
|
+
*/
|
|
115
|
+
flushSync() {
|
|
116
|
+
if (this.isFlushing || this.isDisposing) return;
|
|
117
|
+
this.isFlushing = true;
|
|
118
|
+
try {
|
|
119
|
+
Promise.resolve(this.logger.flush()).catch((error) => {
|
|
120
|
+
if (this.onError) this.onError(error);
|
|
121
|
+
});
|
|
122
|
+
} catch (error) {
|
|
123
|
+
if (this.onError) this.onError(error);
|
|
124
|
+
} finally {
|
|
125
|
+
this.isFlushing = false;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Clean up resources and remove event listeners.
|
|
130
|
+
* This method:
|
|
131
|
+
* 1. Prevents new operations from starting
|
|
132
|
+
* 2. Flushes any pending logs
|
|
133
|
+
* 3. Removes event handlers
|
|
134
|
+
* 4. Waits for any in-progress operations to complete
|
|
135
|
+
*/
|
|
136
|
+
[Symbol.dispose]() {
|
|
137
|
+
if (this.isDisposing) return Promise.resolve();
|
|
138
|
+
this.isDisposing = true;
|
|
139
|
+
for (const cleanup of this.exitHandlers) cleanup();
|
|
140
|
+
this.exitHandlers = [];
|
|
141
|
+
const checkAndFinish = async () => {
|
|
142
|
+
if (!this.isFlushing) return;
|
|
143
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
144
|
+
return checkAndFinish();
|
|
145
|
+
};
|
|
146
|
+
return this.flush().then(() => checkAndFinish()).catch((error) => {
|
|
147
|
+
if (this.onError) this.onError(error);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
186
150
|
};
|
|
151
|
+
|
|
152
|
+
//#endregion
|
|
153
|
+
export { AxiomTransport };
|
|
187
154
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/AxiomTransport.ts"],"sourcesContent":["import type { Axiom } from \"@axiomhq/js\";\nimport type { LogLayerTransportConfig, LogLayerTransportParams } from \"@loglayer/transport\";\nimport { BaseTransport } from \"@loglayer/transport\";\n\nexport interface AxiomFieldNames {\n /**\n * Field name for the log level\n * @default \"level\"\n */\n level?: string;\n /**\n * Field name for the log message\n * @default \"message\"\n */\n message?: string;\n /**\n * Field name for the timestamp\n * @default \"timestamp\"\n */\n timestamp?: string;\n}\n\nexport interface AxiomLevelMap {\n /**\n * Mapping for the 'fatal' log level\n * @example 60 or \"FATAL\"\n */\n fatal?: string | number;\n /**\n * Mapping for the 'error' log level\n * @example 50 or \"ERROR\"\n */\n error?: string | number;\n /**\n * Mapping for the 'warn' log level\n * @example 40 or \"WARN\"\n */\n warn?: string | number;\n /**\n * Mapping for the 'info' log level\n * @example 30 or \"INFO\"\n */\n info?: string | number;\n /**\n * Mapping for the 'debug' log level\n * @example 20 or \"DEBUG\"\n */\n debug?: string | number;\n /**\n * Mapping for the 'trace' log level\n * @example 10 or \"TRACE\"\n */\n trace?: string | number;\n}\n\nexport interface AxiomTransportConfig extends LogLayerTransportConfig<Axiom> {\n /**\n * The Axiom dataset name to send logs to\n */\n dataset: string;\n\n /**\n * Custom field names for the log entry JSON\n * Default: { level: \"level\", message: \"message\", timestamp: \"timestamp\" }\n */\n fieldNames?: AxiomFieldNames;\n\n /**\n * Optional function to generate timestamps.\n * If not provided, defaults to ISO string from new Date()\n */\n timestampFn?: () => string | number;\n\n /**\n * Optional callback for error handling\n */\n onError?: (error: Error) => void;\n\n /**\n * Custom mapping for log levels.\n * Each log level can be mapped to either a string or number.\n * Example: { error: 50, warn: 40, info: 30, debug: 20, trace: 10, fatal: 60 }\n * Example: { error: \"ERROR\", warn: \"WARN\", info: \"INFO\", debug: \"DEBUG\", trace: \"TRACE\", fatal: \"FATAL\" }\n */\n levelMap?: AxiomLevelMap;\n}\n\nexport class AxiomTransport extends BaseTransport<Axiom> implements Disposable {\n private dataset: string;\n private fieldNames: Required<AxiomFieldNames>;\n private timestampFn?: () => string | number;\n private onError?: (error: Error) => void;\n private exitHandlers: Array<() => void> = [];\n private isDisposing: boolean;\n private isFlushing: boolean;\n private levelMap?: AxiomLevelMap;\n\n constructor(config: AxiomTransportConfig) {\n super(config);\n this.dataset = config.dataset;\n this.fieldNames = {\n level: config.fieldNames?.level ?? \"level\",\n message: config.fieldNames?.message ?? \"message\",\n timestamp: config.fieldNames?.timestamp ?? \"timestamp\",\n };\n this.timestampFn = config.timestampFn;\n this.onError = config.onError;\n this.isDisposing = false;\n this.isFlushing = false;\n this.levelMap = config.levelMap;\n\n this.setupExitHandlers();\n }\n\n private setupExitHandlers() {\n // Handle graceful shutdowns (allows async operations)\n const beforeExitHandler = async () => {\n if (!this.isDisposing && !this.isFlushing) {\n try {\n await this.flush();\n } catch (error) {\n if (this.onError) {\n this.onError(error as Error);\n }\n }\n }\n };\n process.on(\"beforeExit\", beforeExitHandler);\n this.exitHandlers.push(() => process.off(\"beforeExit\", beforeExitHandler));\n\n // Handle SIGINT (Ctrl+C)\n const sigintHandler = () => {\n if (!this.isDisposing && !this.isFlushing) {\n // Synchronously flush logs to ensure they're written before exit\n try {\n this.flushSync();\n } catch (error) {\n if (this.onError) {\n this.onError(error as Error);\n }\n }\n process.exit(130); // 128 + SIGINT(2)\n }\n };\n process.on(\"SIGINT\", sigintHandler);\n this.exitHandlers.push(() => process.off(\"SIGINT\", sigintHandler));\n\n // Handle SIGTERM\n const sigtermHandler = () => {\n if (!this.isDisposing && !this.isFlushing) {\n // Synchronously flush logs to ensure they're written before exit\n try {\n this.flushSync();\n } catch (error) {\n if (this.onError) {\n this.onError(error as Error);\n }\n }\n process.exit(143); // 128 + SIGTERM(15)\n }\n };\n process.on(\"SIGTERM\", sigtermHandler);\n this.exitHandlers.push(() => process.off(\"SIGTERM\", sigtermHandler));\n\n // Handle exit (must be synchronous)\n const exitHandler = () => {\n if (!this.isDisposing && !this.isFlushing) {\n this.isFlushing = true;\n try {\n // Call flush synchronously since we're in the exit handler\n this.flushSync();\n } catch (error) {\n if (this.onError) {\n this.onError(error as Error);\n }\n } finally {\n this.isFlushing = false;\n }\n }\n };\n process.on(\"exit\", exitHandler);\n this.exitHandlers.push(() => process.off(\"exit\", exitHandler));\n }\n\n shipToLogger({ logLevel, messages, data, hasData }: LogLayerTransportParams): any[] {\n // Don't accept new logs if we're disposing\n if (this.isDisposing) {\n return messages;\n }\n\n // Combine all messages into a single string\n const message = messages.join(\" \");\n\n // Map the log level if a mapping exists\n const mappedLevel = this.levelMap?.[logLevel] ?? logLevel;\n\n // Create the log entry\n const logEntry: Record<string, any> = {\n [this.fieldNames.message]: message,\n [this.fieldNames.level]: mappedLevel,\n [this.fieldNames.timestamp]: this.timestampFn ? this.timestampFn() : new Date().toISOString(),\n };\n\n // Add any additional data\n if (data && hasData) {\n Object.assign(logEntry, data);\n }\n\n // Send to Axiom\n try {\n this.logger.ingest(this.dataset, [logEntry]);\n } catch (error) {\n if (this.onError) {\n this.onError(error as Error);\n }\n }\n\n return messages;\n }\n\n /**\n * Manually flush logs to Axiom.\n * This is automatically called on process exit.\n */\n private async flush(): Promise<void> {\n if (this.isFlushing || this.isDisposing) {\n return;\n }\n\n this.isFlushing = true;\n\n try {\n await this.logger.flush();\n } catch (error) {\n if (this.onError) {\n this.onError(error as Error);\n }\n } finally {\n this.isFlushing = false;\n }\n }\n\n /**\n * Synchronously flush logs to Axiom.\n * This is used during process termination (SIGINT/SIGTERM) to ensure logs are written\n * before the process exits.\n * @private\n */\n private flushSync(): void {\n if (this.isFlushing || this.isDisposing) {\n return;\n }\n\n this.isFlushing = true;\n try {\n // Call flush synchronously and handle the promise immediately\n Promise.resolve(this.logger.flush()).catch((error) => {\n if (this.onError) {\n this.onError(error as Error);\n }\n });\n } catch (error) {\n if (this.onError) {\n this.onError(error as Error);\n }\n } finally {\n this.isFlushing = false;\n }\n }\n\n /**\n * Clean up resources and remove event listeners.\n * This method:\n * 1. Prevents new operations from starting\n * 2. Flushes any pending logs\n * 3. Removes event handlers\n * 4. Waits for any in-progress operations to complete\n */\n [Symbol.dispose](): Promise<void> {\n if (this.isDisposing) {\n return Promise.resolve();\n }\n\n this.isDisposing = true;\n\n // Remove all event listeners\n for (const cleanup of this.exitHandlers) {\n cleanup();\n }\n this.exitHandlers = [];\n\n const checkAndFinish = async () => {\n if (!this.isFlushing) {\n return;\n }\n // Wait a bit and check again if still flushing\n await new Promise((resolve) => setTimeout(resolve, 100));\n return checkAndFinish();\n };\n\n // Flush any remaining logs and wait for completion\n return this.flush()\n .then(() => checkAndFinish())\n .catch((error) => {\n if (this.onError) {\n this.onError(error as Error);\n }\n });\n }\n}\n"],"mappings":";AAEA,SAAS,qBAAqB;AAqFvB,IAAM,iBAAN,cAA6B,cAA2C;AAAA,EACrE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAkC,CAAC;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EAER,YAAY,QAA8B;AACxC,UAAM,MAAM;AACZ,SAAK,UAAU,OAAO;AACtB,SAAK,aAAa;AAAA,MAChB,OAAO,OAAO,YAAY,SAAS;AAAA,MACnC,SAAS,OAAO,YAAY,WAAW;AAAA,MACvC,WAAW,OAAO,YAAY,aAAa;AAAA,IAC7C;AACA,SAAK,cAAc,OAAO;AAC1B,SAAK,UAAU,OAAO;AACtB,SAAK,cAAc;AACnB,SAAK,aAAa;AAClB,SAAK,WAAW,OAAO;AAEvB,SAAK,kBAAkB;AAAA,EACzB;AAAA,EAEQ,oBAAoB;AAE1B,UAAM,oBAAoB,YAAY;AACpC,UAAI,CAAC,KAAK,eAAe,CAAC,KAAK,YAAY;AACzC,YAAI;AACF,gBAAM,KAAK,MAAM;AAAA,QACnB,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AAS;AAChB,eAAK,QAAQ,KAAc;AAAA,QAC7B;AAAA,MACF,CAAC;AAAA,IACH,SAAS,OAAO;AACd,UAAI,KAAK,SAAS;AAChB,aAAK,QAAQ,KAAc;AAAA,MAC7B;AAAA,IACF,UAAE;AACA,WAAK,aAAa;AAAA,IACpB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,CAAC,OAAO,OAAO,IAAmB;AAChC,QAAI,KAAK,aAAa;AACpB,aAAO,QAAQ,QAAQ;AAAA,IACzB;AAEA,SAAK,cAAc;AAGnB,eAAW,WAAW,KAAK,cAAc;AACvC,cAAQ;AAAA,IACV;AACA,SAAK,eAAe,CAAC;AAErB,UAAM,iBAAiB,YAAY;AACjC,UAAI,CAAC,KAAK,YAAY;AACpB;AAAA,MACF;AAEA,YAAM,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,GAAG,CAAC;AACvD,aAAO,eAAe;AAAA,IACxB;AAGA,WAAO,KAAK,MAAM,EACf,KAAK,MAAM,eAAe,CAAC,EAC3B,MAAM,CAAC,UAAU;AAChB,UAAI,KAAK,SAAS;AAChB,aAAK,QAAQ,KAAc;AAAA,MAC7B;AAAA,IACF,CAAC;AAAA,EACL;AACF;","names":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["logEntry: Record<string, any>"],"sources":["../src/AxiomTransport.ts"],"sourcesContent":["import type { Axiom } from \"@axiomhq/js\";\nimport type { LogLayerTransportConfig, LogLayerTransportParams } from \"@loglayer/transport\";\nimport { BaseTransport } from \"@loglayer/transport\";\n\nexport interface AxiomFieldNames {\n /**\n * Field name for the log level\n * @default \"level\"\n */\n level?: string;\n /**\n * Field name for the log message\n * @default \"message\"\n */\n message?: string;\n /**\n * Field name for the timestamp\n * @default \"timestamp\"\n */\n timestamp?: string;\n}\n\nexport interface AxiomLevelMap {\n /**\n * Mapping for the 'fatal' log level\n * @example 60 or \"FATAL\"\n */\n fatal?: string | number;\n /**\n * Mapping for the 'error' log level\n * @example 50 or \"ERROR\"\n */\n error?: string | number;\n /**\n * Mapping for the 'warn' log level\n * @example 40 or \"WARN\"\n */\n warn?: string | number;\n /**\n * Mapping for the 'info' log level\n * @example 30 or \"INFO\"\n */\n info?: string | number;\n /**\n * Mapping for the 'debug' log level\n * @example 20 or \"DEBUG\"\n */\n debug?: string | number;\n /**\n * Mapping for the 'trace' log level\n * @example 10 or \"TRACE\"\n */\n trace?: string | number;\n}\n\nexport interface AxiomTransportConfig extends LogLayerTransportConfig<Axiom> {\n /**\n * The Axiom dataset name to send logs to\n */\n dataset: string;\n\n /**\n * Custom field names for the log entry JSON\n * Default: { level: \"level\", message: \"message\", timestamp: \"timestamp\" }\n */\n fieldNames?: AxiomFieldNames;\n\n /**\n * Optional function to generate timestamps.\n * If not provided, defaults to ISO string from new Date()\n */\n timestampFn?: () => string | number;\n\n /**\n * Optional callback for error handling\n */\n onError?: (error: Error) => void;\n\n /**\n * Custom mapping for log levels.\n * Each log level can be mapped to either a string or number.\n * Example: { error: 50, warn: 40, info: 30, debug: 20, trace: 10, fatal: 60 }\n * Example: { error: \"ERROR\", warn: \"WARN\", info: \"INFO\", debug: \"DEBUG\", trace: \"TRACE\", fatal: \"FATAL\" }\n */\n levelMap?: AxiomLevelMap;\n}\n\nexport class AxiomTransport extends BaseTransport<Axiom> implements Disposable {\n private dataset: string;\n private fieldNames: Required<AxiomFieldNames>;\n private timestampFn?: () => string | number;\n private onError?: (error: Error) => void;\n private exitHandlers: Array<() => void> = [];\n private isDisposing: boolean;\n private isFlushing: boolean;\n private levelMap?: AxiomLevelMap;\n\n constructor(config: AxiomTransportConfig) {\n super(config);\n this.dataset = config.dataset;\n this.fieldNames = {\n level: config.fieldNames?.level ?? \"level\",\n message: config.fieldNames?.message ?? \"message\",\n timestamp: config.fieldNames?.timestamp ?? \"timestamp\",\n };\n this.timestampFn = config.timestampFn;\n this.onError = config.onError;\n this.isDisposing = false;\n this.isFlushing = false;\n this.levelMap = config.levelMap;\n\n this.setupExitHandlers();\n }\n\n private setupExitHandlers() {\n // Handle graceful shutdowns (allows async operations)\n const beforeExitHandler = async () => {\n if (!this.isDisposing && !this.isFlushing) {\n try {\n await this.flush();\n } catch (error) {\n if (this.onError) {\n this.onError(error as Error);\n }\n }\n }\n };\n process.on(\"beforeExit\", beforeExitHandler);\n this.exitHandlers.push(() => process.off(\"beforeExit\", beforeExitHandler));\n\n // Handle SIGINT (Ctrl+C)\n const sigintHandler = () => {\n if (!this.isDisposing && !this.isFlushing) {\n // Synchronously flush logs to ensure they're written before exit\n try {\n this.flushSync();\n } catch (error) {\n if (this.onError) {\n this.onError(error as Error);\n }\n }\n process.exit(130); // 128 + SIGINT(2)\n }\n };\n process.on(\"SIGINT\", sigintHandler);\n this.exitHandlers.push(() => process.off(\"SIGINT\", sigintHandler));\n\n // Handle SIGTERM\n const sigtermHandler = () => {\n if (!this.isDisposing && !this.isFlushing) {\n // Synchronously flush logs to ensure they're written before exit\n try {\n this.flushSync();\n } catch (error) {\n if (this.onError) {\n this.onError(error as Error);\n }\n }\n process.exit(143); // 128 + SIGTERM(15)\n }\n };\n process.on(\"SIGTERM\", sigtermHandler);\n this.exitHandlers.push(() => process.off(\"SIGTERM\", sigtermHandler));\n\n // Handle exit (must be synchronous)\n const exitHandler = () => {\n if (!this.isDisposing && !this.isFlushing) {\n this.isFlushing = true;\n try {\n // Call flush synchronously since we're in the exit handler\n this.flushSync();\n } catch (error) {\n if (this.onError) {\n this.onError(error as Error);\n }\n } finally {\n this.isFlushing = false;\n }\n }\n };\n process.on(\"exit\", exitHandler);\n this.exitHandlers.push(() => process.off(\"exit\", exitHandler));\n }\n\n shipToLogger({ logLevel, messages, data, hasData }: LogLayerTransportParams): any[] {\n // Don't accept new logs if we're disposing\n if (this.isDisposing) {\n return messages;\n }\n\n // Combine all messages into a single string\n const message = messages.join(\" \");\n\n // Map the log level if a mapping exists\n const mappedLevel = this.levelMap?.[logLevel] ?? logLevel;\n\n // Create the log entry\n const logEntry: Record<string, any> = {\n [this.fieldNames.message]: message,\n [this.fieldNames.level]: mappedLevel,\n [this.fieldNames.timestamp]: this.timestampFn ? this.timestampFn() : new Date().toISOString(),\n };\n\n // Add any additional data\n if (data && hasData) {\n Object.assign(logEntry, data);\n }\n\n // Send to Axiom\n try {\n this.logger.ingest(this.dataset, [logEntry]);\n } catch (error) {\n if (this.onError) {\n this.onError(error as Error);\n }\n }\n\n return messages;\n }\n\n /**\n * Manually flush logs to Axiom.\n * This is automatically called on process exit.\n */\n private async flush(): Promise<void> {\n if (this.isFlushing || this.isDisposing) {\n return;\n }\n\n this.isFlushing = true;\n\n try {\n await this.logger.flush();\n } catch (error) {\n if (this.onError) {\n this.onError(error as Error);\n }\n } finally {\n this.isFlushing = false;\n }\n }\n\n /**\n * Synchronously flush logs to Axiom.\n * This is used during process termination (SIGINT/SIGTERM) to ensure logs are written\n * before the process exits.\n * @private\n */\n private flushSync(): void {\n if (this.isFlushing || this.isDisposing) {\n return;\n }\n\n this.isFlushing = true;\n try {\n // Call flush synchronously and handle the promise immediately\n Promise.resolve(this.logger.flush()).catch((error) => {\n if (this.onError) {\n this.onError(error as Error);\n }\n });\n } catch (error) {\n if (this.onError) {\n this.onError(error as Error);\n }\n } finally {\n this.isFlushing = false;\n }\n }\n\n /**\n * Clean up resources and remove event listeners.\n * This method:\n * 1. Prevents new operations from starting\n * 2. Flushes any pending logs\n * 3. Removes event handlers\n * 4. Waits for any in-progress operations to complete\n */\n [Symbol.dispose](): Promise<void> {\n if (this.isDisposing) {\n return Promise.resolve();\n }\n\n this.isDisposing = true;\n\n // Remove all event listeners\n for (const cleanup of this.exitHandlers) {\n cleanup();\n }\n this.exitHandlers = [];\n\n const checkAndFinish = async () => {\n if (!this.isFlushing) {\n return;\n }\n // Wait a bit and check again if still flushing\n await new Promise((resolve) => setTimeout(resolve, 100));\n return checkAndFinish();\n };\n\n // Flush any remaining logs and wait for completion\n return this.flush()\n .then(() => checkAndFinish())\n .catch((error) => {\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