loglevel-mixin 7.0.0 → 7.0.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  [![npm](https://img.shields.io/npm/v/loglevel-mixin.svg)](https://www.npmjs.com/package/loglevel-mixin)
2
2
  [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
3
- [![Open Bundle](https://bundlejs.com/badge-light.svg)](https://bundlejs.com/?q=loglevel-mixin)
3
+ [![bundlejs](https://deno.bundlejs.com/?q=loglevel-mixin\&badge=detailed)](https://bundlejs.com/?q=loglevel-mixin)
4
4
  [![downloads](http://img.shields.io/npm/dm/loglevel-mixin.svg?style=flat-square)](https://npmjs.org/package/loglevel-mixin)
5
5
  [![GitHub Issues](https://img.shields.io/github/issues/arlac77/loglevel-mixin.svg?style=flat-square)](https://github.com/arlac77/loglevel-mixin/issues)
6
6
  [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Farlac77%2Floglevel-mixin%2Fbadge\&style=flat)](https://actions-badge.atrox.dev/arlac77/loglevel-mixin/goto)
@@ -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)
@@ -124,7 +123,7 @@ For each loglevel a method with the name of the log level will be created.
124
123
 
125
124
  * `object` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** target where to assign properties to
126
125
  * `logLevels` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Hash with all the available loglevels. Stored by there name (optional, default `defaultLogLevels`)
127
- * `theFunction` **[Logger](#logger)** to be added under the loglevel name.
126
+ * `theFunction` **[Logger](#logger)?** to be added under the loglevel name.
128
127
  This function will only be called if the current loglevel is greater equal
129
128
  the log level of the called logging function.
130
129
  By default a method log(level,message) will be used
@@ -139,19 +138,15 @@ 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 -->
149
144
 
150
145
  ### Parameters
151
146
 
152
- * `superclass` **class** class to be extendet
147
+ * `superclass` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** class to be extendet
153
148
  * `logLevels` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Object with all the available loglevels. Stored by their name (optional, default `defaultLogLevels`)
154
- * `initialLogLevel` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the default value for the logLevel property (optional, default `defaultLogLevels.info`)
149
+ * `initialLogLevel` **[Loglevel](#loglevel)** the default value for the logLevel property (optional, default `defaultLogLevels.info`)
155
150
 
156
151
  ### Examples
157
152
 
@@ -164,7 +159,7 @@ class LoggingEnabledClass extends LogLevelMixin(BaseClass) {
164
159
  }
165
160
  ```
166
161
 
167
- Returns **class** newly created class ready to be further extendet/used
162
+ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** newly created class ready to be further extendet/used
168
163
 
169
164
  ## makeLogEvent
170
165
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loglevel-mixin",
3
- "version": "7.0.0",
3
+ "version": "7.0.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -20,7 +20,7 @@
20
20
  ],
21
21
  "license": "BSD-2-Clause",
22
22
  "scripts": {
23
- "test": "npm run test:ava && npm run test:browser-ava",
23
+ "test": "npm run test:browser-ava && npm run test:ava",
24
24
  "test:ava": "ava --timeout 2m tests/*-ava.mjs tests/*-ava-node.mjs",
25
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",
@@ -29,14 +29,14 @@
29
29
  "lint:docs": "documentation lint ./src/**/*.mjs"
30
30
  },
31
31
  "devDependencies": {
32
- "ava": "^5.2.0",
33
- "browser-ava": "^1.3.27",
34
- "c8": "^7.13.0",
35
- "documentation": "^14.0.1",
36
- "semantic-release": "^20.1.1"
32
+ "ava": "^5.3.1",
33
+ "browser-ava": "^1.3.57",
34
+ "c8": "^8.0.1",
35
+ "documentation": "^14.0.2",
36
+ "semantic-release": "^21.1.1"
37
37
  },
38
38
  "engines": {
39
- "node": ">=16.19.1"
39
+ "node": ">=16.20.2"
40
40
  },
41
41
  "repository": {
42
42
  "type": "git",
@@ -49,7 +49,7 @@ export function declareLevels(list) {
49
49
  * For each loglevel a method with the name of the log level will be created.
50
50
  * @param {Object} object target where to assign properties to
51
51
  * @param {Object} logLevels Hash with all the available loglevels. Stored by there name
52
- * @param {Logger} theFunction to be added under the loglevel name.
52
+ * @param {Logger} [theFunction] to be added under the loglevel name.
53
53
  * This function will only be called if the current loglevel is greater equal
54
54
  * the log level of the called logging function.
55
55
  * By default a method log(level,message) will be used
@@ -105,10 +105,10 @@ export function defineLoggerMethods(
105
105
  * <!-- skip-example -->
106
106
  * @class
107
107
  * @classdesc This function is a mixin for ES2015 classes.
108
- * @param {class} superclass class to be extendet
108
+ * @param {Object} superclass class to be extendet
109
109
  * @param {Object} logLevels Object with all the available loglevels. Stored by their name
110
- * @param {string} initialLogLevel the default value for the logLevel property
111
- * @return {class} newly created class ready to be further extendet/used
110
+ * @param {Loglevel} initialLogLevel the default value for the logLevel property
111
+ * @return {Object} newly created class ready to be further extendet/used
112
112
  * @example
113
113
  * import { LogLevelMixin } = from 'loglevel-mixin';
114
114
  * class BaseClass {
@@ -124,12 +124,7 @@ export function LogLevelMixin(
124
124
  initialLogLevel = defaultLogLevels.info
125
125
  ) {
126
126
  const newClass = class extends superclass {
127
- #logLevel;
128
-
129
- constructor(...args) {
130
- super(...args);
131
- this.#logLevel = initialLogLevel;
132
- }
127
+ #logLevel = initialLogLevel;
133
128
 
134
129
  /**
135
130
  * @return {string} name of the current log level
@@ -178,7 +173,9 @@ export function makeLogEvent(severity, arg, args) {
178
173
  }
179
174
 
180
175
  const logevent = {
181
- severity
176
+ severity,
177
+ ...arg,
178
+ ...args
182
179
  };
183
180
 
184
181
  if (arg instanceof Error) {
@@ -187,7 +184,7 @@ export function makeLogEvent(severity, arg, args) {
187
184
  mapError(logevent, arg.error);
188
185
  }
189
186
 
190
- return Object.assign(logevent, arg, args);
187
+ return logevent;
191
188
  }
192
189
  }
193
190