@webex/plugin-logger 2.60.1-next.10 → 2.60.1-next.11

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/dist/logger.js CHANGED
@@ -288,7 +288,7 @@ var Logger = _webexCore.WebexPlugin.extend({
288
288
  }
289
289
  return buffer.join('\n');
290
290
  },
291
- version: "2.60.1-next.10"
291
+ version: "2.60.1-next.11"
292
292
  });
293
293
 
294
294
  /**
package/package.json CHANGED
@@ -24,20 +24,20 @@
24
24
  "@webex/eslint-config-legacy": "0.0.0",
25
25
  "@webex/jest-config-legacy": "0.0.0",
26
26
  "@webex/legacy-tools": "0.0.0",
27
- "@webex/test-helper-chai": "2.60.1-next.10",
28
- "@webex/test-helper-mocha": "2.60.1-next.10",
29
- "@webex/test-helper-mock-webex": "2.60.1-next.10",
30
- "@webex/test-helper-test-users": "2.60.1-next.10",
27
+ "@webex/test-helper-chai": "2.60.1-next.11",
28
+ "@webex/test-helper-mocha": "2.60.1-next.11",
29
+ "@webex/test-helper-mock-webex": "2.60.1-next.11",
30
+ "@webex/test-helper-test-users": "2.60.1-next.11",
31
31
  "eslint": "^8.24.0",
32
32
  "prettier": "^2.7.1",
33
33
  "sinon": "^9.2.4"
34
34
  },
35
35
  "dependencies": {
36
- "@webex/common": "2.60.1-next.10",
37
- "@webex/test-helper-chai": "2.60.1-next.10",
38
- "@webex/test-helper-mocha": "2.60.1-next.10",
39
- "@webex/test-helper-mock-webex": "2.60.1-next.10",
40
- "@webex/webex-core": "2.60.1-next.10",
36
+ "@webex/common": "2.60.1-next.11",
37
+ "@webex/test-helper-chai": "2.60.1-next.11",
38
+ "@webex/test-helper-mocha": "2.60.1-next.11",
39
+ "@webex/test-helper-mock-webex": "2.60.1-next.11",
40
+ "@webex/webex-core": "2.60.1-next.11",
41
41
  "lodash": "^4.17.21"
42
42
  },
43
43
  "scripts": {
@@ -45,10 +45,9 @@
45
45
  "build:src": "webex-legacy-tools build -dest \"./dist\" -src \"./src\" -js -ts -maps",
46
46
  "deploy:npm": "yarn npm publish",
47
47
  "test": "yarn test:style && yarn test:unit && yarn test:integration && yarn test:browser",
48
- "test:browser": "webex-legacy-tools test --integration --unit --runner karma",
49
- "test:integration": "webex-legacy-tools test --integration --runner mocha",
48
+ "test:browser": "webex-legacy-tools test --unit --runner karma",
50
49
  "test:style": "eslint ./src/**/*.*",
51
50
  "test:unit": "webex-legacy-tools test --unit --runner jest"
52
51
  },
53
- "version": "2.60.1-next.10"
52
+ "version": "2.60.1-next.11"
54
53
  }
@@ -6,7 +6,7 @@
6
6
  import {assert} from '@webex/test-helper-chai';
7
7
  import MockWebex from '@webex/test-helper-mock-webex';
8
8
  import sinon from 'sinon';
9
- import {browserOnly, nodeOnly} from '@webex/test-helper-mocha';
9
+ import {browserOnly, nodeOnly, inBrowser} from '@webex/test-helper-mocha';
10
10
  import Logger, {levels} from '@webex/plugin-logger';
11
11
  import {WebexHttpError} from '@webex/webex-core';
12
12
 
@@ -636,11 +636,20 @@ describe('plugin-logger', () => {
636
636
  trackingid: '123',
637
637
  },
638
638
  });
