@zthun/lumberjacky-sentry 2.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Anthony Bonta
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,20 @@
1
+ # Lumberjacky Log
2
+
3
+ This is the root log framework that includes the interfaces and cross framework loggers that can be used without the
4
+ need of any framework.
5
+
6
+ ## Usage
7
+
8
+ ```sh
9
+ npm install @zthun/lumberjacky-log
10
+ yarn add @zthun/lumberjacky-log
11
+ ```
12
+
13
+ There are 3 loggers that are added in this package that are given to you by default.
14
+
15
+ | Logger | Description |
16
+ | --------- | ---------------------------------------------------------------------------------------------------------------------------------- |
17
+ | Console | Basic console logger that uses the lumberjacky interface |
18
+ | Composite | Composite logger that logs to multiple sources |
19
+ | Silent | Silent logger used for unit tests |
20
+ | Context | Special logger that includes context information for logging. This is framework dependant. Basic console logging doesn't use this. |
package/dist/index.cjs ADDED
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const lumberjackyLog = require("@zthun/lumberjacky-log");
4
+ const _ZLoggerSentry = class _ZLoggerSentry {
5
+ /**
6
+ * Initializes a new instance of this object.
7
+ *
8
+ * @param _client -
9
+ * The sentry client to log to.
10
+ */
11
+ constructor(_client) {
12
+ this._client = _client;
13
+ }
14
+ log(entry) {
15
+ this._client.captureEvent({
16
+ message: entry.message,
17
+ level: _ZLoggerSentry.SeverityMap[entry.level],
18
+ extra: {
19
+ context: entry.context
20
+ }
21
+ });
22
+ }
23
+ };
24
+ _ZLoggerSentry.SeverityMap = Object.freeze({
25
+ [lumberjackyLog.ZLogLevel.CATASTROPHE]: "fatal",
26
+ [lumberjackyLog.ZLogLevel.ERROR]: "error",
27
+ [lumberjackyLog.ZLogLevel.WARNING]: "warning",
28
+ [lumberjackyLog.ZLogLevel.INFO]: "info"
29
+ });
30
+ let ZLoggerSentry = _ZLoggerSentry;
31
+ exports.ZLoggerSentry = ZLoggerSentry;
32
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../src/logger/logger-sentry.mts"],"sourcesContent":["import { Client, SeverityLevel } from '@sentry/types';\nimport { IZLogEntry, IZLogger, ZLogLevel } from '@zthun/lumberjacky-log';\n\n/**\n * A logger that logs to sentry (https://sentry.io)\n */\nexport class ZLoggerSentry implements IZLogger {\n private static readonly SeverityMap: Record<ZLogLevel, SeverityLevel> = Object.freeze({\n [ZLogLevel.CATASTROPHE]: 'fatal',\n [ZLogLevel.ERROR]: 'error',\n [ZLogLevel.WARNING]: 'warning',\n [ZLogLevel.INFO]: 'info'\n });\n\n /**\n * Initializes a new instance of this object.\n *\n * @param _client -\n * The sentry client to log to.\n */\n public constructor(private _client: Client) {}\n\n public log(entry: IZLogEntry): void {\n this._client.captureEvent({\n message: entry.message,\n level: ZLoggerSentry.SeverityMap[entry.level],\n extra: {\n context: entry.context\n }\n });\n }\n}\n"],"names":["ZLogLevel"],"mappings":";;;AAMO,MAAM,iBAAN,MAAM,eAAkC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EActC,YAAoB,SAAiB;AAAjB,SAAA,UAAA;AAAA,EAAkB;AAAA,EAEtC,IAAI,OAAyB;AAClC,SAAK,QAAQ,aAAa;AAAA,MACxB,SAAS,MAAM;AAAA,MACf,OAAO,eAAc,YAAY,MAAM,KAAK;AAAA,MAC5C,OAAO;AAAA,QACL,SAAS,MAAM;AAAA,MACjB;AAAA,IAAA,CACD;AAAA,EACH;AACF;AAxB0B,eAAA,cAAgD,OAAO,OAAO;AAAA,EACpF,CAACA,eAAAA,UAAU,WAAW,GAAG;AAAA,EACzB,CAACA,eAAAA,UAAU,KAAK,GAAG;AAAA,EACnB,CAACA,eAAAA,UAAU,OAAO,GAAG;AAAA,EACrB,CAACA,eAAAA,UAAU,IAAI,GAAG;AAAA,CACnB;AANI,IAAM,gBAAN;;"}
@@ -0,0 +1 @@
1
+ export * from './logger/logger-sentry.mjs';
package/dist/index.js ADDED
@@ -0,0 +1,32 @@
1
+ import { ZLogLevel } from "@zthun/lumberjacky-log";
2
+ const _ZLoggerSentry = class _ZLoggerSentry {
3
+ /**
4
+ * Initializes a new instance of this object.
5
+ *
6
+ * @param _client -
7
+ * The sentry client to log to.
8
+ */
9
+ constructor(_client) {
10
+ this._client = _client;
11
+ }
12
+ log(entry) {
13
+ this._client.captureEvent({
14
+ message: entry.message,
15
+ level: _ZLoggerSentry.SeverityMap[entry.level],
16
+ extra: {
17
+ context: entry.context
18
+ }
19
+ });
20
+ }
21
+ };
22
+ _ZLoggerSentry.SeverityMap = Object.freeze({
23
+ [ZLogLevel.CATASTROPHE]: "fatal",
24
+ [ZLogLevel.ERROR]: "error",
25
+ [ZLogLevel.WARNING]: "warning",
26
+ [ZLogLevel.INFO]: "info"
27
+ });
28
+ let ZLoggerSentry = _ZLoggerSentry;
29
+ export {
30
+ ZLoggerSentry
31
+ };
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/logger/logger-sentry.mts"],"sourcesContent":["import { Client, SeverityLevel } from '@sentry/types';\nimport { IZLogEntry, IZLogger, ZLogLevel } from '@zthun/lumberjacky-log';\n\n/**\n * A logger that logs to sentry (https://sentry.io)\n */\nexport class ZLoggerSentry implements IZLogger {\n private static readonly SeverityMap: Record<ZLogLevel, SeverityLevel> = Object.freeze({\n [ZLogLevel.CATASTROPHE]: 'fatal',\n [ZLogLevel.ERROR]: 'error',\n [ZLogLevel.WARNING]: 'warning',\n [ZLogLevel.INFO]: 'info'\n });\n\n /**\n * Initializes a new instance of this object.\n *\n * @param _client -\n * The sentry client to log to.\n */\n public constructor(private _client: Client) {}\n\n public log(entry: IZLogEntry): void {\n this._client.captureEvent({\n message: entry.message,\n level: ZLoggerSentry.SeverityMap[entry.level],\n extra: {\n context: entry.context\n }\n });\n }\n}\n"],"names":[],"mappings":";AAMO,MAAM,iBAAN,MAAM,eAAkC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EActC,YAAoB,SAAiB;AAAjB,SAAA,UAAA;AAAA,EAAkB;AAAA,EAEtC,IAAI,OAAyB;AAClC,SAAK,QAAQ,aAAa;AAAA,MACxB,SAAS,MAAM;AAAA,MACf,OAAO,eAAc,YAAY,MAAM,KAAK;AAAA,MAC5C,OAAO;AAAA,QACL,SAAS,MAAM;AAAA,MACjB;AAAA,IAAA,CACD;AAAA,EACH;AACF;AAxB0B,eAAA,cAAgD,OAAO,OAAO;AAAA,EACpF,CAAC,UAAU,WAAW,GAAG;AAAA,EACzB,CAAC,UAAU,KAAK,GAAG;AAAA,EACnB,CAAC,UAAU,OAAO,GAAG;AAAA,EACrB,CAAC,UAAU,IAAI,GAAG;AAAA,CACnB;AANI,IAAM,gBAAN;"}
@@ -0,0 +1,18 @@
1
+ import { Client } from '@sentry/types';
2
+ import { IZLogEntry, IZLogger } from '@zthun/lumberjacky-log';
3
+
4
+ /**
5
+ * A logger that logs to sentry (https://sentry.io)
6
+ */
7
+ export declare class ZLoggerSentry implements IZLogger {
8
+ private _client;
9
+ private static readonly SeverityMap;
10
+ /**
11
+ * Initializes a new instance of this object.
12
+ *
13
+ * @param _client -
14
+ * The sentry client to log to.
15
+ */
16
+ constructor(_client: Client);
17
+ log(entry: IZLogEntry): void;
18
+ }
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@zthun/lumberjacky-sentry",
3
+ "version": "2.1.0",
4
+ "description": "A standard lumberjacky log interface to interact with sentry.",
5
+ "author": "Anthony Bonta",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/zthun/lumberjacky",
10
+ "directory": "packages/lumberjacky-sentry"
11
+ },
12
+ "keywords": [
13
+ "lumberjacky",
14
+ "logging",
15
+ "log",
16
+ "console"
17
+ ],
18
+ "main": "./dist/index.cjs",
19
+ "module": "./dist/index.js",
20
+ "types": "./dist/index.d.ts",
21
+ "type": "module",
22
+ "exports": {
23
+ "require": "./dist/index.cjs",
24
+ "import": "./dist/index.js",
25
+ "types": "./dist/index.d.ts"
26
+ },
27
+ "scripts": {
28
+ "build": "vite build"
29
+ },
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "dependencies": {
34
+ "@sentry/types": "^8.19.0",
35
+ "@zthun/lumberjacky-log": "^2.1.0",
36
+ "lodash": "^4.17.21"
37
+ },
38
+ "devDependencies": {
39
+ "typescript": "^5.5.3",
40
+ "vite": "^5.3.4",
41
+ "vitest": "^2.0.4",
42
+ "vitest-mock-extended": "^1.3.2"
43
+ },
44
+ "peerDependencies": {
45
+ "@sentry/browser": "^8.19.0",
46
+ "@sentry/node": "^8.19.0",
47
+ "@sentry/react": "^8.19.0",
48
+ "@sentry/types": "^8.19.0"
49
+ },
50
+ "peerDependenciesMeta": {
51
+ "@sentry/browser": {
52
+ "optional": true
53
+ },
54
+ "@sentry/node": {
55
+ "optional": true
56
+ },
57
+ "@sentry/react": {
58
+ "optional": true
59
+ },
60
+ "@sentry/types": {
61
+ "optional": true
62
+ }
63
+ },
64
+ "files": [
65
+ "dist"
66
+ ],
67
+ "sideEffects": false,
68
+ "gitHead": "6d434273c74adc43996a1409e00ffd54debc84f4"
69
+ }