loglevel-mixin 6.1.5 → 7.0.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 +1 -1
- package/package.json +10 -8
- package/src/loglevel-mixin.mjs +6 -9
package/LICENSE
CHANGED
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "loglevel-mixin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"sideEffects": false,
|
|
8
7
|
"exports": {
|
|
9
8
|
".": "./src/loglevel-mixin.mjs"
|
|
10
9
|
},
|
|
@@ -21,25 +20,27 @@
|
|
|
21
20
|
],
|
|
22
21
|
"license": "BSD-2-Clause",
|
|
23
22
|
"scripts": {
|
|
24
|
-
"test": "npm run test:ava",
|
|
23
|
+
"test": "npm run test:ava && npm run test:browser-ava",
|
|
25
24
|
"test:ava": "ava --timeout 2m tests/*-ava.mjs tests/*-ava-node.mjs",
|
|
25
|
+
"test:browser-ava": "browser-ava --headless --no-keep-open tests/*-ava.mjs tests/*-ava-browser.mjs",
|
|
26
26
|
"cover": "c8 -x 'tests/**/*' --temp-directory build/tmp ava --timeout 2m tests/*-ava.mjs tests/*-ava-node.mjs && c8 report -r lcov -o build/coverage --temp-directory build/tmp",
|
|
27
27
|
"docs": "documentation readme --section=API ./src/**/*.mjs",
|
|
28
28
|
"lint": "npm run lint:docs",
|
|
29
29
|
"lint:docs": "documentation lint ./src/**/*.mjs"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"ava": "^5.
|
|
33
|
-
"
|
|
32
|
+
"ava": "^5.2.0",
|
|
33
|
+
"browser-ava": "^1.3.27",
|
|
34
|
+
"c8": "^7.13.0",
|
|
34
35
|
"documentation": "^14.0.1",
|
|
35
|
-
"semantic-release": "^
|
|
36
|
+
"semantic-release": "^20.1.1"
|
|
36
37
|
},
|
|
37
38
|
"engines": {
|
|
38
|
-
"node": ">=
|
|
39
|
+
"node": ">=16.19.1"
|
|
39
40
|
},
|
|
40
41
|
"repository": {
|
|
41
42
|
"type": "git",
|
|
42
|
-
"url": "https://github.com/arlac77/loglevel-mixin
|
|
43
|
+
"url": "https://github.com/arlac77/loglevel-mixin"
|
|
43
44
|
},
|
|
44
45
|
"bugs": {
|
|
45
46
|
"url": "https://github.com/arlac77/loglevel-mixin/issues"
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
"template": {
|
|
49
50
|
"inheritFrom": [
|
|
50
51
|
"arlac77/template-arlac77-github",
|
|
52
|
+
"arlac77/template-browser-ava",
|
|
51
53
|
"arlac77/template-esm-only"
|
|
52
54
|
]
|
|
53
55
|
}
|
package/src/loglevel-mixin.mjs
CHANGED
|
@@ -101,11 +101,6 @@ export function defineLoggerMethods(
|
|
|
101
101
|
);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
/**
|
|
105
|
-
* symbol holding the actual logLevel inside of the target object
|
|
106
|
-
*/
|
|
107
|
-
const LOGLEVEL = Symbol("loglevel");
|
|
108
|
-
|
|
109
104
|
/**
|
|
110
105
|
* <!-- skip-example -->
|
|
111
106
|
* @class
|
|
@@ -129,16 +124,18 @@ export function LogLevelMixin(
|
|
|
129
124
|
initialLogLevel = defaultLogLevels.info
|
|
130
125
|
) {
|
|
131
126
|
const newClass = class extends superclass {
|
|
127
|
+
#logLevel;
|
|
128
|
+
|
|
132
129
|
constructor(...args) {
|
|
133
130
|
super(...args);
|
|
134
|
-
this
|
|
131
|
+
this.#logLevel = initialLogLevel;
|
|
135
132
|
}
|
|
136
133
|
|
|
137
134
|
/**
|
|
138
135
|
* @return {string} name of the current log level
|
|
139
136
|
*/
|
|
140
137
|
get logLevel() {
|
|
141
|
-
return this
|
|
138
|
+
return this.#logLevel.name;
|
|
142
139
|
}
|
|
143
140
|
|
|
144
141
|
/**
|
|
@@ -147,14 +144,14 @@ export function LogLevelMixin(
|
|
|
147
144
|
* @param {string} level
|
|
148
145
|
*/
|
|
149
146
|
set logLevel(level) {
|
|
150
|
-
this
|
|
147
|
+
this.#logLevel = logLevels[level] || initialLogLevel;
|
|
151
148
|
}
|
|
152
149
|
|
|
153
150
|
/**
|
|
154
151
|
* @return {number} priority of the current log level
|
|
155
152
|
*/
|
|
156
153
|
get logLevelPriority() {
|
|
157
|
-
return this
|
|
154
|
+
return this.#logLevel.priority;
|
|
158
155
|
}
|
|
159
156
|
};
|
|
160
157
|
|