@royaltics/tracker-sails 0.0.20 → 0.0.22
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 +6 -15
- package/package.json +60 -58
package/README.md
CHANGED
|
@@ -23,10 +23,10 @@ yarn add @royaltics/tracker-sails
|
|
|
23
23
|
|
|
24
24
|
## Configuration
|
|
25
25
|
|
|
26
|
-
Create or update `config/
|
|
26
|
+
Create or update `config/tracker.js`:
|
|
27
27
|
|
|
28
28
|
```javascript
|
|
29
|
-
module.exports.
|
|
29
|
+
module.exports.tracker = {
|
|
30
30
|
webhookUrl: process.env.ERROR_TRACKER_WEBHOOK_URL,
|
|
31
31
|
licenseId: process.env.ERROR_TRACKER_LICENSE_ID,
|
|
32
32
|
licenseDevice: process.env.ERROR_TRACKER_DEVICE || 'sails-server',
|
|
@@ -62,15 +62,6 @@ module.exports.errorTracker = {
|
|
|
62
62
|
|
|
63
63
|
## Usage
|
|
64
64
|
|
|
65
|
-
### Install the Hook
|
|
66
|
-
|
|
67
|
-
In `config/hooks.js`:
|
|
68
|
-
|
|
69
|
-
```javascript
|
|
70
|
-
module.exports.hooks = {
|
|
71
|
-
errorTracker: require('@royaltics/tracker-sails').errorTracker
|
|
72
|
-
};
|
|
73
|
-
```
|
|
74
65
|
|
|
75
66
|
### Automatic Error Tracking
|
|
76
67
|
|
|
@@ -90,7 +81,7 @@ module.exports = {
|
|
|
90
81
|
try {
|
|
91
82
|
// Your code
|
|
92
83
|
} catch (error) {
|
|
93
|
-
sails.hooks.
|
|
84
|
+
sails.hooks.tracker.error(error, 'ERROR', {
|
|
94
85
|
userId: req.session.userId,
|
|
95
86
|
action: 'someAction'
|
|
96
87
|
});
|
|
@@ -104,7 +95,7 @@ module.exports = {
|
|
|
104
95
|
### Track Custom Events
|
|
105
96
|
|
|
106
97
|
```javascript
|
|
107
|
-
sails.hooks.
|
|
98
|
+
sails.hooks.tracker.event('User registered', 'INFO', {
|
|
108
99
|
userId: user.id,
|
|
109
100
|
email: user.email
|
|
110
101
|
});
|
|
@@ -151,7 +142,7 @@ ERROR_TRACKER_DEVICE=production-server-01
|
|
|
151
142
|
### Ignore Health Check Routes
|
|
152
143
|
|
|
153
144
|
```javascript
|
|
154
|
-
module.exports.
|
|
145
|
+
module.exports.tracker = {
|
|
155
146
|
// ... other config
|
|
156
147
|
ignoredRoutes: [
|
|
157
148
|
'/health',
|
|
@@ -165,7 +156,7 @@ module.exports.errorTracker = {
|
|
|
165
156
|
### Capture Only Errors
|
|
166
157
|
|
|
167
158
|
```javascript
|
|
168
|
-
module.exports.
|
|
159
|
+
module.exports.tracker = {
|
|
169
160
|
// ... other config
|
|
170
161
|
captureRoutes: false, // Don't track successful requests
|
|
171
162
|
captureQueries: true, // But include query params in errors
|
package/package.json
CHANGED
|
@@ -1,60 +1,62 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
2
|
+
"name": "@royaltics/tracker-sails",
|
|
3
|
+
"version": "0.0.22",
|
|
4
|
+
"description": "Sails.js hook for Royaltics Error Tracker",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"private": false,
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": "./dist/index.js",
|
|
16
|
+
"require": "./dist/index.cjs",
|
|
17
|
+
"types": "./dist/index.d.ts"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "vite build && tsc --emitDeclarationOnly",
|
|
22
|
+
"test": "vitest",
|
|
23
|
+
"test:coverage": "vitest --coverage",
|
|
24
|
+
"prepublishOnly": "npm run build",
|
|
25
|
+
"publish": "npm publish"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"README.md",
|
|
30
|
+
"LICENSE"
|
|
31
|
+
],
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/royaltics-solutions/royaltics-solutions-tracker"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"sails",
|
|
38
|
+
"sailsjs",
|
|
39
|
+
"tracker",
|
|
40
|
+
"monitoring",
|
|
41
|
+
"logging"
|
|
42
|
+
],
|
|
43
|
+
"sails": {
|
|
44
|
+
"isHook": true,
|
|
45
|
+
"hookName": "tracker"
|
|
46
|
+
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"sails": "^1.0.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@types/node": "^20.19.27",
|
|
52
|
+
"@vitest/coverage-v8": "^1.6.1",
|
|
53
|
+
"typescript": "^5.9.3",
|
|
54
|
+
"vite": "^5.4.21",
|
|
55
|
+
"vite-plugin-dts": "^3.9.1",
|
|
56
|
+
"vitest": "^1.6.1"
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@royaltics/tracker": "^0.0.20"
|
|
60
|
+
},
|
|
61
|
+
"pnpm": {}
|
|
60
62
|
}
|