@microphi/debug 2.2.0 → 2.2.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/README.md +20 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
> Super simple wrapper around console.log
|
|
4
4
|
|
|
5
|
+
|
|
5
6
|
# Install
|
|
6
7
|
```
|
|
7
8
|
@microphi/debug
|
|
8
9
|
```
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
## Use in nodejs
|
|
11
12
|
|
|
12
13
|
```javascript
|
|
13
14
|
import { getDebugger } from "@microphi/debug";
|
|
@@ -20,9 +21,23 @@ setTimeout(() => {
|
|
|
20
21
|
d('hello there');
|
|
21
22
|
}, 500);
|
|
22
23
|
```
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
Set `DEBUG` environment variable with a comma separated list of regex: if a match happens with a namespace then the text will be logged using `console.log`.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+

|
|
28
|
+
|
|
29
|
+
## Use in the browser
|
|
30
|
+
Set `localStorage.debug` with a comma separated list of regex: if a match happens with a namespace then the text will be logged using `console.log`.
|
|
25
31
|
|
|
26
|
-
|
|
32
|
+

|
|
27
33
|
|
|
28
|
-
|
|
34
|
+
In this case `localStorage.debug` is set to `musicbox:*`
|
|
35
|
+
|
|
36
|
+
### OnMessage handler
|
|
37
|
+
With `OnMessage` is possible to handle each message logged regardless of the regexes provided. This may be usefull to send the logs to a server or to to store them to a file.
|
|
38
|
+
|
|
39
|
+
```javascript
|
|
40
|
+
onMessage((message) => {
|
|
41
|
+
// do something
|
|
42
|
+
});
|
|
43
|
+
```
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"lib"
|
|
18
18
|
],
|
|
19
|
-
"version": "2.2.
|
|
19
|
+
"version": "2.2.3",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"tslib": "^2.5.0"
|
|
22
22
|
},
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"prepack": "yarn build",
|
|
28
28
|
"lint": "eslint ./src"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "e86cbc52e62e0862db78792d5ff64c6ae1de50f8"
|
|
31
31
|
}
|