loglevel-mixin 6.1.6 → 7.0.1
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/README.md +0 -5
- package/package.json +10 -8
- package/src/loglevel-mixin.mjs +4 -12
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -66,7 +66,6 @@ npm install loglevel-mixin
|
|
|
66
66
|
* [defineLoggerMethods](#defineloggermethods)
|
|
67
67
|
* [Parameters](#parameters-1)
|
|
68
68
|
* [Examples](#examples)
|
|
69
|
-
* [LOGLEVEL](#loglevel-1)
|
|
70
69
|
* [LogLevelMixin](#loglevelmixin)
|
|
71
70
|
* [Parameters](#parameters-2)
|
|
72
71
|
* [Examples](#examples-1)
|
|
@@ -139,10 +138,6 @@ obj.error('error entry'); // will redirect to theFunction if obj.loglevel is at
|
|
|
139
138
|
|
|
140
139
|
Returns **[undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined)** 
|
|
141
140
|
|
|
142
|
-
## LOGLEVEL
|
|
143
|
-
|
|
144
|
-
symbol holding the actual logLevel inside of the target object
|
|
145
|
-
|
|
146
141
|
## LogLevelMixin
|
|
147
142
|
|
|
148
143
|
<!-- skip-example -->
|
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "loglevel-mixin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.1",
|
|
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:browser-ava && npm run test: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.3"
|
|
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,13 @@ export function LogLevelMixin(
|
|
|
129
124
|
initialLogLevel = defaultLogLevels.info
|
|
130
125
|
) {
|
|
131
126
|
const newClass = class extends superclass {
|
|
132
|
-
|
|
133
|
-
super(...args);
|
|
134
|
-
this[LOGLEVEL] = initialLogLevel;
|
|
135
|
-
}
|
|
127
|
+
#logLevel = initialLogLevel;
|
|
136
128
|
|
|
137
129
|
/**
|
|
138
130
|
* @return {string} name of the current log level
|
|
139
131
|
*/
|
|
140
132
|
get logLevel() {
|
|
141
|
-
return this
|
|
133
|
+
return this.#logLevel.name;
|
|
142
134
|
}
|
|
143
135
|
|
|
144
136
|
/**
|
|
@@ -147,14 +139,14 @@ export function LogLevelMixin(
|
|
|
147
139
|
* @param {string} level
|
|
148
140
|
*/
|
|
149
141
|
set logLevel(level) {
|
|
150
|
-
this
|
|
142
|
+
this.#logLevel = logLevels[level] || initialLogLevel;
|
|
151
143
|
}
|
|
152
144
|
|
|
153
145
|
/**
|
|
154
146
|
* @return {number} priority of the current log level
|
|
155
147
|
*/
|
|
156
148
|
get logLevelPriority() {
|
|
157
|
-
return this
|
|
149
|
+
return this.#logLevel.priority;
|
|
158
150
|
}
|
|
159
151
|
};
|
|
160
152
|
|