@qubit-ltd/logging 1.4.8 → 1.4.10

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.
Files changed (65) hide show
  1. package/README.md +25 -25
  2. package/README.zh_CN.md +12 -12
  3. package/doc/api/Logger.html +3 -3352
  4. package/doc/api/data/search.json +1 -0
  5. package/doc/api/fonts/Inconsolata-Regular.ttf +0 -0
  6. package/doc/api/fonts/OpenSans-Regular.ttf +0 -0
  7. package/doc/api/fonts/WorkSans-Bold.ttf +0 -0
  8. package/doc/api/global.html +6 -755
  9. package/doc/api/index.html +29 -248
  10. package/doc/api/scripts/core.js +726 -0
  11. package/doc/api/scripts/core.min.js +23 -0
  12. package/doc/api/scripts/resize.js +90 -0
  13. package/doc/api/scripts/search.js +265 -0
  14. package/doc/api/scripts/search.min.js +6 -0
  15. package/doc/api/scripts/{prettify → third-party}/Apache-License-2.0.txt +202 -202
  16. package/doc/api/scripts/third-party/fuse.js +9 -0
  17. package/doc/api/scripts/third-party/hljs-line-num-original.js +369 -0
  18. package/doc/api/scripts/third-party/hljs-line-num.js +1 -0
  19. package/doc/api/scripts/third-party/hljs-original.js +5171 -0
  20. package/doc/api/scripts/third-party/hljs.js +1 -0
  21. package/doc/api/scripts/third-party/popper.js +5 -0
  22. package/doc/api/scripts/third-party/tippy.js +1 -0
  23. package/doc/api/scripts/third-party/tocbot.js +672 -0
  24. package/doc/api/scripts/third-party/tocbot.min.js +1 -0
  25. package/doc/api/styles/clean-jsdoc-theme-base.css +1159 -0
  26. package/doc/api/styles/clean-jsdoc-theme-dark.css +412 -0
  27. package/doc/api/styles/clean-jsdoc-theme-light.css +482 -0
  28. package/doc/api/styles/clean-jsdoc-theme-scrollbar.css +30 -0
  29. package/doc/api/styles/clean-jsdoc-theme-without-scrollbar.min.css +1 -0
  30. package/doc/api/styles/clean-jsdoc-theme.min.css +1 -0
  31. package/doc/logging.min.visualization.html +1 -1
  32. package/doc/logging.visualization.html +1 -1
  33. package/package.json +2 -2
  34. package/doc/api/fonts/OpenSans-Bold-webfont.eot +0 -0
  35. package/doc/api/fonts/OpenSans-Bold-webfont.svg +0 -1838
  36. package/doc/api/fonts/OpenSans-Bold-webfont.woff +0 -0
  37. package/doc/api/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  38. package/doc/api/fonts/OpenSans-BoldItalic-webfont.svg +0 -1838
  39. package/doc/api/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  40. package/doc/api/fonts/OpenSans-Italic-webfont.eot +0 -0
  41. package/doc/api/fonts/OpenSans-Italic-webfont.svg +0 -1838
  42. package/doc/api/fonts/OpenSans-Italic-webfont.woff +0 -0
  43. package/doc/api/fonts/OpenSans-Light-webfont.eot +0 -0
  44. package/doc/api/fonts/OpenSans-Light-webfont.svg +0 -1839
  45. package/doc/api/fonts/OpenSans-Light-webfont.woff +0 -0
  46. package/doc/api/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  47. package/doc/api/fonts/OpenSans-LightItalic-webfont.svg +0 -1843
  48. package/doc/api/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  49. package/doc/api/fonts/OpenSans-Regular-webfont.eot +0 -0
  50. package/doc/api/fonts/OpenSans-Regular-webfont.svg +0 -1839
  51. package/doc/api/fonts/OpenSans-Regular-webfont.woff +0 -0
  52. package/doc/api/fonts/OpenSans-Semibold-webfont.eot +0 -0
  53. package/doc/api/fonts/OpenSans-Semibold-webfont.svg +0 -1838
  54. package/doc/api/fonts/OpenSans-Semibold-webfont.ttf +0 -0
  55. package/doc/api/fonts/OpenSans-Semibold-webfont.woff +0 -0
  56. package/doc/api/fonts/OpenSans-SemiboldItalic-webfont.eot +0 -0
  57. package/doc/api/fonts/OpenSans-SemiboldItalic-webfont.svg +0 -1838
  58. package/doc/api/fonts/OpenSans-SemiboldItalic-webfont.ttf +0 -0
  59. package/doc/api/fonts/OpenSans-SemiboldItalic-webfont.woff +0 -0
  60. package/doc/api/scripts/linenumber.js +0 -34
  61. package/doc/api/scripts/prettify/lang-css.js +0 -2
  62. package/doc/api/scripts/prettify/prettify.js +0 -28
  63. package/doc/api/styles/jsdoc-default.css +0 -699
  64. package/doc/api/styles/prettify-jsdoc.css +0 -120
  65. package/doc/api/styles/prettify-tomorrow.css +0 -141
