analogger 1.18.3 → 1.19.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/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
- ## [1.18.3](https://github.com/thimpat/analogger/compare/v1.18.2...v1.18.3) (2022-08-31)
1
+ # [1.19.0](https://github.com/thimpat/analogger/compare/v1.18.3...v1.19.0) (2022-09-03)
2
2
 
3
+ ## [1.18.3](https://github.com/thimpat/analogger/compare/v1.18.2...v1.18.3) (2022-08-31)
4
+
3
5
  ## [1.18.2](https://github.com/thimpat/analogger/compare/v1.18.1...v1.18.2) (2022-08-13)
4
6
 
5
7
  ## [1.18.1](https://github.com/thimpat/analogger/compare/v1.18.0...v1.18.1) (2022-08-13)
package/README.md CHANGED
@@ -315,15 +315,17 @@ Display the browser native message box if run from it; otherwise, it displays th
315
315
  ### setOptions()
316
316
 
317
317
 
318
- | **Options** | **default** | **Expect** | **Description** |
319
- |------------------|-------------|-----------------------|------------------------------------------------------------------------------------|
320
- | silent | false | boolean | _Hide logs from console (not errors)_ |
321
- | hideLog | false | boolean | _Same as above (silent has precedence over hideLog)_ |
322
- | hideError | false | boolean | _Hide errors from console_ |
323
- | hideHookMessage | false | boolean | _Hide the automatic message shown when some native console methods are overridden_ |
324
- | hidePassingTests | false | boolean | _Hide Live test results_ |
325
- | logToDom | false | string (DOM Selector) | _display log in a DOM container_ |
326
- | logToFile | false | string (File path) | _write log to a file if running from Node_ |
318
+ | **Options** | **default** | **Expect** | **Description** |
319
+ |------------------|-------------|-----------------------------------|------------------------------------------------------------------------------------|
320
+ | silent | false | boolean | _Hide logs from console (not errors)_ |
321
+ | hideLog | false | boolean | _Same as above (silent has precedence over hideLog)_ |
322
+ | hideError | false | boolean | _Hide errors from console_ |
323
+ | hideHookMessage | false | boolean | _Hide the automatic message shown when some native console methods are overridden_ |
324
+ | hidePassingTests | false | boolean | _Hide Live test results_ |
325
+ | logToDom | false | string (DOM Selector) | _display log in a DOM container_ |
326
+ | logToFile | false | string (File path) | _write log to a file if running from Node_ |
327
+ | logToRemote | undefined | string (url) | _Send log to a remote (more info in the next version)_ |
328
+ | requiredLogLevel | "LOG" | "LOG" / "INFO" / "WARN" / "ERROR" | _Define the log level from which the system can show a log entry_ |
327
329
 
328
330
 
329
331
  ```javascript
@@ -416,7 +418,7 @@ A context allows grouping the logs by functionality by assigning them some colou
416
418
 
417
419
  ```javascript
418
420
  const LOG_CONTEXTS = {STANDARD: null, TEST: {color: "#B18904"}, C1: null, C2: null, C3: null, DEFAULT: {}}
419
- const LOG_TARGETS = {ALL: "ALL", DEV1: "TOM", DEV2: "TIM", USER: "USER"};
421
+ const DEFAULT_LOG_TARGETS = {ALL: "ALL", DEV1: "TOM", DEV2: "TIM", USER: "USER"};
420
422
 
421
423
  anaLogger.setContexts(LOG_CONTEXTS);
422
424
 
@@ -494,29 +496,38 @@ setActiveTarget() allows hiding logs from other devs or roles.
494
496
  ##### Examples
495
497
 
496
498
  ```javascript
499
+
500
+ // "ALL" & "USER" are predefined targets
501
+ const LOG_TARGETS = ["GROUP1", "GROUP2", "TOM", "TIM"/*, "ALL", "USER"*/];
502
+
503
+ // Contexts define how the log should be seen
497
504
  const LOG_CONTEXTS = {STANDARD: null, TEST: {color: "#B18904", symbol: "⏰"}, C1: null, C2: null, C3: null, DEFAULT: {}}
498
- const LOG_TARGETS = {ALL: "ALL", DEV1: "TOM", DEV2: "TIM", USER: "USER"};
499
505
 
500
506
  anaLogger.setContexts(LOG_CONTEXTS);
501
- anaLogger.setTargets(LOG_TARGETS); // Allowed targets = "ALL", "TOM", "TIM", "USER"
502
507
 
503
- // Many ways to assign an active target
504
- anaLogger.setActiveTarget(LOG_TARGETS.DEV1); // <- You are "TOM"
508
+ // Allowed targets = "ALL", "TOM", "TIM", "USER"
509
+ anaLogger.setTargets("GROUP1", "GROUP2", "TOM", "TIM"/*, "ALL", "USER"*/);
510
+
511
+ // Assign an active target
512
+ anaLogger.setActiveTarget("TOM"); // <- You are "TOM"
505
513
 
506
514
  // Seen as TOM
507
- anaLogger.log({target: LOG_TARGETS.DEV1}, `Testing log 1`); // You will see this
508
- anaLogger.log({target: "TOM"}, `Testing log 1`); // You will see this
515
+ anaLogger.log({target: "TOM"}, `Testing log 1`); // You will see this
509
516
 
510
517
  // Not seen (only for TIM)
511
- anaLogger.log({target: LOG_TARGETS.DEV2}, `Testing log 2`); // You will not see this
512
- anaLogger.log({target: "TIM"}, `Testing log 2`); // You will not see this
518
+ anaLogger.log({target: "TOM"}, `Testing log 2`); // You will not see this
519
+
520
+
521
+ anaLogger.setActiveTarget(["TOM", "GROUP1"]);
522
+ anaLogger.log({target: "TOM"}, `Testing log 3`); // You will see this
523
+ anaLogger.log({target: "TIM"}, `Testing log 4`); // You will not see this
524
+ anaLogger.log({target: "GROUP1"}, `Testing log 5`); // You will see this
513
525
 
514
526
  // No target defined. Everybody sees this
515
- anaLogger.log({context: LOG_CONTEXTS.STANDARD}, `Testing log 3`); // You will see this
516
- anaLogger.log(`Testing log 4`); // You will see this. No context = LOG_CONTEXTS.ALL
527
+ anaLogger.log({context: null}, `Testing log 6`); // You will see this
528
+ anaLogger.log(`Testing log 4`); // You will see this. No context = "ALL"
517
529
 
518
530
 
519
- anaLogger.log(LOG_CONTEXTS.C1, `Test Log example C1`); // You will see this
520
531
  ```
521
532
 
522
533
  To assign the active target, you could use IPs, read a file, read an environment variable, etc.