@qubit-ltd/logging 1.4.12 → 1.4.15

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
@@ -3,8 +3,8 @@
3
3
  [![npm package](https://img.shields.io/npm/v/@qubit-ltd/logging.svg)](https://npmjs.com/package/@qubit-ltd/logging)
4
4
  [![License](https://img.shields.io/badge/License-Apache-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
5
5
  [![中文文档](https://img.shields.io/badge/文档-中文版-blue.svg)](README.zh_CN.md)
6
- [![CircleCI](https://dl.circleci.com/status-badge/img/gh/Haixing-Hu/js-logging/tree/master.svg?style=shield)](https://dl.circleci.com/status-badge/redirect/gh/Haixing-Hu/js-logging/tree/master)
7
- [![Coverage Status](https://coveralls.io/repos/github/Haixing-Hu/js-logging/badge.svg?branch=master)](https://coveralls.io/github/Haixing-Hu/js-logging?branch=master)
6
+ [![CircleCI](https://dl.circleci.com/status-badge/img/gh/qubit-ltd/js-logging/tree/master.svg?style=shield)](https://dl.circleci.com/status-badge/redirect/gh/qubit-ltd/js-logging/tree/master)
7
+ [![Coverage Status](https://coveralls.io/repos/github/qubit-ltd/js-logging/badge.svg?branch=master)](https://coveralls.io/github/qubit-ltd/js-logging?branch=master)
8
8
 
9
9
  [@qubit-ltd/logging] is a JavaScript library that provides powerful
10
10
  logging capabilities through decorators for class methods and properties.
@@ -462,7 +462,7 @@ to open an issue or submit a pull request to the [GitHub repository].
462
462
 
463
463
  ```bash
464
464
  # Clone the repository
465
- git clone https://github.com/Haixing-Hu/js-logging.git
465
+ git clone https://github.com/qubit-ltd/js-logging.git
466
466
  cd js-logging
467
467
 
468
468
  # Install dependencies
@@ -482,4 +482,4 @@ See the [LICENSE](LICENSE) file for more details.
482
482
 
483
483
  [@qubit-ltd/logging]: https://npmjs.com/package/@qubit-ltd/logging
484
484
  [Vue.js class components]: https://github.com/Haixing-Hu/vue3-class-component/
485
- [GitHub repository]: https://github.com/Haixing-Hu/js-logging
485
+ [GitHub repository]: https://github.com/qubit-ltd/js-logging
package/README.zh_CN.md CHANGED
@@ -3,8 +3,8 @@
3
3
  [![npm package](https://img.shields.io/npm/v/@qubit-ltd/logging.svg)](https://npmjs.com/package/@qubit-ltd/logging)
4
4
  [![License](https://img.shields.io/badge/License-Apache-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
5
5
  [![English Document](https://img.shields.io/badge/Document-English-blue.svg)](README.md)
6
- [![CircleCI](https://dl.circleci.com/status-badge/img/gh/Haixing-Hu/js-logging/tree/master.svg?style=shield)](https://dl.circleci.com/status-badge/redirect/gh/Haixing-Hu/js-logging/tree/master)
7
- [![Coverage Status](https://coveralls.io/repos/github/Haixing-Hu/js-logging/badge.svg?branch=master)](https://coveralls.io/github/Haixing-Hu/js-logging?branch=master)
6
+ [![CircleCI](https://dl.circleci.com/status-badge/img/gh/qubit-ltd/js-logging/tree/master.svg?style=shield)](https://dl.circleci.com/status-badge/redirect/gh/qubit-ltd/js-logging/tree/master)
7
+ [![Coverage Status](https://coveralls.io/repos/github/qubit-ltd/js-logging/badge.svg?branch=master)](https://coveralls.io/github/qubit-ltd/js-logging?branch=master)
8
8
 
9
9
  [@qubit-ltd/logging] 是一个 JavaScript 库,通过装饰器为类方法和属性提供强大的日志记录功能。
10
10
  该库旨在与[Vue.js 类组件]无缝集成,为处理 JavaScript 项目中的日志记录提供了优雅的解决方案。
@@ -439,7 +439,7 @@ function processData(data, options = {}) {
439
439
 
440
440
  ```bash
441
441
  # 克隆仓库
442
- git clone https://github.com/Haixing-Hu/js-logging.git
442
+ git clone https://github.com/qubit-ltd/js-logging.git
443
443
  cd js-logging
444
444
 
445
445
  # 安装依赖
@@ -458,4 +458,4 @@ yarn build
458
458
 
459
459
  [@qubit-ltd/logging]: https://npmjs.com/package/@qubit-ltd/logging
460
460
  [Vue.js 类组件]: https://github.com/Haixing-Hu/vue3-class-component/
461
- [GitHub 仓库]: https://github.com/Haixing-Hu/js-logging
461
+ [GitHub 仓库]: https://github.com/qubit-ltd/js-logging
package/dist/logging.cjs CHANGED
@@ -46,7 +46,7 @@ function _createClass(e, r, t) {
46
46
 
47
47
  ////////////////////////////////////////////////////////////////////////////////
48
48
  //
49
- // Copyright (c) 2022 - 2023.
49
+ // Copyright (c) 2022 - 2026.
50
50
  // Haixing Hu, Qubit Co. Ltd.
51
51
  //
52
52
  // All rights reserved.
@@ -58,14 +58,14 @@ function _createClass(e, r, t) {
58
58
  *
59
59
  * @author Haixing Hu
60
60
  */
61
- var LOGGING_LEVELS = {
61
+ var LOGGING_LEVELS = Object.freeze({
62
62
  TRACE: 0,
63
63
  DEBUG: 1,
64
64
  INFO: 2,
65
65
  WARN: 3,
66
66
  ERROR: 4,
67
67
  NONE: 5
68
- };
68
+ });
69
69
 
70
70
  /**
71
71
  * Checks the validity of an appender.
@@ -93,7 +93,32 @@ function checkAppender(appender) {
93
93
 
94
94
  ////////////////////////////////////////////////////////////////////////////////
95
95
  //
96
- // Copyright (c) 2022 - 2023.
96
+ // Copyright (c) 2022 - 2026.
97
+ // Haixing Hu, Qubit Co. Ltd.
98
+ //
99
+ // All rights reserved.
100
+ //
101
+ ////////////////////////////////////////////////////////////////////////////////
102
+
103
+ /**
104
+ * Determines whether a value is a string.
105
+ *
106
+ * A value is a string if it is a string or a `String` object.
107
+ *
108
+ * @param {any} value
109
+ * The value to be checked.
110
+ * @return {boolean}
111
+ * `true` if the value is a string; `false` otherwise.
112
+ * @author Haixing Hu
113
+ * @private
114
+ */
115
+ function isString(value) {
116
+ return typeof value === 'string' || value instanceof String;
117
+ }
118
+
119
+ ////////////////////////////////////////////////////////////////////////////////
120
+ //
121
+ // Copyright (c) 2022 - 2026.
97
122
  // Haixing Hu, Qubit Co. Ltd.
98
123
  //
99
124
  // All rights reserved.
@@ -109,7 +134,7 @@ function checkAppender(appender) {
109
134
  * @private
110
135
  */
111
136
  function checkLoggingLevel(level) {
112
- if (typeof level !== 'string') {
137
+ if (!isString(level)) {
113
138
  throw new TypeError('The logging level must be a string.');
114
139
  }
115
140
  if (LOGGING_LEVELS[level] === undefined) {
@@ -119,13 +144,14 @@ function checkLoggingLevel(level) {
119
144
 
120
145
  ////////////////////////////////////////////////////////////////////////////////
121
146
  //
122
- // Copyright (c) 2022 - 2023.
147
+ // Copyright (c) 2022 - 2026.
123
148
  // Haixing Hu, Qubit Co. Ltd.
124
149
  //
125
150
  // All rights reserved.
126
151
  //
127
152
  ////////////////////////////////////////////////////////////////////////////////
128
153
 
154
+
129
155
  /**
130
156
  * Convert a string to uppercase.
131
157
  *
@@ -137,7 +163,7 @@ function checkLoggingLevel(level) {
137
163
  * @private
138
164
  */
139
165
  function upperCaseString(value) {
140
- if (typeof value !== 'string' && !(value instanceof String)) {
166
+ if (!isString(value)) {
141
167
  return value;
142
168
  }
143
169
  return value.toUpperCase();
@@ -145,32 +171,7 @@ function upperCaseString(value) {
145
171
 
146
172
  ////////////////////////////////////////////////////////////////////////////////
147
173
  //
148
- // Copyright (c) 2022 - 2024.
149
- // Haixing Hu, Qubit Co. Ltd.
150
- //
151
- // All rights reserved.
152
- //
153
- ////////////////////////////////////////////////////////////////////////////////
154
-
155
- /**
156
- * Determines whether a value is a string.
157
- *
158
- * A value is a string if it is a string or a `String` object.
159
- *
160
- * @param {any} value
161
- * The value to be checked.
162
- * @return {boolean}
163
- * `true` if the value is a string; `false` otherwise.
164
- * @author Haixing Hu
165
- * @private
166
- */
167
- function isString(value) {
168
- return typeof value === 'string' || value instanceof String;
169
- }
170
-
171
- ////////////////////////////////////////////////////////////////////////////////
172
- //
173
- // Copyright (c) 2022 - 2024.
174
+ // Copyright (c) 2022 - 2026.
174
175
  // Haixing Hu, Qubit Co. Ltd.
175
176
  //
176
177
  // All rights reserved.
@@ -234,7 +235,7 @@ function _toConsumableArray(r) {
234
235
 
235
236
  ////////////////////////////////////////////////////////////////////////////////
236
237
  //
237
- // Copyright (c) 2022 - 2024.
238
+ // Copyright (c) 2022 - 2026.
238
239
  // Haixing Hu, Qubit Co. Ltd.
239
240
  //
240
241
  // All rights reserved.
@@ -310,7 +311,7 @@ function bindWithArrowFunction(logger, method, level, appender) {
310
311
 
311
312
  ////////////////////////////////////////////////////////////////////////////////
312
313
  //
313
- // Copyright (c) 2022 - 2024.
314
+ // Copyright (c) 2022 - 2026.
314
315
  // Haixing Hu, Qubit Co. Ltd.
315
316
  //
316
317
  // All rights reserved.
@@ -347,7 +348,7 @@ function bindWithoutPrefix(logger, method, level, appender) {
347
348
 
348
349
  ////////////////////////////////////////////////////////////////////////////////
349
350
  //
350
- // Copyright (c) 2022 - 2024.
351
+ // Copyright (c) 2022 - 2026.
351
352
  // Haixing Hu, Qubit Co. Ltd.
352
353
  //
353
354
  // All rights reserved.
@@ -394,7 +395,7 @@ function bindWithFunctionBind(logger, method, level, appender) {
394
395
 
395
396
  ////////////////////////////////////////////////////////////////////////////////
396
397
  //
397
- // Copyright (c) 2022 - 2023.
398
+ // Copyright (c) 2022 - 2026.
398
399
  // Haixing Hu, Qubit Co. Ltd.
399
400
  //
400
401
  // All rights reserved.
@@ -1120,7 +1121,7 @@ var Logger = /*#__PURE__*/function () {
1120
1121
 
1121
1122
  ////////////////////////////////////////////////////////////////////////////////
1122
1123
  //
1123
- // Copyright (c) 2022 - 2023.
1124
+ // Copyright (c) 2022 - 2026.
1124
1125
  // Haixing Hu, Qubit Co. Ltd.
1125
1126
  //
1126
1127
  // All rights reserved.
@@ -1203,7 +1204,7 @@ function vueLogDecorator(options, key, originalMethod) {
1203
1204
  *
1204
1205
  * Usage example:
1205
1206
  * ```js
1206
- * import { Log } from '@haixing_hu/logging';
1207
+ * import { Log } from '@qubit-ltd/logging';
1207
1208
  *
1208
1209
  * class Person {
1209
1210
  * @Log
@@ -1234,7 +1235,7 @@ function Log(target, context) {
1234
1235
  throw new TypeError('The `@Log` can only decorate a class method.');
1235
1236
  }
1236
1237
  // decorate the class-style Vue component
1237
- // see the `createDecorator()` function in `@haixing_hu/vue3-class-component`
1238
+ // see the `createDecorator()` function in `@qubit-ltd/vue3-class-component`
1238
1239
  var metadata = context.metadata;
1239
1240
  (_metadata$VUE3_CLASS_ = metadata[VUE3_CLASS_COMPONENT_DECORATORS_KEY]) !== null && _metadata$VUE3_CLASS_ !== void 0 ? _metadata$VUE3_CLASS_ : metadata[VUE3_CLASS_COMPONENT_DECORATORS_KEY] = [];
1240
1241
  metadata[VUE3_CLASS_COMPONENT_DECORATORS_KEY].push(function (Class, instance, options) {
@@ -1262,7 +1263,7 @@ function Log(target, context) {
1262
1263
  *
1263
1264
  * Example usage:
1264
1265
  * ```js
1265
- * import { HasLogger } from '@haixing_hu/logging';
1266
+ * import { HasLogger } from '@qubit-ltd/logging';
1266
1267
  *
1267
1268
  * @HasLogger
1268
1269
  * class MyClass {
@@ -1274,8 +1275,8 @@ function Log(target, context) {
1274
1275
  *
1275
1276
  * The following is another example usage with the class component of Vue.js:
1276
1277
  * ```js
1277
- * import { Component, toVue } from '@haixing_hu/vue3-class-component';
1278
- * import { HasLogger, Log } from '@haixing_hu/logging';
1278
+ * import { Component, toVue } from '@qubit-ltd/vue3-class-component';
1279
+ * import { HasLogger, Log } from '@qubit-ltd/logging';
1279
1280
  *
1280
1281
  * @Component({
1281
1282
  * template: '<p &#064;click="foo">{{ message }}</p>',
@@ -1323,7 +1324,7 @@ function HasLogger(Class, context) {
1323
1324
 
1324
1325
  ////////////////////////////////////////////////////////////////////////////////
1325
1326
  //
1326
- // Copyright (c) 2022 - 2023.
1327
+ // Copyright (c) 2022 - 2026.
1327
1328
  // Haixing Hu, Qubit Co. Ltd.
1328
1329
  //
1329
1330
  // All rights reserved.