package/README.md CHANGED
@@ -6,9 +6,9 @@
6
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
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)
8
8
 
9
- [@qubit-ltd/logging] is a JavaScript library that provides powerful
10
- logging capabilities through decorators for class methods and properties.
11
- This library is designed to seamlessly integrate with [Vue.js class components],
9
+ [@qubit-ltd/logging] is a JavaScript library that provides powerful
10
+ logging capabilities through decorators for class methods and properties.
11
+ This library is designed to seamlessly integrate with [Vue.js class components],
12
12
  offering an elegant solution for handling logging in your JavaScript projects.
13
13
 
14
14
  ## Features
@@ -32,14 +32,14 @@ or
32
32
  yarn add @qubit-ltd/logging
33
33
  ```
34
34
 
35
- ## The `Logger` Class
35
+ ## The Logger Class
36
36
 
37
37
  The `Logger` class provides a simple yet flexible logging interface.
38
38
 
39
39
  ### Get or create a Logger
40
40
 
41
41
  You can retrieve a `Logger` instance by calling the static method
42
- `Logger.getLogger(name, options)`, where
42
+ `Logger.getLogger(name, options)`, where
43
43
  - `name` is the identifier of the logger. If a logger with the same name exists,
44
44
  it will be returned; otherwise, a new one will be created.
45
45
  - `options` (optional) is an object that may include:
@@ -50,7 +50,7 @@ You can retrieve a `Logger` instance by calling the static method
50
50
  - `level: string`: defines the logging level (`TRACE`, `DEBUG`, `INFO`, `WARN`,
51
51
  `ERROR`, `NONE`). Case-insensitive. If omitted, the existing logging level
52
52
  of the logger will be used, or the default logging level will be assigned to
53
- a new logger.
53
+ a new logger.
54
54
 
55
55
  Example:
56
56
 
@@ -87,7 +87,7 @@ You can use placeholders in log messages to dynamically insert variables:
87
87
 
88
88
  - `%o` or `%O`: JavaScript object output. Clicking the object name opens
89
89
  more information about it in the inspector.
90
- - `%d` or` %i`: Integer output (supports formatting). For example,
90
+ - `%d` or` %i`: Integer output (supports formatting). For example,
91
91
  `logger.info('Foo %.2d', 1.1)` will output the number as two significant
92
92
  figures with a leading 0: `Foo 01`.
93
93
  - `%s`: String output.
@@ -220,16 +220,16 @@ Logger.clearAllLoggers();
220
220
 
221
221
  ### Default Levels and Appenders
222
222
 
223
- The default logging levels and appenders are used when creating a new logger
223
+ The default logging levels and appenders are used when creating a new logger
224
224
  without specifying the level or appender.
225
225
 
226
226
  - `Logger.getDefaultLevel()`: Gets the default logging level.
227
227
  - `Logger.setDefaultLevel(level)`: Sets the default logging level.
228
- - `Logger.resetDefaultLevel()`: Resets the default logging level to the
228
+ - `Logger.resetDefaultLevel()`: Resets the default logging level to the
229
229
  factory value.
230
230
  - `Logger.getDefaultAppender()`: Gets the default logging appender.
231
231
  - `Logger.setDefaultAppender(appender)`: Sets the default logging appender.
232
- - `Logger.resetDefaultAppender()`: Resets the default logging appender to the
232
+ - `Logger.resetDefaultAppender()`: Resets the default logging appender to the
233
233
  factory value.
234
234
 
235
235
  Example:
@@ -286,9 +286,9 @@ Logger.setAllAppenders(fileAppender);
286
286
  ### Reset to Factory Defaults
287
287
 
288
288
  - `Logger.reset()`: Resets all loggers to the factory default settings. This
289
- includes clearing all existing loggers, and resetting the default logging
289
+ includes clearing all existing loggers, and resetting the default logging
290
290
  level and the default logging appender.
291
-
291
+
292
292
  Example:
293
293
 
294
294
  ```javascript
