@drenso/homey-log 3.0.0-beta.0 → 8.36.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/README.md +15 -3
- package/build/index.d.ts +86 -0
- package/build/index.mjs +39 -0
- package/package.json +23 -25
- package/index.js +0 -5
- package/lib/Log.js +0 -236
- package/tsconfig.json +0 -10
- package/types/index.d.ts +0 -2
- package/types/lib/Log.d.ts +0 -98
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Homey Log
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/homey-log) [](https://www.npmjs.com/package/@drenso/homey-log) [](https://github.com/Drenso/node-homey-log/actions/workflows/deploy.yml) [](https://github.com/Drenso/homey-log/actions/workflows/pages/pages-build-deployment)
|
|
4
4
|
|
|
5
5
|
This module can be used in a Homey App to send events to [Sentry](http://sentry.io/).
|
|
6
6
|
|
|
7
7
|
## Documentation
|
|
8
8
|
|
|
9
|
-
Documentation is available at [https://
|
|
9
|
+
Documentation is available at [https://drenso.github.io/homey-log](https://drenso.github.io/homey-log).
|
|
10
10
|
|
|
11
11
|
## Related Modules
|
|
12
12
|
|
|
@@ -18,7 +18,7 @@ Documentation is available at [https://athombv.github.io/node-homey-log/](https:
|
|
|
18
18
|
## Installation
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
|
-
npm install --save homey-log
|
|
21
|
+
npm install --save @drenso/homey-log
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
## Getting started
|
|
@@ -50,6 +50,18 @@ class MyApp extends Homey.App {
|
|
|
50
50
|
* When running your app with `homey app run` events will not be sent to Sentry.
|
|
51
51
|
|
|
52
52
|
## Changelog
|
|
53
|
+
|
|
53
54
|
### 2.0.0
|
|
54
55
|
|
|
55
56
|
This version is only SDK version 3 compatible. It now requires a different way of setting up the `Log` instance, see _Getting Started_.
|
|
57
|
+
|
|
58
|
+
### 3.0.0
|
|
59
|
+
|
|
60
|
+
This version has replaced the raven SDK with [@sentry/node](https://docs.sentry.io/platforms/javascript/guides/node/) version 8. If you were using the basic configuration, nothing has changed.
|
|
61
|
+
|
|
62
|
+
- If you were passing custom options, you will need to review them.
|
|
63
|
+
- `setExtra` is deprecated by Sentry and has been removed.
|
|
64
|
+
|
|
65
|
+
### 8.*
|
|
66
|
+
|
|
67
|
+
This package will now follow the Sentry version included.
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export class Log {
|
|
2
|
+
/**
|
|
3
|
+
* Mimic SDK log method.
|
|
4
|
+
* @private
|
|
5
|
+
*/
|
|
6
|
+
private static _log;
|
|
7
|
+
/**
|
|
8
|
+
* Mimic SDK error method.
|
|
9
|
+
* @private
|
|
10
|
+
*/
|
|
11
|
+
private static _error;
|
|
12
|
+
/**
|
|
13
|
+
* Mimic SDK timestamp.
|
|
14
|
+
* @returns {string}
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
private static _logTime;
|
|
18
|
+
/**
|
|
19
|
+
* Whether logging is forced.
|
|
20
|
+
* @returns {boolean}
|
|
21
|
+
* @private
|
|
22
|
+
*/
|
|
23
|
+
private static _isLogForced;
|
|
24
|
+
/**
|
|
25
|
+
* Construct a new Log instance.
|
|
26
|
+
* @param {object} args
|
|
27
|
+
* @param {import('homey').default} args.homey - `this.homey` instance in
|
|
28
|
+
* your app (e.g. `App#homey`/`Driver#homey`/`Device#homey`).
|
|
29
|
+
*
|
|
30
|
+
* @param {object} [args.options] - Additional options for Sentry
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* class MyApp extends Homey.App {
|
|
34
|
+
* onInit() {
|
|
35
|
+
* this.homeyLog = new Log({ homey: this.homey });
|
|
36
|
+
* }
|
|
37
|
+
* }
|
|
38
|
+
*/
|
|
39
|
+
constructor({ homey, options }: {
|
|
40
|
+
homey: import('homey').default;
|
|
41
|
+
options?: object;
|
|
42
|
+
});
|
|
43
|
+
_capturedMessages: any[];
|
|
44
|
+
_capturedExceptions: any[];
|
|
45
|
+
_manifest: any;
|
|
46
|
+
_homeyVersion: any;
|
|
47
|
+
_managerCloud: any;
|
|
48
|
+
_homeyPlatform: any;
|
|
49
|
+
_homeyPlatformVersion: any;
|
|
50
|
+
/**
|
|
51
|
+
* Init Sentry.
|
|
52
|
+
* @param {string} dsn The Sentry DSN
|
|
53
|
+
* @param {object} opts Options to be passed to the Sentry init
|
|
54
|
+
* @returns {Log}
|
|
55
|
+
* @private
|
|
56
|
+
*/
|
|
57
|
+
private init;
|
|
58
|
+
/**
|
|
59
|
+
* Set `tags` that will be sent as context with every message or error. See the Sentry Node.js
|
|
60
|
+
* documentation: https://docs.sentry.io/platforms/javascript/guides/node/enriching-events/tags/
|
|
61
|
+
* @param {object} tags
|
|
62
|
+
* @returns {Log}
|
|
63
|
+
*/
|
|
64
|
+
setTags(tags: object): Log;
|
|
65
|
+
/**
|
|
66
|
+
* Set `user` that will be sent as context with every message or error. See the Sentry Node.js
|
|
67
|
+
* documentation: https://docs.sentry.io/platforms/javascript/guides/node/enriching-events/identify-user/.
|
|
68
|
+
* @param {object} user
|
|
69
|
+
* @returns {Log}
|
|
70
|
+
*/
|
|
71
|
+
setUser(user: object): Log;
|
|
72
|
+
/**
|
|
73
|
+
* Create and send message event to Sentry. See the Sentry Node.js documentation:
|
|
74
|
+
* https://docs.sentry.io/platforms/javascript/guides/node/usage/
|
|
75
|
+
* @param {string} message - Message to be sent
|
|
76
|
+
* @returns {Promise<string>|undefined}
|
|
77
|
+
*/
|
|
78
|
+
captureMessage(message: string): Promise<string> | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Create and send exception event to Sentry. See the sentry Node.js documentation:
|
|
81
|
+
* https://docs.sentry.io/platforms/javascript/guides/node/usage/
|
|
82
|
+
* @param {Error} err - Error instance to be sent
|
|
83
|
+
* @returns {Promise<string>|undefined}
|
|
84
|
+
*/
|
|
85
|
+
captureException(err: Error): Promise<string> | undefined;
|
|
86
|
+
}
|