@loglayer/transport-datadog 3.3.1 → 3.3.3
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 +0 -25
- package/dist/index.cjs.map +1 -1
- package/dist/{index.d.ts → index.d.mts} +1 -1
- package/dist/{index.js → index.mjs} +1 -1
- package/dist/index.mjs.map +1 -0
- package/package.json +11 -10
- package/dist/index.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,30 +1,5 @@
|
|
|
1
|
-
//#region rolldown:runtime
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
-
key = keys[i];
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
-
get: ((k) => from[k]).bind(null, key),
|
|
13
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
-
value: mod,
|
|
20
|
-
enumerable: true
|
|
21
|
-
}) : target, mod));
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
1
|
let __loglayer_transport = require("@loglayer/transport");
|
|
25
|
-
__loglayer_transport = __toESM(__loglayer_transport);
|
|
26
2
|
let datadog_transport_common = require("datadog-transport-common");
|
|
27
|
-
datadog_transport_common = __toESM(datadog_transport_common);
|
|
28
3
|
|
|
29
4
|
//#region src/DataDogTransport.ts
|
|
30
5
|
var DataDogTransport = class extends __loglayer_transport.LoggerlessTransport {
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["LoggerlessTransport","DatadogTransportCommon","LogLevelPriority","logEntry: Record<string, any>"],"sources":["../src/DataDogTransport.ts"],"sourcesContent":["import type { LoggerlessTransportConfig, LogLayerTransportParams, LogLevelType } from \"@loglayer/transport\";\nimport { LoggerlessTransport, type LogLevel, LogLevelPriority } from \"@loglayer/transport\";\nimport { DataDogTransport as DatadogTransportCommon, type DDTransportOptions } from \"datadog-transport-common\";\n\nexport interface DatadogTransportConfig extends LoggerlessTransportConfig {\n /**\n * The options to pass to the datadog-transport-common instance.\n */\n options: DDTransportOptions;\n /**\n * The field name to use for the message. Default is \"message\".\n */\n messageField?: string;\n /**\n * The field name to use for the log level. Default is \"level\".\n */\n levelField?: string;\n /**\n * The field name to use for the timestamp. Default is \"time\".\n */\n timestampField?: string;\n /**\n * A custom function to stamp the timestamp\n */\n timestampFunction?: () => any;\n /**\n * Minimum log level to send to DataDog. Logs below this level will be filtered out.\n * For example, if set to \"warn\", only warn, error, and fatal logs will be sent.\n */\n level?: LogLevelType;\n}\n\nexport class DataDogTransport extends LoggerlessTransport {\n private messageField: string;\n private levelField: string;\n private timestampField: string;\n private timestampFunction?: () => any;\n private transport: DatadogTransportCommon;\n private minLevelPriority?: number;\n\n constructor(config: DatadogTransportConfig) {\n super(config);\n\n if (!this.enabled) {\n return;\n }\n\n this.transport = new DatadogTransportCommon(config.options);\n this.messageField = config.messageField ?? \"message\";\n this.levelField = config.levelField ?? \"level\";\n this.timestampField = config.timestampField ?? \"time\";\n this.timestampFunction = config.timestampFunction;\n\n if (config.level) {\n this.minLevelPriority = LogLevelPriority[config.level as LogLevel];\n }\n }\n\n shipToLogger({ logLevel, messages, data, hasData }: LogLayerTransportParams) {\n if (!this.transport) {\n throw new Error(\n \"DataDogTransport was previously disabled; enabling the flag manually on the transport instance is not supported.\",\n );\n }\n\n // Filter out logs below the minimum level\n if (this.minLevelPriority !== undefined) {\n const currentLevelPriority = LogLevelPriority[logLevel as LogLevel];\n if (currentLevelPriority < this.minLevelPriority) {\n return messages;\n }\n }\n\n const logEntry: Record<string, any> = {};\n\n if (data && hasData) {\n Object.assign(logEntry, data);\n }\n\n if (this.timestampFunction) {\n logEntry[this.timestampField] = this.timestampFunction();\n } else {\n logEntry[this.timestampField] = new Date().toISOString();\n }\n\n logEntry[this.levelField] = logLevel;\n logEntry[this.messageField] = messages.join(\" \");\n\n this.transport.processLog(logEntry);\n\n return messages;\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["LoggerlessTransport","DatadogTransportCommon","LogLevelPriority","logEntry: Record<string, any>"],"sources":["../src/DataDogTransport.ts"],"sourcesContent":["import type { LoggerlessTransportConfig, LogLayerTransportParams, LogLevelType } from \"@loglayer/transport\";\nimport { LoggerlessTransport, type LogLevel, LogLevelPriority } from \"@loglayer/transport\";\nimport { DataDogTransport as DatadogTransportCommon, type DDTransportOptions } from \"datadog-transport-common\";\n\nexport interface DatadogTransportConfig extends LoggerlessTransportConfig {\n /**\n * The options to pass to the datadog-transport-common instance.\n */\n options: DDTransportOptions;\n /**\n * The field name to use for the message. Default is \"message\".\n */\n messageField?: string;\n /**\n * The field name to use for the log level. Default is \"level\".\n */\n levelField?: string;\n /**\n * The field name to use for the timestamp. Default is \"time\".\n */\n timestampField?: string;\n /**\n * A custom function to stamp the timestamp\n */\n timestampFunction?: () => any;\n /**\n * Minimum log level to send to DataDog. Logs below this level will be filtered out.\n * For example, if set to \"warn\", only warn, error, and fatal logs will be sent.\n */\n level?: LogLevelType;\n}\n\nexport class DataDogTransport extends LoggerlessTransport {\n private messageField: string;\n private levelField: string;\n private timestampField: string;\n private timestampFunction?: () => any;\n private transport: DatadogTransportCommon;\n private minLevelPriority?: number;\n\n constructor(config: DatadogTransportConfig) {\n super(config);\n\n if (!this.enabled) {\n return;\n }\n\n this.transport = new DatadogTransportCommon(config.options);\n this.messageField = config.messageField ?? \"message\";\n this.levelField = config.levelField ?? \"level\";\n this.timestampField = config.timestampField ?? \"time\";\n this.timestampFunction = config.timestampFunction;\n\n if (config.level) {\n this.minLevelPriority = LogLevelPriority[config.level as LogLevel];\n }\n }\n\n shipToLogger({ logLevel, messages, data, hasData }: LogLayerTransportParams) {\n if (!this.transport) {\n throw new Error(\n \"DataDogTransport was previously disabled; enabling the flag manually on the transport instance is not supported.\",\n );\n }\n\n // Filter out logs below the minimum level\n if (this.minLevelPriority !== undefined) {\n const currentLevelPriority = LogLevelPriority[logLevel as LogLevel];\n if (currentLevelPriority < this.minLevelPriority) {\n return messages;\n }\n }\n\n const logEntry: Record<string, any> = {};\n\n if (data && hasData) {\n Object.assign(logEntry, data);\n }\n\n if (this.timestampFunction) {\n logEntry[this.timestampField] = this.timestampFunction();\n } else {\n logEntry[this.timestampField] = new Date().toISOString();\n }\n\n logEntry[this.levelField] = logLevel;\n logEntry[this.messageField] = messages.join(\" \");\n\n this.transport.processLog(logEntry);\n\n return messages;\n }\n}\n"],"mappings":";;;;AAgCA,IAAa,mBAAb,cAAsCA,yCAAoB;CACxD,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CAER,YAAY,QAAgC;AAC1C,QAAM,OAAO;AAEb,MAAI,CAAC,KAAK,QACR;AAGF,OAAK,YAAY,IAAIC,0CAAuB,OAAO,QAAQ;AAC3D,OAAK,eAAe,OAAO,gBAAgB;AAC3C,OAAK,aAAa,OAAO,cAAc;AACvC,OAAK,iBAAiB,OAAO,kBAAkB;AAC/C,OAAK,oBAAoB,OAAO;AAEhC,MAAI,OAAO,MACT,MAAK,mBAAmBC,sCAAiB,OAAO;;CAIpD,aAAa,EAAE,UAAU,UAAU,MAAM,WAAoC;AAC3E,MAAI,CAAC,KAAK,UACR,OAAM,IAAI,MACR,mHACD;AAIH,MAAI,KAAK,qBAAqB,QAE5B;OAD6BA,sCAAiB,YACnB,KAAK,iBAC9B,QAAO;;EAIX,MAAMC,WAAgC,EAAE;AAExC,MAAI,QAAQ,QACV,QAAO,OAAO,UAAU,KAAK;AAG/B,MAAI,KAAK,kBACP,UAAS,KAAK,kBAAkB,KAAK,mBAAmB;MAExD,UAAS,KAAK,mCAAkB,IAAI,MAAM,EAAC,aAAa;AAG1D,WAAS,KAAK,cAAc;AAC5B,WAAS,KAAK,gBAAgB,SAAS,KAAK,IAAI;AAEhD,OAAK,UAAU,WAAW,SAAS;AAEnC,SAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["DatadogTransportCommon","logEntry: Record<string, any>"],"sources":["../src/DataDogTransport.ts"],"sourcesContent":["import type { LoggerlessTransportConfig, LogLayerTransportParams, LogLevelType } from \"@loglayer/transport\";\nimport { LoggerlessTransport, type LogLevel, LogLevelPriority } from \"@loglayer/transport\";\nimport { DataDogTransport as DatadogTransportCommon, type DDTransportOptions } from \"datadog-transport-common\";\n\nexport interface DatadogTransportConfig extends LoggerlessTransportConfig {\n /**\n * The options to pass to the datadog-transport-common instance.\n */\n options: DDTransportOptions;\n /**\n * The field name to use for the message. Default is \"message\".\n */\n messageField?: string;\n /**\n * The field name to use for the log level. Default is \"level\".\n */\n levelField?: string;\n /**\n * The field name to use for the timestamp. Default is \"time\".\n */\n timestampField?: string;\n /**\n * A custom function to stamp the timestamp\n */\n timestampFunction?: () => any;\n /**\n * Minimum log level to send to DataDog. Logs below this level will be filtered out.\n * For example, if set to \"warn\", only warn, error, and fatal logs will be sent.\n */\n level?: LogLevelType;\n}\n\nexport class DataDogTransport extends LoggerlessTransport {\n private messageField: string;\n private levelField: string;\n private timestampField: string;\n private timestampFunction?: () => any;\n private transport: DatadogTransportCommon;\n private minLevelPriority?: number;\n\n constructor(config: DatadogTransportConfig) {\n super(config);\n\n if (!this.enabled) {\n return;\n }\n\n this.transport = new DatadogTransportCommon(config.options);\n this.messageField = config.messageField ?? \"message\";\n this.levelField = config.levelField ?? \"level\";\n this.timestampField = config.timestampField ?? \"time\";\n this.timestampFunction = config.timestampFunction;\n\n if (config.level) {\n this.minLevelPriority = LogLevelPriority[config.level as LogLevel];\n }\n }\n\n shipToLogger({ logLevel, messages, data, hasData }: LogLayerTransportParams) {\n if (!this.transport) {\n throw new Error(\n \"DataDogTransport was previously disabled; enabling the flag manually on the transport instance is not supported.\",\n );\n }\n\n // Filter out logs below the minimum level\n if (this.minLevelPriority !== undefined) {\n const currentLevelPriority = LogLevelPriority[logLevel as LogLevel];\n if (currentLevelPriority < this.minLevelPriority) {\n return messages;\n }\n }\n\n const logEntry: Record<string, any> = {};\n\n if (data && hasData) {\n Object.assign(logEntry, data);\n }\n\n if (this.timestampFunction) {\n logEntry[this.timestampField] = this.timestampFunction();\n } else {\n logEntry[this.timestampField] = new Date().toISOString();\n }\n\n logEntry[this.levelField] = logLevel;\n logEntry[this.messageField] = messages.join(\" \");\n\n this.transport.processLog(logEntry);\n\n return messages;\n }\n}\n"],"mappings":";;;;AAgCA,IAAa,mBAAb,cAAsC,oBAAoB;CACxD,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CAER,YAAY,QAAgC;AAC1C,QAAM,OAAO;AAEb,MAAI,CAAC,KAAK,QACR;AAGF,OAAK,YAAY,IAAIA,mBAAuB,OAAO,QAAQ;AAC3D,OAAK,eAAe,OAAO,gBAAgB;AAC3C,OAAK,aAAa,OAAO,cAAc;AACvC,OAAK,iBAAiB,OAAO,kBAAkB;AAC/C,OAAK,oBAAoB,OAAO;AAEhC,MAAI,OAAO,MACT,MAAK,mBAAmB,iBAAiB,OAAO;;CAIpD,aAAa,EAAE,UAAU,UAAU,MAAM,WAAoC;AAC3E,MAAI,CAAC,KAAK,UACR,OAAM,IAAI,MACR,mHACD;AAIH,MAAI,KAAK,qBAAqB,QAE5B;OAD6B,iBAAiB,YACnB,KAAK,iBAC9B,QAAO;;EAIX,MAAMC,WAAgC,EAAE;AAExC,MAAI,QAAQ,QACV,QAAO,OAAO,UAAU,KAAK;AAG/B,MAAI,KAAK,kBACP,UAAS,KAAK,kBAAkB,KAAK,mBAAmB;MAExD,UAAS,KAAK,mCAAkB,IAAI,MAAM,EAAC,aAAa;AAG1D,WAAS,KAAK,cAAc;AAC5B,WAAS,KAAK,gBAAgB,SAAS,KAAK,IAAI;AAEhD,OAAK,UAAU,WAAW,SAAS;AAEnC,SAAO"}
|
package/package.json
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loglayer/transport-datadog",
|
|
3
3
|
"description": "DataDog transport for the LogLayer logging library.",
|
|
4
|
-
"version": "3.3.
|
|
4
|
+
"version": "3.3.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
|
-
"module": "./dist/index.
|
|
7
|
+
"module": "./dist/index.mjs",
|
|
8
8
|
"exports": {
|
|
9
9
|
"import": {
|
|
10
|
-
"types": "./dist/index.d.
|
|
11
|
-
"import": "./dist/index.
|
|
10
|
+
"types": "./dist/index.d.mts",
|
|
11
|
+
"import": "./dist/index.mjs"
|
|
12
12
|
},
|
|
13
13
|
"require": {
|
|
14
14
|
"types": "./dist/index.d.cts",
|
|
15
15
|
"require": "./dist/index.cjs"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
|
-
"types": "./dist/index.d.
|
|
18
|
+
"types": "./dist/index.d.mts",
|
|
19
|
+
"sideEffects": false,
|
|
19
20
|
"license": "MIT",
|
|
20
21
|
"repository": {
|
|
21
22
|
"type": "git",
|
|
@@ -35,15 +36,15 @@
|
|
|
35
36
|
"dependencies": {
|
|
36
37
|
"@datadog/datadog-api-client": "1.45.0",
|
|
37
38
|
"datadog-transport-common": "3.0.2",
|
|
38
|
-
"@loglayer/transport": "2.3.
|
|
39
|
+
"@loglayer/transport": "2.3.12"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
|
-
"@types/node": "24.10.
|
|
42
|
-
"tsdown": "0.
|
|
42
|
+
"@types/node": "24.10.2",
|
|
43
|
+
"tsdown": "0.17.2",
|
|
43
44
|
"typescript": "5.9.3",
|
|
44
|
-
"vitest": "4.0.
|
|
45
|
+
"vitest": "4.0.15",
|
|
45
46
|
"@internal/tsconfig": "2.1.0",
|
|
46
|
-
"loglayer": "8.
|
|
47
|
+
"loglayer": "8.2.0"
|
|
47
48
|
},
|
|
48
49
|
"bugs": "https://github.com/loglayer/loglayer/issues",
|
|
49
50
|
"engines": {
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["DatadogTransportCommon","logEntry: Record<string, any>"],"sources":["../src/DataDogTransport.ts"],"sourcesContent":["import type { LoggerlessTransportConfig, LogLayerTransportParams, LogLevelType } from \"@loglayer/transport\";\nimport { LoggerlessTransport, type LogLevel, LogLevelPriority } from \"@loglayer/transport\";\nimport { DataDogTransport as DatadogTransportCommon, type DDTransportOptions } from \"datadog-transport-common\";\n\nexport interface DatadogTransportConfig extends LoggerlessTransportConfig {\n /**\n * The options to pass to the datadog-transport-common instance.\n */\n options: DDTransportOptions;\n /**\n * The field name to use for the message. Default is \"message\".\n */\n messageField?: string;\n /**\n * The field name to use for the log level. Default is \"level\".\n */\n levelField?: string;\n /**\n * The field name to use for the timestamp. Default is \"time\".\n */\n timestampField?: string;\n /**\n * A custom function to stamp the timestamp\n */\n timestampFunction?: () => any;\n /**\n * Minimum log level to send to DataDog. Logs below this level will be filtered out.\n * For example, if set to \"warn\", only warn, error, and fatal logs will be sent.\n */\n level?: LogLevelType;\n}\n\nexport class DataDogTransport extends LoggerlessTransport {\n private messageField: string;\n private levelField: string;\n private timestampField: string;\n private timestampFunction?: () => any;\n private transport: DatadogTransportCommon;\n private minLevelPriority?: number;\n\n constructor(config: DatadogTransportConfig) {\n super(config);\n\n if (!this.enabled) {\n return;\n }\n\n this.transport = new DatadogTransportCommon(config.options);\n this.messageField = config.messageField ?? \"message\";\n this.levelField = config.levelField ?? \"level\";\n this.timestampField = config.timestampField ?? \"time\";\n this.timestampFunction = config.timestampFunction;\n\n if (config.level) {\n this.minLevelPriority = LogLevelPriority[config.level as LogLevel];\n }\n }\n\n shipToLogger({ logLevel, messages, data, hasData }: LogLayerTransportParams) {\n if (!this.transport) {\n throw new Error(\n \"DataDogTransport was previously disabled; enabling the flag manually on the transport instance is not supported.\",\n );\n }\n\n // Filter out logs below the minimum level\n if (this.minLevelPriority !== undefined) {\n const currentLevelPriority = LogLevelPriority[logLevel as LogLevel];\n if (currentLevelPriority < this.minLevelPriority) {\n return messages;\n }\n }\n\n const logEntry: Record<string, any> = {};\n\n if (data && hasData) {\n Object.assign(logEntry, data);\n }\n\n if (this.timestampFunction) {\n logEntry[this.timestampField] = this.timestampFunction();\n } else {\n logEntry[this.timestampField] = new Date().toISOString();\n }\n\n logEntry[this.levelField] = logLevel;\n logEntry[this.messageField] = messages.join(\" \");\n\n this.transport.processLog(logEntry);\n\n return messages;\n }\n}\n"],"mappings":";;;;AAgCA,IAAa,mBAAb,cAAsC,oBAAoB;CACxD,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CAER,YAAY,QAAgC;AAC1C,QAAM,OAAO;AAEb,MAAI,CAAC,KAAK,QACR;AAGF,OAAK,YAAY,IAAIA,mBAAuB,OAAO,QAAQ;AAC3D,OAAK,eAAe,OAAO,gBAAgB;AAC3C,OAAK,aAAa,OAAO,cAAc;AACvC,OAAK,iBAAiB,OAAO,kBAAkB;AAC/C,OAAK,oBAAoB,OAAO;AAEhC,MAAI,OAAO,MACT,MAAK,mBAAmB,iBAAiB,OAAO;;CAIpD,aAAa,EAAE,UAAU,UAAU,MAAM,WAAoC;AAC3E,MAAI,CAAC,KAAK,UACR,OAAM,IAAI,MACR,mHACD;AAIH,MAAI,KAAK,qBAAqB,QAE5B;OAD6B,iBAAiB,YACnB,KAAK,iBAC9B,QAAO;;EAIX,MAAMC,WAAgC,EAAE;AAExC,MAAI,QAAQ,QACV,QAAO,OAAO,UAAU,KAAK;AAG/B,MAAI,KAAK,kBACP,UAAS,KAAK,kBAAkB,KAAK,mBAAmB;MAExD,UAAS,KAAK,mCAAkB,IAAI,MAAM,EAAC,aAAa;AAG1D,WAAS,KAAK,cAAc;AAC5B,WAAS,KAAK,gBAAgB,SAAS,KAAK,IAAI;AAEhD,OAAK,UAAU,WAAW,SAAS;AAEnC,SAAO"}
|