@@ -297,9 +297,9 @@ Example:
297
297
  Logger.reset();
298
298
  ```
299
299
 
300
- ## The `@Log` Decorator
300
+ ## The @Log Decorator
301
301
 
302
- The `@Log` decorator automatically logs the method signature, including the
302
+ The `@Log` decorator automatically logs the method signature, including the
303
303
  class name, method name, and parameters.
304
304
 
305
305
  Example:
@@ -313,7 +313,7 @@ class Person {
313
313
  // method implementation
314
314
  return `Eating ${meal.name}`;
315
315
  }
316
-
316
+
317
317
  // Custom options for the Log decorator
318
318
  @Log({ level: 'INFO', withResult: true })
319
319
  calculateCalories(food, amount) {
@@ -324,14 +324,14 @@ class Person {
324
324
 
325
325
  const person = new Person();
326
326
  const meal = { name: 'Breakfast', type: 'healthy' };
327
- person.eat(meal);
327
+ person.eat(meal);
328
328
  // Logs: "Person.eat({"name":"Breakfast","type":"healthy"})"
329
329
 
330
330
  const calories = person.calculateCalories({ caloriesPerUnit: 50 }, 4);
331
331
  // Logs: "Person.calculateCalories({"caloriesPerUnit":50}, 4) => 200"
332
332
  ```
333
333
 
334
- ## The `@HasLogger` Decorator
334
+ ## The @HasLogger Decorator
335
335
 
336
336
  The `@HasLogger` decorator adds a named logger to a class, which is accessible
337
337
  via the `logger` property.
@@ -346,7 +346,7 @@ class MyClass {
346
346
  foo() {
347
347
  this.logger.debug('This is MyClass.foo()');
348
348
  }
349
-
349
+
350
350
  bar(param) {
351
351
  this.logger.info('Processing with parameter: %o', param);
352
352
  // do something with param
@@ -375,15 +375,15 @@ import { Component, toVue } from '@qubit-ltd/vue3-class-component';
375
375
  })
376
376
  @HasLogger
