@logtape/sentry 0.1.0-dev.3 → 0.2.0-dev.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/README.md +11 -1
- package/esm/mod.js +15 -1
- package/package.json +1 -1
- package/script/mod.js +15 -1
- package/types/mod.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -81,6 +81,16 @@ await configure({
|
|
|
81
81
|
Changelog
|
|
82
82
|
---------
|
|
83
83
|
|
|
84
|
-
### Version 0.
|
|
84
|
+
### Version 0.2.0
|
|
85
85
|
|
|
86
86
|
To be released.
|
|
87
|
+
|
|
88
|
+
- Log records having `error` property will now be sent to Sentry as
|
|
89
|
+
exceptions. [[#1], [#2] by Martin Becze]
|
|
90
|
+
|
|
91
|
+
[#1]: https://github.com/dahlia/logtape-sentry/issues/1
|
|
92
|
+
[#2]: https://github.com/dahlia/logtape-sentry/pull/2
|
|
93
|
+
|
|
94
|
+
### Version 0.1.0
|
|
95
|
+
|
|
96
|
+
Initial release. Released on November 26, 2024.
|
package/esm/mod.js
CHANGED
|
@@ -51,8 +51,22 @@ const inspect =
|
|
|
51
51
|
*/
|
|
52
52
|
export function getSentrySink(client) {
|
|
53
53
|
return (record) => {
|
|
54
|
+
const message = getParameterizedString(record);
|
|
54
55
|
if (client == null)
|
|
55
56
|
client = getClient();
|
|
56
|
-
|
|
57
|
+
if (record.level === "error" && record.properties.error instanceof Error) {
|
|
58
|
+
const { error, ...rest } = record.properties;
|
|
59
|
+
client?.captureException(error, {
|
|
60
|
+
data: {
|
|
61
|
+
message,
|
|
62
|
+
...rest,
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
client?.captureMessage(message, record.level, {
|
|
68
|
+
data: record.properties,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
57
71
|
};
|
|
58
72
|
}
|
package/package.json
CHANGED
package/script/mod.js
CHANGED
|
@@ -77,8 +77,22 @@ const inspect =
|
|
|
77
77
|
*/
|
|
78
78
|
function getSentrySink(client) {
|
|
79
79
|
return (record) => {
|
|
80
|
+
const message = getParameterizedString(record);
|
|
80
81
|
if (client == null)
|
|
81
82
|
client = (0, core_1.getClient)();
|
|
82
|
-
|
|
83
|
+
if (record.level === "error" && record.properties.error instanceof Error) {
|
|
84
|
+
const { error, ...rest } = record.properties;
|
|
85
|
+
client?.captureException(error, {
|
|
86
|
+
data: {
|
|
87
|
+
message,
|
|
88
|
+
...rest,
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
client?.captureMessage(message, record.level, {
|
|
94
|
+
data: record.properties,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
83
97
|
};
|
|
84
98
|
}
|
package/types/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAa,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,KAAK,UAAU,EAAa,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAuB,MAAM,eAAe,CAAC;AAgDxE;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,aAAa,CAAC,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAa,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,KAAK,UAAU,EAAa,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAuB,MAAM,eAAe,CAAC;AAgDxE;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,aAAa,CAAC,GAAG,IAAI,CAsBtE"}
|