@webex/plugin-logger 3.12.0 → 3.13.0-next.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/.repo-context.json +389 -0
- package/.sdd/manifest.json +334 -0
- package/AGENTS.md +175 -0
- package/dist/config.js +10 -4
- package/dist/config.js.map +1 -1
- package/dist/logger.js +220 -44
- package/dist/logger.js.map +1 -1
- package/docs/adr/0001-retain-product-readme.md +76 -0
- package/docs/adr/index.md +18 -0
- package/docs/architecture.md +263 -0
- package/docs/getting-started.md +88 -0
- package/docs/index.md +42 -0
- package/docs/specs/README.md +65 -0
- package/index.d.ts +43 -0
- package/package.json +11 -10
- package/schemas/repo-context.schema.json +796 -0
- package/src/config.js +10 -4
- package/src/docs/README.md +331 -0
- package/src/logger.js +211 -49
- package/test/unit/spec/logger.js +1201 -54
package/dist/logger.js
CHANGED
|
@@ -1,25 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _Symbol$toPrimitive = require("@babel/runtime-corejs2/core-js/symbol/to-primitive");
|
|
4
|
+
var _Object$keys2 = require("@babel/runtime-corejs2/core-js/object/keys");
|
|
5
|
+
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
|
|
6
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
|
|
7
|
+
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
|
|
8
|
+
var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
|
|
3
9
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
10
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
11
|
+
var _typeof3 = require("@babel/runtime-corejs2/helpers/typeof");
|
|
5
12
|
_Object$defineProperty(exports, "__esModule", {
|
|
6
13
|
value: true
|
|
7
14
|
});
|
|
8
15
|
exports.levels = exports.default = void 0;
|
|
9
|
-
var
|
|
16
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
10
17
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/toConsumableArray"));
|
|
18
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/objectWithoutProperties"));
|
|
19
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/typeof"));
|
|
11
20
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/slicedToArray"));
|
|
12
21
|
var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
|
|
13
22
|
var _entries = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/entries"));
|
|
14
23
|
var _deleteProperty = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/reflect/delete-property"));
|
|
24
|
+
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/array/is-array"));
|
|
15
25
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
|
|
16
26
|
var _common = require("@webex/common");
|
|
17
27
|
var _webexCore = require("@webex/webex-core");
|
|
18
28
|
var _lodash = require("lodash");
|
|
19
|
-
|
|
29
|
+
function ownKeys(e, r) { var t = _Object$keys2(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
30
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
31
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof3(i) ? i : i + ""; }
|
|
32
|
+
function _toPrimitive(t, r) { if ("object" != _typeof3(t) || !t) return t; var e = t[_Symbol$toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof3(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*!
|
|
20
33
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
34
|
+
*/ /**
|
|
35
|
+
* plugin-logger emits 'log:record' synchronously after it retains an entry.
|
|
36
|
+
* Use webex.logger.on('log:record', listener) to receive future records.
|
|
37
|
+
* Use webex.logger.off('log:record', listener) to remove the same listener.
|
|
38
|
+
* Listeners must not throw or log back into this logger synchronously.
|
|
39
|
+
* Nested logging can deliver newer records first to later listeners.
|
|
40
|
+
* A thrown error can stop delivery to later listeners.
|
|
21
41
|
*/
|
|
22
|
-
|
|
23
42
|
var precedence = {
|
|
24
43
|
silent: 0,
|
|
25
44
|
group: 1,
|
|
@@ -91,6 +110,26 @@ function walkAndFilter(object) {
|
|
|
91
110
|
return object;
|
|
92
111
|
}
|
|
93
112
|
|
|
113
|
+
/**
|
|
114
|
+
* Build a record from one retained entry. Live events and history use this function.
|
|
115
|
+
* @param {Array<mixed>} entry Formatted text with capture fields stored as named properties.
|
|
116
|
+
* @returns {Object} A record that shares the caller-owned metadata values.
|
|
117
|
+
*/
|
|
118
|
+
function _createLogRecord(entry) {
|
|
119
|
+
var record = {
|
|
120
|
+
sequence: entry.sequence,
|
|
121
|
+
timestamp: entry.timestamp,
|
|
122
|
+
level: entry.level,
|
|
123
|
+
source: entry.source,
|
|
124
|
+
body: entry.join(',')
|
|
125
|
+
};
|
|
126
|
+
if (entry.metadata) {
|
|
127
|
+
record.eventName = entry.metadata.eventName;
|
|
128
|
+
record.attributes = entry.metadata.attributes;
|
|
129
|
+
}
|
|
130
|
+
return record;
|
|
131
|
+
}
|
|
132
|
+
|
|
94
133
|
/**
|
|
95
134
|
* @class
|
|
96
135
|
*/
|
|
@@ -111,71 +150,146 @@ var Logger = _webexCore.WebexPlugin.extend({
|
|
|
111
150
|
}
|
|
112
151
|
},
|
|
113
152
|
session: {
|
|
114
|
-
// for
|
|
153
|
+
// Shared attributes for this instance. Each retained record copies their current values.
|
|
154
|
+
logAttributes: {
|
|
155
|
+
type: 'object'
|
|
156
|
+
},
|
|
157
|
+
// Keep the counter inside an object so increments do not emit Ampersand change events.
|
|
158
|
+
recordState: {
|
|
159
|
+
type: 'object',
|
|
160
|
+
/**
|
|
161
|
+
* Create empty state for this logger instance.
|
|
162
|
+
* @returns {Object} The shared SDK and client sequence counter.
|
|
163
|
+
*/
|
|
164
|
+
default: function _default() {
|
|
165
|
+
return {
|
|
166
|
+
// Last sequence assigned. Buffer trimming does not reset it.
|
|
167
|
+
lastSequence: 0
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
// Retained history and support-upload cursors when SDK and client logs share one buffer.
|
|
115
172
|
buffer: {
|
|
116
173
|
type: 'object',
|
|
117
174
|
default: function _default() {
|
|
118
175
|
return {
|
|
119
176
|
buffer: [],
|
|
120
|
-
nextIndex: 0
|
|
177
|
+
nextIndex: 0,
|
|
178
|
+
lastSubmitted: 0
|
|
121
179
|
};
|
|
122
180
|
}
|
|
123
181
|
},
|
|
182
|
+
// Current indentation depth for buffered groups.
|
|
124
183
|
groupLevel: {
|
|
125
184
|
type: 'number',
|
|
126
185
|
default: function _default() {
|
|
127
186
|
return 0;
|
|
128
187
|
}
|
|
129
188
|
},
|
|
130
|
-
//
|
|
189
|
+
// SDK history and support-upload cursors. Used only when separateLogBuffers is true.
|
|
131
190
|
sdkBuffer: {
|
|
132
191
|
type: 'object',
|
|
133
192
|
default: function _default() {
|
|
134
193
|
return {
|
|
135
194
|
buffer: [],
|
|
136
|
-
nextIndex: 0
|
|
195
|
+
nextIndex: 0,
|
|
196
|
+
lastSubmitted: 0
|
|
137
197
|
};
|
|
138
198
|
}
|
|
139
199
|
},
|
|
200
|
+
// Client history and support-upload cursors. Used only when separateLogBuffers is true.
|
|
140
201
|
clientBuffer: {
|
|
141
202
|
type: 'object',
|
|
142
203
|
default: function _default() {
|
|
143
204
|
return {
|
|
144
205
|
buffer: [],
|
|
145
|
-
nextIndex: 0
|
|
206
|
+
nextIndex: 0,
|
|
207
|
+
lastSubmitted: 0
|
|
146
208
|
};
|
|
147
209
|
}
|
|
148
210
|
}
|
|
149
211
|
},
|
|
150
212
|
/**
|
|
151
|
-
*
|
|
152
|
-
*
|
|
213
|
+
* Read retained entries in sequence order without changing support-upload cursors.
|
|
214
|
+
* Use on('log:record', listener) for future records. Consumers must leave metadata unchanged.
|
|
215
|
+
* @returns {Array} Records built from the retained entries.
|
|
216
|
+
*/
|
|
217
|
+
getRecords: function getRecords() {
|
|
218
|
+
var sdkBuffer = this.config.separateLogBuffers ? this.sdkBuffer.buffer : this.buffer.buffer;
|
|
219
|
+
var clientBuffer = this.config.separateLogBuffers ? this.clientBuffer.buffer : [];
|
|
220
|
+
var records = [];
|
|
221
|
+
var sdkIndex = 0;
|
|
222
|
+
var clientIndex = 0;
|
|
223
|
+
while (sdkIndex < sdkBuffer.length || clientIndex < clientBuffer.length) {
|
|
224
|
+
var sdkEntry = sdkBuffer[sdkIndex];
|
|
225
|
+
var clientEntry = clientBuffer[clientIndex];
|
|
226
|
+
if (sdkEntry && (!clientEntry || sdkEntry.sequence < clientEntry.sequence)) {
|
|
227
|
+
records.push(_createLogRecord(sdkEntry));
|
|
228
|
+
sdkIndex += 1;
|
|
229
|
+
} else {
|
|
230
|
+
records.push(_createLogRecord(clientEntry));
|
|
231
|
+
clientIndex += 1;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return records;
|
|
235
|
+
},
|
|
236
|
+
/**
|
|
237
|
+
* Filter message data and extract configured metadata in one argument pass.
|
|
238
|
+
* @param {Array<mixed>} args Message arguments.
|
|
153
239
|
* @private
|
|
154
|
-
* @
|
|
155
|
-
* @returns {Array<mixed>}
|
|
240
|
+
* @returns {Object} Filtered arguments and metadata for this call.
|
|
156
241
|
*/
|
|
157
|
-
|
|
242
|
+
_filterLogArguments: function _filterLogArguments() {
|
|
243
|
+
var metadataField = this.config.metadataField;
|
|
244
|
+
var filteredArguments = [];
|
|
245
|
+
var metadata;
|
|
158
246
|
for (var _len = arguments.length, args = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
|
|
159
247
|
args[_key2] = arguments[_key2];
|
|
160
248
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
249
|
+
args.forEach(function (argument) {
|
|
250
|
+
var arg = argument;
|
|
251
|
+
|
|
252
|
+
// WebexHttpError already excludes auth tokens. Keep the existing Error handling.
|
|
164
253
|
if (arg instanceof Error) {
|
|
165
|
-
// karma logs won't print subclassed errors correctly, so we need
|
|
166
|
-
// explicitly call their tostring methods.
|
|
167
254
|
if (process.env.NODE_ENV === 'test' && _common.inBrowser) {
|
|
168
255
|
var ret = arg.toString();
|
|
169
256
|
ret += 'BEGIN STACK';
|
|
170
257
|
ret += arg.stack;
|
|
171
258
|
ret += 'END STACK';
|
|
172
|
-
|
|
259
|
+
filteredArguments.push(ret);
|
|
260
|
+
} else {
|
|
261
|
+
filteredArguments.push(arg);
|
|
173
262
|
}
|
|
174
|
-
return
|
|
263
|
+
return;
|
|
175
264
|
}
|
|
176
|
-
arg
|
|
177
|
-
|
|
265
|
+
if (metadataField && arg !== null && (0, _typeof2.default)(arg) === 'object' && !(0, _isArray.default)(arg) && Object.prototype.hasOwnProperty.call(arg, metadataField)) {
|
|
266
|
+
// Callers supply safe metadata; text redaction does not sanitize it.
|
|
267
|
+
// Copy and redact only the remaining message fields.
|
|
268
|
+
var _arg = arg,
|
|
269
|
+
recordMetadata = _arg[metadataField],
|
|
270
|
+
messageFields = (0, _objectWithoutProperties2.default)(_arg, [metadataField].map(_toPropertyKey));
|
|
271
|
+
metadata = recordMetadata;
|
|
272
|
+
if ((0, _keys.default)(messageFields).length === 0) {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
arg = messageFields;
|
|
276
|
+
}
|
|
277
|
+
filteredArguments.push(walkAndFilter((0, _lodash.cloneDeep)(arg)));
|
|
178
278
|
});
|
|
279
|
+
return {
|
|
280
|
+
filteredArguments: filteredArguments,
|
|
281
|
+
metadata: metadata
|
|
282
|
+
};
|
|
283
|
+
},
|
|
284
|
+
/**
|
|
285
|
+
* Ensures auth headers don't get printed in logs
|
|
286
|
+
* @param {Array<mixed>} args
|
|
287
|
+
* @private
|
|
288
|
+
* @memberof Logger
|
|
289
|
+
* @returns {Array<mixed>}
|
|
290
|
+
*/
|
|
291
|
+
filter: function filter() {
|
|
292
|
+
return this._filterLogArguments.apply(this, arguments).filteredArguments;
|
|
179
293
|
},
|
|
180
294
|
/**
|
|
181
295
|
* Determines if the current level allows logs at the specified level to be
|
|
@@ -309,7 +423,33 @@ var Logger = _webexCore.WebexPlugin.extend({
|
|
|
309
423
|
}
|
|
310
424
|
return buffer.join('\n');
|
|
311
425
|
},
|
|
312
|
-
|
|
426
|
+
/**
|
|
427
|
+
* Update the last submitted index in the buffers to the current nextIndex
|
|
428
|
+
*
|
|
429
|
+
* @returns {void}
|
|
430
|
+
*/
|
|
431
|
+
updateLastSubmittedIndex: function updateLastSubmittedIndex() {
|
|
432
|
+
if (this.config.separateLogBuffers) {
|
|
433
|
+
this.clientBuffer.lastSubmitted = this.clientBuffer.nextIndex;
|
|
434
|
+
this.sdkBuffer.lastSubmitted = this.sdkBuffer.nextIndex;
|
|
435
|
+
} else {
|
|
436
|
+
this.buffer.lastSubmitted = this.buffer.nextIndex;
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
/**
|
|
440
|
+
* Reset the nextIndex in the buffers to the last successful upload index, effectively including any logs since the last successful upload in the next upload
|
|
441
|
+
*
|
|
442
|
+
* @returns {void}
|
|
443
|
+
*/
|
|
444
|
+
resetBufferToLastSuccessfulUpload: function resetBufferToLastSuccessfulUpload() {
|
|
445
|
+
if (this.config.separateLogBuffers) {
|
|
446
|
+
this.clientBuffer.nextIndex = this.clientBuffer.lastSubmitted;
|
|
447
|
+
this.sdkBuffer.nextIndex = this.sdkBuffer.lastSubmitted;
|
|
448
|
+
} else {
|
|
449
|
+
this.buffer.nextIndex = this.buffer.lastSubmitted;
|
|
450
|
+
}
|
|
451
|
+
},
|
|
452
|
+
version: "3.13.0-next.2"
|
|
313
453
|
});
|
|
314
454
|
|
|
315
455
|
/**
|
|
@@ -319,8 +459,9 @@ var Logger = _webexCore.WebexPlugin.extend({
|
|
|
319
459
|
* @param {string} level level to create (info, error, warn, etc.)
|
|
320
460
|
* @param {string} impl the level to use when writing to console
|
|
321
461
|
* @param {string} type type of log, SDK or client
|
|
322
|
-
* @param {
|
|
323
|
-
* @param {
|
|
462
|
+
* @param {Object} options - Internal formatting/buffering options.
|
|
463
|
+
* @param {boolean} [options.neverPrint=false] - Never print to the console.
|
|
464
|
+
* @param {boolean} [options.alwaysBuffer=false] - Retain regardless of the configured level.
|
|
324
465
|
* @instance
|
|
325
466
|
* @memberof Logger
|
|
326
467
|
* @private
|
|
@@ -328,8 +469,11 @@ var Logger = _webexCore.WebexPlugin.extend({
|
|
|
328
469
|
* @returns {function} logger method with specified params
|
|
329
470
|
*/
|
|
330
471
|
function makeLoggerMethod(level, impl, type) {
|
|
331
|
-
var
|
|
332
|
-
|
|
472
|
+
var _ref = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
|
|
473
|
+
_ref$neverPrint = _ref.neverPrint,
|
|
474
|
+
neverPrint = _ref$neverPrint === void 0 ? false : _ref$neverPrint,
|
|
475
|
+
_ref$alwaysBuffer = _ref.alwaysBuffer,
|
|
476
|
+
alwaysBuffer = _ref$alwaysBuffer === void 0 ? false : _ref$alwaysBuffer;
|
|
333
477
|
// Much of the complexity in the following function is due to a test-mode-only
|
|
334
478
|
// helper
|
|
335
479
|
return function wrappedConsoleMethod() {
|
|
@@ -353,8 +497,11 @@ function makeLoggerMethod(level, impl, type) {
|
|
|
353
497
|
if (!shouldBuffer && !shouldPrint) {
|
|
354
498
|
return;
|
|
355
499
|
}
|
|
356
|
-
var
|
|
357
|
-
|
|
500
|
+
var _this$_filterLogArgum = this._filterLogArguments.apply(this, arguments),
|
|
501
|
+
filteredArguments = _this$_filterLogArgum.filteredArguments,
|
|
502
|
+
metadata = _this$_filterLogArgum.metadata;
|
|
503
|
+
var filtered = [clientName].concat((0, _toConsumableArray2.default)(filteredArguments));
|
|
504
|
+
var formatted = filtered.map(function (item) {
|
|
358
505
|
if (item instanceof Error) {
|
|
359
506
|
return item.toString();
|
|
360
507
|
}
|
|
@@ -382,25 +529,39 @@ function makeLoggerMethod(level, impl, type) {
|
|
|
382
529
|
return item;
|
|
383
530
|
});
|
|
384
531
|
if (shouldPrint) {
|
|
385
|
-
var
|
|
386
|
-
//
|
|
387
|
-
|
|
388
|
-
// necessarily show the state at log time, thus we print the stringified
|
|
389
|
-
// value.
|
|
390
|
-
var toPrint = _common.inBrowser ? stringified : filtered;
|
|
532
|
+
var _this$config$consoleM;
|
|
533
|
+
// Print formatted browser values so later object changes do not change the displayed log.
|
|
534
|
+
var toPrint = _common.inBrowser ? formatted : filtered;
|
|
391
535
|
|
|
392
536
|
/* istanbul ignore if */
|
|
393
537
|
if (process.env.NODE_ENV === 'test' && (0, _lodash.has)(this, 'webex.internal.device.url')) {
|
|
394
538
|
toPrint.unshift(this.webex.internal.device.url.slice(-3));
|
|
395
539
|
}
|
|
396
|
-
//
|
|
397
|
-
(
|
|
540
|
+
// Bypass host capture only when this call will also enter the SDK buffer.
|
|
541
|
+
var consoleMethodName = shouldBuffer && ((_this$config$consoleM = this.config.consoleMethods) === null || _this$config$consoleM === void 0 ? void 0 : _this$config$consoleM[impl]) || impl;
|
|
542
|
+
/* eslint-disable no-console */
|
|
543
|
+
var consoleMethod = typeof console[consoleMethodName] === 'function' ? console[consoleMethodName] : console[impl];
|
|
544
|
+
/* eslint-enable no-console */
|
|
545
|
+
|
|
546
|
+
consoleMethod.apply(console, toPrint);
|
|
398
547
|
}
|
|
399
548
|
if (shouldBuffer) {
|
|
400
549
|
var logDate = new Date();
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
550
|
+
formatted.unshift(logDate.toISOString());
|
|
551
|
+
formatted.unshift('| '.repeat(this.groupLevel));
|
|
552
|
+
this.recordState.lastSequence += 1;
|
|
553
|
+
// Named fields retain record data without changing the support-log array positions.
|
|
554
|
+
formatted.sequence = this.recordState.lastSequence;
|
|
555
|
+
formatted.timestamp = logDate.getTime();
|
|
556
|
+
formatted.level = level;
|
|
557
|
+
formatted.source = (metadata === null || metadata === void 0 ? void 0 : metadata.source) || logType;
|
|
558
|
+
formatted.metadata = metadata;
|
|
559
|
+
if (this.logAttributes) {
|
|
560
|
+
formatted.metadata = _objectSpread(_objectSpread({}, metadata), {}, {
|
|
561
|
+
attributes: _objectSpread(_objectSpread({}, this.logAttributes), metadata === null || metadata === void 0 ? void 0 : metadata.attributes)
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
bufferRef.buffer.push(formatted);
|
|
404
565
|
if (bufferRef.buffer.length > historyLength) {
|
|
405
566
|
// we've gone over the buffer limit, trim it down
|
|
406
567
|
var deleteCount = bufferRef.buffer.length - historyLength;
|
|
@@ -411,9 +572,18 @@ function makeLoggerMethod(level, impl, type) {
|
|
|
411
572
|
if (bufferRef.nextIndex < 0) {
|
|
412
573
|
bufferRef.nextIndex = 0;
|
|
413
574
|
}
|
|
575
|
+
bufferRef.lastSubmitted -= deleteCount;
|
|
576
|
+
if (bufferRef.lastSubmitted < 0) {
|
|
577
|
+
bufferRef.lastSubmitted = 0;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
if (level === 'group') {
|
|
581
|
+
this.groupLevel += 1;
|
|
414
582
|
}
|
|
415
|
-
if (level === '
|
|
416
|
-
|
|
583
|
+
if (level === 'groupEnd' && this.groupLevel > 0) {
|
|
584
|
+
this.groupLevel -= 1;
|
|
585
|
+
}
|
|
586
|
+
this.trigger('log:record', _createLogRecord(formatted));
|
|
417
587
|
}
|
|
418
588
|
} catch (reason) {
|
|
419
589
|
if (!neverPrint) {
|
|
@@ -439,7 +609,13 @@ levels.forEach(function (level) {
|
|
|
439
609
|
Logger.prototype["client_".concat(level)] = makeLoggerMethod(level, impl, LOG_TYPES.CLIENT);
|
|
440
610
|
Logger.prototype[level] = makeLoggerMethod(level, impl, LOG_TYPES.SDK);
|
|
441
611
|
});
|
|
442
|
-
Logger.prototype.client_logToBuffer = makeLoggerMethod(
|
|
443
|
-
|
|
612
|
+
Logger.prototype.client_logToBuffer = makeLoggerMethod('info', 'info', LOG_TYPES.CLIENT, {
|
|
613
|
+
neverPrint: true,
|
|
614
|
+
alwaysBuffer: true
|
|
615
|
+
});
|
|
616
|
+
Logger.prototype.logToBuffer = makeLoggerMethod('info', 'info', LOG_TYPES.SDK, {
|
|
617
|
+
neverPrint: true,
|
|
618
|
+
alwaysBuffer: true
|
|
619
|
+
});
|
|
444
620
|
var _default2 = exports.default = Logger;
|
|
445
621
|
//# sourceMappingURL=logger.js.map
|
package/dist/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_common","require","_webexCore","_lodash","precedence","silent","group","groupEnd","error","warn","log","info","debug","trace","levels","exports","_keys","default","filter","level","fallbacks","LOG_TYPES","SDK","CLIENT","SDK_LOG_TYPE_NAME","authTokenKeyPattern","walkAndFilter","object","visited","arguments","length","undefined","includes","push","isArray","map","o","isObject","isString","patterns","containsEmails","test","replace","containsMTID","_i","_Object$entries","_entries","_Object$entries$_i","_slicedToArray2","key","value","_deleteProperty","Logger","WebexPlugin","extend","namespace","derived","cache","fn","getCurrentLevel","client_level","getCurrentClientLevel","session","buffer","type","nextIndex","groupLevel","sdkBuffer","clientBuffer","_len","args","Array","_key2","arg","Error","process","env","NODE_ENV","inBrowser","ret","toString","stack","cloneDeep","shouldPrint","shouldBuffer","config","bufferLogLevel","WEBEX_LOG_LEVEL","webex","internal","device","features","developer","get","clientLevel","formatLogs","options","getDate","_options$diff","diff","clientIndex","sdkIndex","separateLogBuffers","Date","slice","join","version","makeLoggerMethod","impl","neverPrint","alwaysBuffer","wrappedConsoleMethod","logType","clientName","bufferRef","historyLength","clientHistoryLength","filtered","concat","_toConsumableArray2","apply","stringified","item","_typeof2","returnItem","_stringify","_key","e","_console","toPrint","has","unshift","url","console","logDate","toISOString","repeat","deleteCount","splice","reason","forEach","impls","pop","prototype","client_logToBuffer","logToBuffer","_default2"],"sources":["logger.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {inBrowser, patterns} from '@webex/common';\nimport {WebexPlugin} from '@webex/webex-core';\nimport {cloneDeep, has, isArray, isObject, isString} from 'lodash';\n\nconst precedence = {\n silent: 0,\n group: 1,\n groupEnd: 2,\n error: 3,\n warn: 4,\n log: 5,\n info: 6,\n debug: 7,\n trace: 8,\n};\n\nexport const levels = Object.keys(precedence).filter((level) => level !== 'silent');\n\nconst fallbacks = {\n error: ['log'],\n warn: ['error', 'log'],\n info: ['log'],\n debug: ['info', 'log'],\n trace: ['debug', 'info', 'log'],\n};\n\nconst LOG_TYPES = {\n SDK: 'sdk',\n CLIENT: 'client',\n};\n\nconst SDK_LOG_TYPE_NAME = 'wx-js-sdk';\n\nconst authTokenKeyPattern = /[Aa]uthorization/;\n\n/**\n * Recursively strips \"authorization\" fields from the specified object\n * @param {Object} object\n * @param {Array<mixed>} [visited]\n * @private\n * @returns {Object}\n */\nfunction walkAndFilter(object, visited = []) {\n if (visited.includes(object)) {\n // Prevent circular references\n return object;\n }\n\n visited.push(object);\n\n if (isArray(object)) {\n return object.map((o) => walkAndFilter(o, visited));\n }\n if (!isObject(object)) {\n if (isString(object)) {\n if (patterns.containsEmails.test(object)) {\n return object.replace(patterns.containsEmails, '[REDACTED]');\n }\n if (patterns.containsMTID.test(object)) {\n return object.replace(patterns.containsMTID, '$1[REDACTED]');\n }\n }\n\n return object;\n }\n\n for (const [key, value] of Object.entries(object)) {\n if (authTokenKeyPattern.test(key)) {\n Reflect.deleteProperty(object, key);\n } else {\n object[key] = walkAndFilter(value, visited);\n }\n }\n\n return object;\n}\n\n/**\n * @class\n */\nconst Logger = WebexPlugin.extend({\n namespace: 'Logger',\n\n derived: {\n level: {\n cache: false,\n fn() {\n return this.getCurrentLevel();\n },\n },\n client_level: {\n cache: false,\n fn() {\n return this.getCurrentClientLevel();\n },\n },\n },\n session: {\n // for when configured to use single buffer\n buffer: {\n type: 'object',\n default() {\n return {\n buffer: [],\n nextIndex: 0,\n };\n },\n },\n groupLevel: {\n type: 'number',\n default() {\n return 0;\n },\n },\n // for when configured to use separate buffers\n sdkBuffer: {\n type: 'object',\n default() {\n return {\n buffer: [],\n nextIndex: 0,\n };\n },\n },\n clientBuffer: {\n type: 'object',\n default() {\n return {\n buffer: [],\n nextIndex: 0,\n };\n },\n },\n },\n\n /**\n * Ensures auth headers don't get printed in logs\n * @param {Array<mixed>} args\n * @private\n * @memberof Logger\n * @returns {Array<mixed>}\n */\n filter(...args) {\n return args.map((arg) => {\n // WebexHttpError already ensures auth tokens don't get printed, so, no\n // need to alter it here.\n if (arg instanceof Error) {\n // karma logs won't print subclassed errors correctly, so we need\n // explicitly call their tostring methods.\n if (process.env.NODE_ENV === 'test' && inBrowser) {\n let ret = arg.toString();\n\n ret += 'BEGIN STACK';\n ret += arg.stack;\n ret += 'END STACK';\n\n return ret;\n }\n\n return arg;\n }\n\n arg = cloneDeep(arg);\n\n return walkAndFilter(arg);\n });\n },\n\n /**\n * Determines if the current level allows logs at the specified level to be\n * printed\n * @param {string} level\n * @param {string} type type of log, SDK or client\n * @private\n * @memberof Logger\n * @returns {boolean}\n */\n shouldPrint(level, type = LOG_TYPES.SDK) {\n return (\n precedence[level] <=\n precedence[type === LOG_TYPES.SDK ? this.getCurrentLevel() : this.getCurrentClientLevel()]\n );\n },\n\n /**\n * Determines if the current level allows logs at the specified level to be\n * put into the log buffer. We're configuring it omit trace and debug logs\n * because there are *a lot* of debug logs that really don't provide value at\n * runtime (they're helpful for debugging locally, but really just pollute the\n * uploaded logs and push useful info out).\n * @param {string} level\n * @param {string} type type of log, SDK or client\n * @private\n * @memberof Logger\n * @returns {boolean}\n */\n shouldBuffer(level) {\n return (\n precedence[level] <=\n (this.config.bufferLogLevel ? precedence[this.config.bufferLogLevel] : precedence.info)\n );\n },\n\n /**\n * Indicates the current SDK log level based on env vars, feature toggles, and\n * user type.\n * @instance\n * @memberof Logger\n * @private\n * @memberof Logger\n * @returns {string}\n */\n // eslint-disable-next-line complexity\n getCurrentLevel() {\n // If a level has been explicitly set via config, alway use it.\n if (this.config.level) {\n return this.config.level;\n }\n\n if (levels.includes(process.env.WEBEX_LOG_LEVEL)) {\n return process.env.WEBEX_LOG_LEVEL;\n }\n\n // Always use debug-level logging in test mode;\n if (process.env.NODE_ENV === 'test') {\n return 'trace';\n }\n\n // Use server-side-feature toggles to configure log levels\n const level =\n this.webex.internal.device && this.webex.internal.device.features.developer.get('log-level');\n\n if (level) {\n if (levels.includes(level)) {\n return level;\n }\n }\n\n return 'error';\n },\n\n /**\n * Indicates the current client log level based on config, defaults to SDK level\n * @instance\n * @memberof Logger\n * @private\n * @memberof Logger\n * @returns {string}\n */\n getCurrentClientLevel() {\n // If a client log level has been explicitly set via config, alway use it.\n if (this.config.clientLevel) {\n return this.config.clientLevel;\n }\n\n // otherwise default to SDK level\n return this.getCurrentLevel();\n },\n\n /**\n * Format logs (for upload)\n *\n * If separate client, SDK buffers is configured, merge the buffers, if configured\n *\n * @instance\n * @memberof Logger\n * @public\n * @memberof Logger\n * @param {Object} options\n * @param {boolean} options.diff whether to only format the diff from last call to formatLogs(), false by default\n * @returns {string} formatted buffer\n */\n formatLogs(options = {}) {\n function getDate(log) {\n return log[1];\n }\n const {diff = false} = options;\n let buffer = [];\n let clientIndex = diff ? this.clientBuffer.nextIndex : 0;\n let sdkIndex = diff ? this.sdkBuffer.nextIndex : 0;\n\n if (this.config.separateLogBuffers) {\n // merge the client and sdk buffers\n // while we have entries in either buffer\n while (\n clientIndex < this.clientBuffer.buffer.length ||\n sdkIndex < this.sdkBuffer.buffer.length\n ) {\n // if we have remaining entries in the SDK buffer\n if (\n sdkIndex < this.sdkBuffer.buffer.length &&\n // and we haven't exhausted all the client buffer entries, or SDK date is before client date\n (clientIndex >= this.clientBuffer.buffer.length ||\n new Date(getDate(this.sdkBuffer.buffer[sdkIndex])) <=\n new Date(getDate(this.clientBuffer.buffer[clientIndex])))\n ) {\n // then add to the SDK buffer\n buffer.push(this.sdkBuffer.buffer[sdkIndex]);\n sdkIndex += 1;\n }\n // otherwise if we haven't exhausted all the client buffer entries, add client entry, whether it was because\n // it was the only remaining entries or date was later (the above if)\n else if (clientIndex < this.clientBuffer.buffer.length) {\n buffer.push(this.clientBuffer.buffer[clientIndex]);\n clientIndex += 1;\n }\n }\n if (diff) {\n this.clientBuffer.nextIndex = clientIndex;\n this.sdkBuffer.nextIndex = sdkIndex;\n }\n } else if (diff) {\n buffer = this.buffer.buffer.slice(this.buffer.nextIndex);\n this.buffer.nextIndex = this.buffer.buffer.length;\n } else {\n buffer = this.buffer.buffer;\n }\n\n return buffer.join('\\n');\n },\n});\n\n/**\n * Creates a logger method\n *\n *\n * @param {string} level level to create (info, error, warn, etc.)\n * @param {string} impl the level to use when writing to console\n * @param {string} type type of log, SDK or client\n * @param {bool} neverPrint function never prints to console\n * @param {bool} alwaysBuffer function always logs to log buffer\n * @instance\n * @memberof Logger\n * @private\n * @memberof Logger\n * @returns {function} logger method with specified params\n */\nfunction makeLoggerMethod(level, impl, type, neverPrint = false, alwaysBuffer = false) {\n // Much of the complexity in the following function is due to a test-mode-only\n // helper\n return function wrappedConsoleMethod(...args) {\n // it would be easier to just pass in the name and buffer here, but the config isn't completely initialized\n // in Ampersand, even if the initialize method is used to set this up. so we keep the type to achieve\n // a sort of late binding to allow retrieving a name from config.\n const logType = type;\n const clientName =\n logType === LOG_TYPES.SDK ? SDK_LOG_TYPE_NAME : this.config.clientName || logType;\n\n let bufferRef;\n let historyLength;\n\n if (this.config.separateLogBuffers) {\n historyLength = this.config.clientHistoryLength\n ? this.config.clientHistoryLength\n : this.config.historyLength;\n bufferRef = logType === LOG_TYPES.SDK ? this.sdkBuffer : this.clientBuffer;\n } else {\n bufferRef = this.buffer;\n historyLength = this.config.historyLength;\n }\n\n try {\n const shouldPrint = !neverPrint && this.shouldPrint(level, logType);\n const shouldBuffer = alwaysBuffer || this.shouldBuffer(level);\n\n if (!shouldBuffer && !shouldPrint) {\n return;\n }\n\n const filtered = [clientName, ...this.filter(...args)];\n const stringified = filtered.map((item) => {\n if (item instanceof Error) {\n return item.toString();\n }\n if (typeof item === 'object') {\n let cache = [];\n let returnItem;\n try {\n returnItem = JSON.stringify(item, (_key, value) => {\n if (typeof value === 'object' && value !== null) {\n if (cache.includes(value)) {\n // Circular reference found, discard key\n return undefined;\n }\n // Store value in our collection\n cache.push(value);\n }\n\n return value;\n });\n } catch (e) {\n returnItem = `Failed to stringify: ${item}`;\n }\n cache = null;\n\n return returnItem;\n }\n\n return item;\n });\n\n if (shouldPrint) {\n // when logging an object in browsers, we tend to get a dynamic\n // reference, thus going back to look at the logged value doesn't\n // necessarily show the state at log time, thus we print the stringified\n // value.\n const toPrint = inBrowser ? stringified : filtered;\n\n /* istanbul ignore if */\n if (process.env.NODE_ENV === 'test' && has(this, 'webex.internal.device.url')) {\n toPrint.unshift(this.webex.internal.device.url.slice(-3));\n }\n // eslint-disable-next-line no-console\n console[impl](...toPrint);\n }\n\n if (shouldBuffer) {\n const logDate = new Date();\n\n stringified.unshift(logDate.toISOString());\n stringified.unshift('| '.repeat(this.groupLevel));\n bufferRef.buffer.push(stringified);\n if (bufferRef.buffer.length > historyLength) {\n // we've gone over the buffer limit, trim it down\n const deleteCount = bufferRef.buffer.length - historyLength;\n\n bufferRef.buffer.splice(0, deleteCount);\n\n // and adjust the corresponding buffer index used for log diff uploads\n bufferRef.nextIndex -= deleteCount;\n if (bufferRef.nextIndex < 0) {\n bufferRef.nextIndex = 0;\n }\n }\n if (level === 'group') this.groupLevel += 1;\n if (level === 'groupEnd' && this.groupLevel > 0) this.groupLevel -= 1;\n }\n } catch (reason) {\n if (!neverPrint) {\n /* istanbul ignore next */\n // eslint-disable-next-line no-console\n console.warn(`failed to execute Logger#${level}`, reason);\n }\n }\n };\n}\n\nlevels.forEach((level) => {\n let impls = fallbacks[level];\n let impl = level;\n\n if (impls) {\n impls = impls.slice();\n // eslint-disable-next-line no-console\n while (!console[impl]) {\n impl = impls.pop();\n }\n }\n\n // eslint-disable-next-line complexity\n Logger.prototype[`client_${level}`] = makeLoggerMethod(level, impl, LOG_TYPES.CLIENT);\n Logger.prototype[level] = makeLoggerMethod(level, impl, LOG_TYPES.SDK);\n});\n\nLogger.prototype.client_logToBuffer = makeLoggerMethod(\n levels.info,\n levels.info,\n LOG_TYPES.CLIENT,\n true,\n true\n);\nLogger.prototype.logToBuffer = makeLoggerMethod(\n levels.info,\n levels.info,\n LOG_TYPES.SDK,\n true,\n true\n);\n\nexport default Logger;\n"],"mappings":";;;;;;;;;;;;;;;AAIA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AANA;AACA;AACA;;AAMA,IAAMG,UAAU,GAAG;EACjBC,MAAM,EAAE,CAAC;EACTC,KAAK,EAAE,CAAC;EACRC,QAAQ,EAAE,CAAC;EACXC,KAAK,EAAE,CAAC;EACRC,IAAI,EAAE,CAAC;EACPC,GAAG,EAAE,CAAC;EACNC,IAAI,EAAE,CAAC;EACPC,KAAK,EAAE,CAAC;EACRC,KAAK,EAAE;AACT,CAAC;AAEM,IAAMC,MAAM,GAAAC,OAAA,CAAAD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ACXG,MAAM,CAACH,IAAI,EACXU,SAAS,CAACC,GAAG,EACb,IAAI,EACJ,IACF,CAAC;AAAC,IAAA4H,SAAA,GAAAnI,OAAA,CAAAE,OAAA,GAEamC,MAAM","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_common","require","_webexCore","_lodash","ownKeys","e","r","t","_Object$keys2","_Object$getOwnPropertySymbols","o","filter","_Object$getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","Object","forEach","_defineProperty2","default","_Object$getOwnPropertyDescriptors","_Object$defineProperties","_Object$defineProperty","_toPropertyKey","i","_toPrimitive","_typeof3","_Symbol$toPrimitive","call","TypeError","String","Number","precedence","silent","group","groupEnd","error","warn","log","info","debug","trace","levels","exports","_keys","level","fallbacks","LOG_TYPES","SDK","CLIENT","SDK_LOG_TYPE_NAME","authTokenKeyPattern","walkAndFilter","object","visited","undefined","includes","isArray","map","isObject","isString","patterns","containsEmails","test","replace","containsMTID","_i","_Object$entries","_entries","_Object$entries$_i","_slicedToArray2","key","value","_deleteProperty","_createLogRecord","entry","record","sequence","timestamp","source","body","join","metadata","eventName","attributes","Logger","WebexPlugin","extend","namespace","derived","cache","fn","getCurrentLevel","client_level","getCurrentClientLevel","session","logAttributes","type","recordState","lastSequence","buffer","nextIndex","lastSubmitted","groupLevel","sdkBuffer","clientBuffer","getRecords","config","separateLogBuffers","records","sdkIndex","clientIndex","sdkEntry","clientEntry","_filterLogArguments","metadataField","filteredArguments","_len","args","Array","_key2","argument","arg","Error","process","env","NODE_ENV","inBrowser","ret","toString","stack","_typeof2","_isArray","prototype","hasOwnProperty","_arg","recordMetadata","messageFields","_objectWithoutProperties2","cloneDeep","shouldPrint","shouldBuffer","bufferLogLevel","WEBEX_LOG_LEVEL","webex","internal","device","features","developer","get","clientLevel","formatLogs","options","getDate","_options$diff","diff","Date","slice","updateLastSubmittedIndex","resetBufferToLastSuccessfulUpload","version","makeLoggerMethod","impl","_ref","_ref$neverPrint","neverPrint","_ref$alwaysBuffer","alwaysBuffer","wrappedConsoleMethod","logType","clientName","bufferRef","historyLength","clientHistoryLength","_this$_filterLogArgum","filtered","concat","_toConsumableArray2","formatted","item","returnItem","_stringify","_key","_this$config$consoleM","toPrint","has","unshift","url","consoleMethodName","consoleMethods","consoleMethod","console","logDate","toISOString","repeat","getTime","deleteCount","splice","trigger","reason","impls","pop","client_logToBuffer","logToBuffer","_default2"],"sources":["logger.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/**\n * plugin-logger emits 'log:record' synchronously after it retains an entry.\n * Use webex.logger.on('log:record', listener) to receive future records.\n * Use webex.logger.off('log:record', listener) to remove the same listener.\n * Listeners must not throw or log back into this logger synchronously.\n * Nested logging can deliver newer records first to later listeners.\n * A thrown error can stop delivery to later listeners.\n */\nimport {inBrowser, patterns} from '@webex/common';\nimport {WebexPlugin} from '@webex/webex-core';\nimport {cloneDeep, has, isArray, isObject, isString} from 'lodash';\n\nconst precedence = {\n silent: 0,\n group: 1,\n groupEnd: 2,\n error: 3,\n warn: 4,\n log: 5,\n info: 6,\n debug: 7,\n trace: 8,\n};\n\nexport const levels = Object.keys(precedence).filter((level) => level !== 'silent');\n\nconst fallbacks = {\n error: ['log'],\n warn: ['error', 'log'],\n info: ['log'],\n debug: ['info', 'log'],\n trace: ['debug', 'info', 'log'],\n};\n\nconst LOG_TYPES = {\n SDK: 'sdk',\n CLIENT: 'client',\n};\n\nconst SDK_LOG_TYPE_NAME = 'wx-js-sdk';\nconst authTokenKeyPattern = /[Aa]uthorization/;\n\n/**\n * Recursively strips \"authorization\" fields from the specified object\n * @param {Object} object\n * @param {Array<mixed>} [visited]\n * @private\n * @returns {Object}\n */\nfunction walkAndFilter(object, visited = []) {\n if (visited.includes(object)) {\n // Prevent circular references\n return object;\n }\n\n visited.push(object);\n\n if (isArray(object)) {\n return object.map((o) => walkAndFilter(o, visited));\n }\n if (!isObject(object)) {\n if (isString(object)) {\n if (patterns.containsEmails.test(object)) {\n return object.replace(patterns.containsEmails, '[REDACTED]');\n }\n if (patterns.containsMTID.test(object)) {\n return object.replace(patterns.containsMTID, '$1[REDACTED]');\n }\n }\n\n return object;\n }\n\n for (const [key, value] of Object.entries(object)) {\n if (authTokenKeyPattern.test(key)) {\n Reflect.deleteProperty(object, key);\n } else {\n object[key] = walkAndFilter(value, visited);\n }\n }\n\n return object;\n}\n\n/**\n * Build a record from one retained entry. Live events and history use this function.\n * @param {Array<mixed>} entry Formatted text with capture fields stored as named properties.\n * @returns {Object} A record that shares the caller-owned metadata values.\n */\nfunction _createLogRecord(entry) {\n const record = {\n sequence: entry.sequence,\n timestamp: entry.timestamp,\n level: entry.level,\n source: entry.source,\n body: entry.join(','),\n };\n\n if (entry.metadata) {\n record.eventName = entry.metadata.eventName;\n record.attributes = entry.metadata.attributes;\n }\n\n return record;\n}\n\n/**\n * @class\n */\nconst Logger = WebexPlugin.extend({\n namespace: 'Logger',\n\n derived: {\n level: {\n cache: false,\n fn() {\n return this.getCurrentLevel();\n },\n },\n client_level: {\n cache: false,\n fn() {\n return this.getCurrentClientLevel();\n },\n },\n },\n session: {\n // Shared attributes for this instance. Each retained record copies their current values.\n logAttributes: {type: 'object'},\n // Keep the counter inside an object so increments do not emit Ampersand change events.\n recordState: {\n type: 'object',\n /**\n * Create empty state for this logger instance.\n * @returns {Object} The shared SDK and client sequence counter.\n */\n default() {\n return {\n // Last sequence assigned. Buffer trimming does not reset it.\n lastSequence: 0,\n };\n },\n },\n // Retained history and support-upload cursors when SDK and client logs share one buffer.\n buffer: {\n type: 'object',\n default() {\n return {\n buffer: [],\n nextIndex: 0,\n lastSubmitted: 0,\n };\n },\n },\n // Current indentation depth for buffered groups.\n groupLevel: {\n type: 'number',\n default() {\n return 0;\n },\n },\n // SDK history and support-upload cursors. Used only when separateLogBuffers is true.\n sdkBuffer: {\n type: 'object',\n default() {\n return {\n buffer: [],\n nextIndex: 0,\n lastSubmitted: 0,\n };\n },\n },\n // Client history and support-upload cursors. Used only when separateLogBuffers is true.\n clientBuffer: {\n type: 'object',\n default() {\n return {\n buffer: [],\n nextIndex: 0,\n lastSubmitted: 0,\n };\n },\n },\n },\n\n /**\n * Read retained entries in sequence order without changing support-upload cursors.\n * Use on('log:record', listener) for future records. Consumers must leave metadata unchanged.\n * @returns {Array} Records built from the retained entries.\n */\n getRecords() {\n const sdkBuffer = this.config.separateLogBuffers ? this.sdkBuffer.buffer : this.buffer.buffer;\n const clientBuffer = this.config.separateLogBuffers ? this.clientBuffer.buffer : [];\n const records = [];\n let sdkIndex = 0;\n let clientIndex = 0;\n\n while (sdkIndex < sdkBuffer.length || clientIndex < clientBuffer.length) {\n const sdkEntry = sdkBuffer[sdkIndex];\n const clientEntry = clientBuffer[clientIndex];\n\n if (sdkEntry && (!clientEntry || sdkEntry.sequence < clientEntry.sequence)) {\n records.push(_createLogRecord(sdkEntry));\n sdkIndex += 1;\n } else {\n records.push(_createLogRecord(clientEntry));\n clientIndex += 1;\n }\n }\n\n return records;\n },\n\n /**\n * Filter message data and extract configured metadata in one argument pass.\n * @param {Array<mixed>} args Message arguments.\n * @private\n * @returns {Object} Filtered arguments and metadata for this call.\n */\n _filterLogArguments(...args) {\n const {metadataField} = this.config;\n const filteredArguments = [];\n let metadata;\n\n args.forEach((argument) => {\n let arg = argument;\n\n // WebexHttpError already excludes auth tokens. Keep the existing Error handling.\n if (arg instanceof Error) {\n if (process.env.NODE_ENV === 'test' && inBrowser) {\n let ret = arg.toString();\n\n ret += 'BEGIN STACK';\n ret += arg.stack;\n ret += 'END STACK';\n filteredArguments.push(ret);\n } else {\n filteredArguments.push(arg);\n }\n\n return;\n }\n\n if (\n metadataField &&\n arg !== null &&\n typeof arg === 'object' &&\n !Array.isArray(arg) &&\n Object.prototype.hasOwnProperty.call(arg, metadataField)\n ) {\n // Callers supply safe metadata; text redaction does not sanitize it.\n // Copy and redact only the remaining message fields.\n const {[metadataField]: recordMetadata, ...messageFields} = arg;\n\n metadata = recordMetadata;\n if (Object.keys(messageFields).length === 0) {\n return;\n }\n arg = messageFields;\n }\n\n filteredArguments.push(walkAndFilter(cloneDeep(arg)));\n });\n\n return {filteredArguments, metadata};\n },\n\n /**\n * Ensures auth headers don't get printed in logs\n * @param {Array<mixed>} args\n * @private\n * @memberof Logger\n * @returns {Array<mixed>}\n */\n filter(...args) {\n return this._filterLogArguments(...args).filteredArguments;\n },\n\n /**\n * Determines if the current level allows logs at the specified level to be\n * printed\n * @param {string} level\n * @param {string} type type of log, SDK or client\n * @private\n * @memberof Logger\n * @returns {boolean}\n */\n shouldPrint(level, type = LOG_TYPES.SDK) {\n return (\n precedence[level] <=\n precedence[type === LOG_TYPES.SDK ? this.getCurrentLevel() : this.getCurrentClientLevel()]\n );\n },\n\n /**\n * Determines if the current level allows logs at the specified level to be\n * put into the log buffer. We're configuring it omit trace and debug logs\n * because there are *a lot* of debug logs that really don't provide value at\n * runtime (they're helpful for debugging locally, but really just pollute the\n * uploaded logs and push useful info out).\n * @param {string} level\n * @param {string} type type of log, SDK or client\n * @private\n * @memberof Logger\n * @returns {boolean}\n */\n shouldBuffer(level) {\n return (\n precedence[level] <=\n (this.config.bufferLogLevel ? precedence[this.config.bufferLogLevel] : precedence.info)\n );\n },\n\n /**\n * Indicates the current SDK log level based on env vars, feature toggles, and\n * user type.\n * @instance\n * @memberof Logger\n * @private\n * @memberof Logger\n * @returns {string}\n */\n // eslint-disable-next-line complexity\n getCurrentLevel() {\n // If a level has been explicitly set via config, alway use it.\n if (this.config.level) {\n return this.config.level;\n }\n\n if (levels.includes(process.env.WEBEX_LOG_LEVEL)) {\n return process.env.WEBEX_LOG_LEVEL;\n }\n\n // Always use debug-level logging in test mode;\n if (process.env.NODE_ENV === 'test') {\n return 'trace';\n }\n\n // Use server-side-feature toggles to configure log levels\n const level =\n this.webex.internal.device && this.webex.internal.device.features.developer.get('log-level');\n\n if (level) {\n if (levels.includes(level)) {\n return level;\n }\n }\n\n return 'error';\n },\n\n /**\n * Indicates the current client log level based on config, defaults to SDK level\n * @instance\n * @memberof Logger\n * @private\n * @memberof Logger\n * @returns {string}\n */\n getCurrentClientLevel() {\n // If a client log level has been explicitly set via config, alway use it.\n if (this.config.clientLevel) {\n return this.config.clientLevel;\n }\n\n // otherwise default to SDK level\n return this.getCurrentLevel();\n },\n\n /**\n * Format logs (for upload)\n *\n * If separate client, SDK buffers is configured, merge the buffers, if configured\n *\n * @instance\n * @memberof Logger\n * @public\n * @memberof Logger\n * @param {Object} options\n * @param {boolean} options.diff whether to only format the diff from last call to formatLogs(), false by default\n * @returns {string} formatted buffer\n */\n formatLogs(options = {}) {\n function getDate(log) {\n return log[1];\n }\n const {diff = false} = options;\n let buffer = [];\n let clientIndex = diff ? this.clientBuffer.nextIndex : 0;\n let sdkIndex = diff ? this.sdkBuffer.nextIndex : 0;\n\n if (this.config.separateLogBuffers) {\n // merge the client and sdk buffers\n // while we have entries in either buffer\n while (\n clientIndex < this.clientBuffer.buffer.length ||\n sdkIndex < this.sdkBuffer.buffer.length\n ) {\n // if we have remaining entries in the SDK buffer\n if (\n sdkIndex < this.sdkBuffer.buffer.length &&\n // and we haven't exhausted all the client buffer entries, or SDK date is before client date\n (clientIndex >= this.clientBuffer.buffer.length ||\n new Date(getDate(this.sdkBuffer.buffer[sdkIndex])) <=\n new Date(getDate(this.clientBuffer.buffer[clientIndex])))\n ) {\n // then add to the SDK buffer\n buffer.push(this.sdkBuffer.buffer[sdkIndex]);\n sdkIndex += 1;\n }\n // otherwise if we haven't exhausted all the client buffer entries, add client entry, whether it was because\n // it was the only remaining entries or date was later (the above if)\n else if (clientIndex < this.clientBuffer.buffer.length) {\n buffer.push(this.clientBuffer.buffer[clientIndex]);\n clientIndex += 1;\n }\n }\n if (diff) {\n this.clientBuffer.nextIndex = clientIndex;\n this.sdkBuffer.nextIndex = sdkIndex;\n }\n } else if (diff) {\n buffer = this.buffer.buffer.slice(this.buffer.nextIndex);\n this.buffer.nextIndex = this.buffer.buffer.length;\n } else {\n buffer = this.buffer.buffer;\n }\n\n return buffer.join('\\n');\n },\n\n /**\n * Update the last submitted index in the buffers to the current nextIndex\n *\n * @returns {void}\n */\n updateLastSubmittedIndex() {\n if (this.config.separateLogBuffers) {\n this.clientBuffer.lastSubmitted = this.clientBuffer.nextIndex;\n this.sdkBuffer.lastSubmitted = this.sdkBuffer.nextIndex;\n } else {\n this.buffer.lastSubmitted = this.buffer.nextIndex;\n }\n },\n\n /**\n * Reset the nextIndex in the buffers to the last successful upload index, effectively including any logs since the last successful upload in the next upload\n *\n * @returns {void}\n */\n resetBufferToLastSuccessfulUpload() {\n if (this.config.separateLogBuffers) {\n this.clientBuffer.nextIndex = this.clientBuffer.lastSubmitted;\n this.sdkBuffer.nextIndex = this.sdkBuffer.lastSubmitted;\n } else {\n this.buffer.nextIndex = this.buffer.lastSubmitted;\n }\n },\n});\n\n/**\n * Creates a logger method\n *\n *\n * @param {string} level level to create (info, error, warn, etc.)\n * @param {string} impl the level to use when writing to console\n * @param {string} type type of log, SDK or client\n * @param {Object} options - Internal formatting/buffering options.\n * @param {boolean} [options.neverPrint=false] - Never print to the console.\n * @param {boolean} [options.alwaysBuffer=false] - Retain regardless of the configured level.\n * @instance\n * @memberof Logger\n * @private\n * @memberof Logger\n * @returns {function} logger method with specified params\n */\nfunction makeLoggerMethod(level, impl, type, {neverPrint = false, alwaysBuffer = false} = {}) {\n // Much of the complexity in the following function is due to a test-mode-only\n // helper\n return function wrappedConsoleMethod(...args) {\n // it would be easier to just pass in the name and buffer here, but the config isn't completely initialized\n // in Ampersand, even if the initialize method is used to set this up. so we keep the type to achieve\n // a sort of late binding to allow retrieving a name from config.\n const logType = type;\n const clientName =\n logType === LOG_TYPES.SDK ? SDK_LOG_TYPE_NAME : this.config.clientName || logType;\n\n let bufferRef;\n let historyLength;\n\n if (this.config.separateLogBuffers) {\n historyLength = this.config.clientHistoryLength\n ? this.config.clientHistoryLength\n : this.config.historyLength;\n bufferRef = logType === LOG_TYPES.SDK ? this.sdkBuffer : this.clientBuffer;\n } else {\n bufferRef = this.buffer;\n historyLength = this.config.historyLength;\n }\n\n try {\n const shouldPrint = !neverPrint && this.shouldPrint(level, logType);\n const shouldBuffer = alwaysBuffer || this.shouldBuffer(level);\n\n if (!shouldBuffer && !shouldPrint) {\n return;\n }\n\n const {filteredArguments, metadata} = this._filterLogArguments(...args);\n const filtered = [clientName, ...filteredArguments];\n const formatted = filtered.map((item) => {\n if (item instanceof Error) {\n return item.toString();\n }\n if (typeof item === 'object') {\n let cache = [];\n let returnItem;\n try {\n returnItem = JSON.stringify(item, (_key, value) => {\n if (typeof value === 'object' && value !== null) {\n if (cache.includes(value)) {\n // Circular reference found, discard key\n return undefined;\n }\n // Store value in our collection\n cache.push(value);\n }\n\n return value;\n });\n } catch (e) {\n returnItem = `Failed to stringify: ${item}`;\n }\n cache = null;\n\n return returnItem;\n }\n\n return item;\n });\n\n if (shouldPrint) {\n // Print formatted browser values so later object changes do not change the displayed log.\n const toPrint = inBrowser ? formatted : filtered;\n\n /* istanbul ignore if */\n if (process.env.NODE_ENV === 'test' && has(this, 'webex.internal.device.url')) {\n toPrint.unshift(this.webex.internal.device.url.slice(-3));\n }\n // Bypass host capture only when this call will also enter the SDK buffer.\n const consoleMethodName = (shouldBuffer && this.config.consoleMethods?.[impl]) || impl;\n /* eslint-disable no-console */\n const consoleMethod =\n typeof console[consoleMethodName] === 'function'\n ? console[consoleMethodName]\n : console[impl];\n /* eslint-enable no-console */\n\n consoleMethod.apply(console, toPrint);\n }\n\n if (shouldBuffer) {\n const logDate = new Date();\n\n formatted.unshift(logDate.toISOString());\n formatted.unshift('| '.repeat(this.groupLevel));\n this.recordState.lastSequence += 1;\n // Named fields retain record data without changing the support-log array positions.\n formatted.sequence = this.recordState.lastSequence;\n formatted.timestamp = logDate.getTime();\n formatted.level = level;\n formatted.source = metadata?.source || logType;\n formatted.metadata = metadata;\n if (this.logAttributes) {\n formatted.metadata = {\n ...metadata,\n attributes: {...this.logAttributes, ...metadata?.attributes},\n };\n }\n bufferRef.buffer.push(formatted);\n if (bufferRef.buffer.length > historyLength) {\n // we've gone over the buffer limit, trim it down\n const deleteCount = bufferRef.buffer.length - historyLength;\n\n bufferRef.buffer.splice(0, deleteCount);\n\n // and adjust the corresponding buffer index used for log diff uploads\n bufferRef.nextIndex -= deleteCount;\n if (bufferRef.nextIndex < 0) {\n bufferRef.nextIndex = 0;\n }\n\n bufferRef.lastSubmitted -= deleteCount;\n if (bufferRef.lastSubmitted < 0) {\n bufferRef.lastSubmitted = 0;\n }\n }\n if (level === 'group') {\n this.groupLevel += 1;\n }\n if (level === 'groupEnd' && this.groupLevel > 0) {\n this.groupLevel -= 1;\n }\n this.trigger('log:record', _createLogRecord(formatted));\n }\n } catch (reason) {\n if (!neverPrint) {\n /* istanbul ignore next */\n // eslint-disable-next-line no-console\n console.warn(`failed to execute Logger#${level}`, reason);\n }\n }\n };\n}\n\nlevels.forEach((level) => {\n let impls = fallbacks[level];\n let impl = level;\n\n if (impls) {\n impls = impls.slice();\n // eslint-disable-next-line no-console\n while (!console[impl]) {\n impl = impls.pop();\n }\n }\n\n // eslint-disable-next-line complexity\n Logger.prototype[`client_${level}`] = makeLoggerMethod(level, impl, LOG_TYPES.CLIENT);\n Logger.prototype[level] = makeLoggerMethod(level, impl, LOG_TYPES.SDK);\n});\n\nLogger.prototype.client_logToBuffer = makeLoggerMethod('info', 'info', LOG_TYPES.CLIENT, {\n neverPrint: true,\n alwaysBuffer: true,\n});\nLogger.prototype.logToBuffer = makeLoggerMethod('info', 'info', LOG_TYPES.SDK, {\n neverPrint: true,\n alwaysBuffer: true,\n});\n\nexport default Logger;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAYA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAAmE,SAAAG,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,aAAA,CAAAH,CAAA,OAA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AK,EAAEqH,IAAI,EAAEnH,SAAS,CAACE,MAAM,CAAC;EACrFoC,MAAM,CAACgD,SAAS,CAACxF,KAAK,CAAC,GAAGoH,gBAAgB,CAACpH,KAAK,EAAEqH,IAAI,EAAEnH,SAAS,CAACC,GAAG,CAAC;AACxE,CAAC,CAAC;AAEFqC,MAAM,CAACgD,SAAS,CAACqE,kBAAkB,GAAGzC,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAElH,SAAS,CAACE,MAAM,EAAE;EACvFoH,UAAU,EAAE,IAAI;EAChBE,YAAY,EAAE;AAChB,CAAC,CAAC;AACFlF,MAAM,CAACgD,SAAS,CAACsE,WAAW,GAAG1C,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAElH,SAAS,CAACC,GAAG,EAAE;EAC7EqH,UAAU,EAAE,IAAI;EAChBE,YAAY,EAAE;AAChB,CAAC,CAAC;AAAC,IAAAqC,SAAA,GAAAjK,OAAA,CAAAxB,OAAA,GAEYkE,MAAM","ignoreList":[]}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: ADR
|
|
3
|
+
title: ADR-0001 - Retain the product README
|
|
4
|
+
description: Stage 0 keeps README.md as product documentation and does not route it as a spec source.
|
|
5
|
+
tags: [adr]
|
|
6
|
+
timestamp: 2026-10-06T00:00:00Z
|
|
7
|
+
status: accepted
|
|
8
|
+
---
|
|
9
|
+
<!-- sdd-generated-metadata
|
|
10
|
+
doc_kind: standing-doc
|
|
11
|
+
generated_from: adr@0.3.0
|
|
12
|
+
generated_by: claude-cowork
|
|
13
|
+
approved_by: akulakum@cisco.com
|
|
14
|
+
updated_at: 2026-10-08T08:51:39Z
|
|
15
|
+
validation_status: pass-with-warnings
|
|
16
|
+
-->
|
|
17
|
+
|
|
18
|
+
# ADR-0001 - Retain the product README
|
|
19
|
+
|
|
20
|
+
| Field | Value |
|
|
21
|
+
| ------------- | ----- |
|
|
22
|
+
| Status | Accepted |
|
|
23
|
+
| Decision date | 2026-10-06 |
|
|
24
|
+
| Deciders | akulakum@cisco.com (bootstrap questionnaire) |
|
|
25
|
+
| Supersedes | N/A |
|
|
26
|
+
| Superseded by | N/A |
|
|
27
|
+
|
|
28
|
+
## Context
|
|
29
|
+
|
|
30
|
+
Stage 0 found one existing document, `README.md`. It is a product usage page. It lists the levels `silent`, `error`, `warn`, `log`, `info`, `debug`, and `trace`, names `error` as the default, and shows `WEBEX_LOG_LEVEL` as the control.
|
|
31
|
+
|
|
32
|
+
The implementation in `src/logger.js` also exposes `group` and `groupEnd`, `client_` variants of every level, `logToBuffer`, buffers, `formatLogs`, and seven `config.logger` keys. The README does not describe them. `silent` is a precedence value in `src/logger.js` but is not part of the exported `levels` array.
|
|
33
|
+
|
|
34
|
+
No other intent spec, design spec, or AI-authored spec exists in this package.
|
|
35
|
+
|
|
36
|
+
## Decision
|
|
37
|
+
|
|
38
|
+
Keep `README.md` unchanged. Do not migrate it into `src/docs/README.md`. Record `spec_source_policy.mode` as `keep-separate` with `migrated_source_disposition` `retain` and an empty `spec_sources` list.
|
|
39
|
+
|
|
40
|
+
The canonical behavior is `src/` plus `test/unit/spec/logger.js`. Where the product README is incomplete, code wins. That gap is not a defect in the retained product page.
|
|
41
|
+
|
|
42
|
+
## Why
|
|
43
|
+
|
|
44
|
+
The README is the npm-facing usage page. Rewriting it is a product-doc change, not a requirement of making the package SDD-ready. Its statements that are present agree with the code, so routing it as a spec source would add little.
|
|
45
|
+
|
|
46
|
+
## Alternatives considered
|
|
47
|
+
|
|
48
|
+
- Migrate the README into the module spec and delete it. Rejected because the page is a retained product document, and deletion was not requested.
|
|
49
|
+
- Expand the README during Stage 0. Rejected because Stage 0 is documentation for the SDD tree and does not edit `README.md`.
|
|
50
|
+
|
|
51
|
+
## Consequences
|
|
52
|
+
|
|
53
|
+
- Agents must not treat `README.md` as the full list of levels, methods, or config keys.
|
|
54
|
+
- Future README improvements are a separate product-doc change.
|
|
55
|
+
- `src/docs/README.md` is the protected canonical spec.
|
|
56
|
+
|
|
57
|
+
## Constraint on future changes
|
|
58
|
+
|
|
59
|
+
Do not delete `README.md` as part of spec maintenance. If its usage text is extended, keep the change in that file and leave the module spec aligned with code.
|
|
60
|
+
|
|
61
|
+
## Follow-up
|
|
62
|
+
|
|
63
|
+
None required for Stage 0.
|
|
64
|
+
|
|
65
|
+
## Revisit when
|
|
66
|
+
|
|
67
|
+
A maintainer chooses to document client logging, buffers, or upload formatting on the npm usage page.
|
|
68
|
+
|
|
69
|
+
## References
|
|
70
|
+
|
|
71
|
+
- `README.md`
|
|
72
|
+
- `src/index.js`
|
|
73
|
+
- `src/logger.js`
|
|
74
|
+
- `src/config.js`
|
|
75
|
+
- `test/unit/spec/logger.js`
|
|
76
|
+
- `.sdd/manifest.json` `spec_source_policy`
|