377
377
  class MyComponent {
378
-
378
+
379
379
  message = 'hello world';
380
-
380
+
381
381
  @Log
382
382
  foo() {
383
383
  this.logger.debug('This is MyComponent.foo()');
384
384
  this.message = 'clicked at ' + new Date().toLocaleTimeString();
385
385
  }
386
-
386
+
387
387
  @Log({ level: 'INFO' })
388
388
  async fetchData() {
389
389
  try {
@@ -402,7 +402,7 @@ class MyComponent {
402
402
  export default toVue(MyComponent);
403
403
  ```
404
404
 
405
- **Note**: The `@HasLogger` decorator must be placed **after** the `@Component` decorator.
405
+ **Note**: The `@HasLogger` decorator must be placed **after** the `@Component` decorator.
406
406
 
407
407
  ## Advanced Usage
408
408
 
@@ -416,7 +416,7 @@ import fs from 'fs';
416
416
 
417
417
  const fileAppender = {
418
418
  _writeToFile(level, message, ...args) {
419
- const formattedArgs = args.map(arg =>
419
+ const formattedArgs = args.map(arg =>
420
420
  typeof arg === 'object' ? JSON.stringify(arg) : String(arg)
421
421
  );
422
422
  const logEntry = `[${new Date().toISOString()}] [${level}] ${message} ${formattedArgs.join(' ')}\n`;
@@ -440,14 +440,14 @@ import Logger from '@qubit-ltd/logging';
440
440
 
441
441
  function processData(data, options = {}) {
442
442
  const logger = Logger.getLogger('DataProcessor');
443
-
443
+
444
444
  // Enable debug logging only when explicitly requested
445
445
  if (options.debug) {
446
446
  logger.setLevel('DEBUG');
447
447
  } else {
448
448
  logger.setLevel('INFO');
449
449
  }
450
-
450
+
451
451
  logger.debug('Processing data with options: %o', options);
452
452
  // rest of the function
453
453
  }
package/README.zh_CN.md CHANGED
@@ -30,7 +30,7 @@ npm install @qubit-ltd/logging
30
30
  yarn add @qubit-ltd/logging
31
31
  ```
32
32
 
33
- ## `Logger`
33
+ ## Logger 类
34
34
 
35
35
  `Logger` 类提供了一个简单而灵活的日志记录接口。
36
36
 
@@ -277,7 +277,7 @@ Logger.setAllAppenders(fileAppender);
277
277
  Logger.reset();
278
278
  ```
279
279
 
280
- ## `@Log` 装饰器
280
+ ## @Log 装饰器
281
281
 
282
282
  `@Log` 装饰器会自动记录方法签名,包括类名、方法名和参数。
283
283
 
@@ -292,7 +292,7 @@ class Person {
292
292
  // 方法实现
293
293
  return `正在吃${meal.name}`;
294
294
  }
295
-
295
+
296
296
  // Log装饰器的自定义选项
297
297
  @Log({ level: 'INFO', withResult: true })
298
298
  calculateCalories(food, amount) {
@@ -303,14 +303,14 @@ class Person {
303
303
 
304
304
  const person = new Person();
305
305
  const meal = { name: '早餐', type: '健康' };
306
- person.eat(meal);
306
+ person.eat(meal);
307
307
  // 记录: "Person.eat({"name":"早餐","type":"健康"})"
308
308
 
309
309
  const calories = person.calculateCalories({ caloriesPerUnit: 50 }, 4);
310
310
  // 记录: "Person.calculateCalories({"caloriesPerUnit":50}, 4) => 200"
311
311
  ```
312
312
 
313
- ## `@HasLogger` 装饰器
313
+ ## @HasLogger 装饰器
314
314
 
315
315
  `@HasLogger` 装饰器会为类添加一个命名的日志记录器,可以通过 `logger` 属性访问。
316
316
 
@@ -324,7 +324,7 @@ class MyClass {
324
324
  foo() {
325
325
  this.logger.debug('这是MyClass.foo()');
326
326
  }
327
-
327
+
328
328
  bar(param) {
329
329
  this.logger.info('使用参数处理: %o', param);
330
330
  // 使用param做一些事情
@@ -353,15 +353,15 @@ import { Component, toVue } from '@qubit-ltd/vue3-class-component';
353
353
  })
354
354
  @HasLogger
355
355
  class MyComponent {
356
-
356
+
357
357
  message = 'hello world';
358
-
358
+
359
359
  @Log
360
360
  foo() {
361
361
  this.logger.debug('这是MyComponent.foo()');
362
362
  this.message = '点击于 ' + new Date().toLocaleTimeString();
363
363
  }
364
-
364
+
365
365
  @Log({ level: 'INFO' })
366
366
  async fetchData() {
367
367
  try {
@@ -394,7 +394,7 @@ import fs from 'fs';
394
394
 
395
395
  const fileAppender = {
396
396
  _writeToFile(level, message, ...args) {
397
- const formattedArgs = args.map(arg =>
397
+ const formattedArgs = args.map(arg =>
398
398
  typeof arg === 'object' ? JSON.stringify(arg) : String(arg)
399
399
  );
400
400
  const logEntry = `[${new Date().toISOString()}] [${level}] ${message} ${formattedArgs.join(' ')}\n`;
@@ -418,14 +418,14 @@ import Logger from '@qubit-ltd/logging';
418
418
 
419
419
  function processData(data, options = {}) {
420
420
  const logger = Logger.getLogger('DataProcessor');
421
-
421
+
422
422
  // 仅在明确请求时启用调试日志
423
423
  if (options.debug) {
424
424
  logger.setLevel('DEBUG');
425
425
  } else {
426
426
  logger.setLevel('INFO');
427
427
  }
428
-
428
+
429
429
  logger.debug('使用选项处理数据: %o', options);
430
430
  // 函数的其余部分
431
431
  }