639
- assert.calledWith(console[impl(level)], 'wx-js-sdk', {
640
- headers: {
641
- trackingid: '123',
642
- },
643
- });
639
+
640
+ if(inBrowser()) {
641
+ assert.calledWith(console[impl(level)], 'wx-js-sdk', JSON.stringify({
642
+ headers: {
643
+ trackingid: '123',
644
+ },
645
+ }));
646
+ } else {
647
+ assert.calledWith(console[impl(level)], 'wx-js-sdk', {
648
+ headers: {
649
+ trackingid: '123',
650
+ },
651
+ });
652
+ }
644
653
  });
645
654
  });
646
655
  });
@@ -654,15 +663,25 @@ describe('plugin-logger', () => {
654
663
  });
655
664
 
656
665
  // Assert auth was filtered
657
- assert.calledWith(console.log, 'wx-js-sdk', {Key: 'myKey'});
658
666
 
659
- webex.logger.log({
667
+ if(inBrowser()) {
668
+ assert.calledWith(console.log, "wx-js-sdk", JSON.stringify({Key: 'myKey'}));
669
+ } else {
670
+ assert.calledWith(console.log, "wx-js-sdk", {Key: 'myKey'});
671
+ }
672
+ webex.logger.log({
660
673
  authorization: 'XXXXXXX',
661
674
  Key: 'myKey',
662
675
  });
676
+ 9
677
+
678
+ if(inBrowser()) {
679
+ assert.calledWith(console.log, "wx-js-sdk", JSON.stringify({Key: 'myKey'}));
663
680
 
664
- assert.calledWith(console.log, 'wx-js-sdk', {Key: 'myKey'});
665
- });
681
+ } else {
682
+ assert.calledWith(console.log, "wx-js-sdk", {Key: 'myKey'});
683
+
684
+ } });
666
685
 
667
686
  it('redact emails', () => {
668
687
  webex.config.logger.level = 'trace';
@@ -694,7 +713,7 @@ describe('plugin-logger', () => {
694
713
  assert.calledWith(console.log, 'wx-js-sdk', 'https://example.com/example/j.php?MTID=[REDACTED]#abcdefg');
695
714
  });
696
715
 
697
- it('handle circular references', () => {
716
+ nodeOnly(it)('handle circular references', () => {
698
717
  webex.config.logger.level = 'trace';
699
718
 
700
719
  const object = {
@@ -713,12 +732,19 @@ describe('plugin-logger', () => {
713
732
  Key: 'myKey',
714
733
  };
715
734
 
735
+ // Has self reference which is bad
716
736
  expected.selfReference = expected;
717
737
 
718
- assert.calledWith(console.log, 'wx-js-sdk', expected);
719
- });
738
+ if(inBrowser()) {
739
+ assert.calledWith(console.log, "wx-js-sdk", JSON.stringify(expected));
740
+
741
+ } else {
742
+ assert.calledWith(console.log, "wx-js-sdk", expected);
743
+
744
+ }
745
+ });
720
746
 
721
- it('handle circular references in complex objects', () => {
747
+ nodeOnly(it)('handle circular references in complex objects', () => {
722
748
  webex.config.logger.level = 'trace';
723
749
 
724
750
  const func = () => true;
@@ -747,7 +773,7 @@ describe('plugin-logger', () => {
747
773
 
748
774
  webex.logger.log(object);
749
775
 
750
- assert.calledWith(console.log, 'wx-js-sdk', {
776
+ const res = {
751
777
  primativeString: 'justastring',
752
778
  primativeNum: 5,
753
779
  primativeBool: true,
@@ -764,9 +790,18 @@ describe('plugin-logger', () => {
764
790
  circularObjectRef: object,
765
791
  circularFunctionRef: func,
766
792
  },
793
+ }
794
+
795
+
796
+ if(inBrowser()) {
797
+ assert.calledWith(console.log, "wx-js-sdk", JSON.stringify(res));
798
+
799
+ } else {
800
+ assert.calledWith(console.log, "wx-js-sdk", res);
801
+
802
+ }
767
803
  });
768
804
  });
769
- });
770
805
 
771
806
  describe('#formatLogs()', () => {
772
807
  function sendRandomLog(log) {