@cloudcare/browser-logs 3.0.23 → 3.1.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/bundle/dataflux-logs.js +1 -1
- package/cjs/boot/buildEnv.js +3 -2
- package/cjs/boot/buildEnv.js.map +1 -0
- package/cjs/boot/logsPublicApi.js +22 -50
- package/cjs/boot/logsPublicApi.js.map +1 -0
- package/cjs/boot/startLogs.js +34 -19
- package/cjs/boot/startLogs.js.map +1 -0
- package/cjs/domain/assembly.js +3 -17
- package/cjs/domain/assembly.js.map +1 -0
- package/cjs/domain/configuration.js +2 -12
- package/cjs/domain/configuration.js.map +1 -0
- package/cjs/domain/internalContext.js +2 -3
- package/cjs/domain/internalContext.js.map +1 -0
- package/cjs/domain/logger.js +46 -25
- package/cjs/domain/logger.js.map +1 -0
- package/cjs/domain/logsCollection/console/consoleCollection.js +6 -8
- package/cjs/domain/logsCollection/console/consoleCollection.js.map +1 -0
- package/cjs/domain/logsCollection/logger/loggerCollection.js +6 -12
- package/cjs/domain/logsCollection/logger/loggerCollection.js.map +1 -0
- package/cjs/domain/logsCollection/networkError/networkErrorCollection.js +8 -26
- package/cjs/domain/logsCollection/networkError/networkErrorCollection.js.map +1 -0
- package/cjs/domain/logsCollection/report/reportCollection.js +7 -11
- package/cjs/domain/logsCollection/report/reportCollection.js.map +1 -0
- package/cjs/domain/logsCollection/rumtimeError/runtimeErrorCollection.js +2 -8
- package/cjs/domain/logsCollection/rumtimeError/runtimeErrorCollection.js.map +1 -0
- package/cjs/domain/logsSessionManager.js +2 -9
- package/cjs/domain/logsSessionManager.js.map +1 -0
- package/cjs/entries/main.js +2 -5
- package/cjs/entries/main.js.map +1 -0
- package/cjs/index.js +2 -2
- package/cjs/index.js.map +1 -0
- package/cjs/transport/startLogsBatch.js +2 -3
- package/cjs/transport/startLogsBatch.js.map +1 -0
- package/cjs/transport/startLogsBridge.js +14 -0
- package/cjs/transport/startLogsBridge.js.map +1 -0
- package/esm/boot/buildEnv.js +3 -2
- package/esm/boot/buildEnv.js.map +1 -0
- package/esm/boot/logsPublicApi.js +23 -46
- package/esm/boot/logsPublicApi.js.map +1 -0
- package/esm/boot/startLogs.js +36 -9
- package/esm/boot/startLogs.js.map +1 -0
- package/esm/domain/assembly.js +3 -9
- package/esm/domain/assembly.js.map +1 -0
- package/esm/domain/configuration.js +2 -7
- package/esm/domain/configuration.js.map +1 -0
- package/esm/domain/internalContext.js +2 -2
- package/esm/domain/internalContext.js.map +1 -0
- package/esm/domain/logger.js +47 -22
- package/esm/domain/logger.js.map +1 -0
- package/esm/domain/logsCollection/console/consoleCollection.js +6 -4
- package/esm/domain/logsCollection/console/consoleCollection.js.map +1 -0
- package/esm/domain/logsCollection/logger/loggerCollection.js +6 -7
- package/esm/domain/logsCollection/logger/loggerCollection.js.map +1 -0
- package/esm/domain/logsCollection/networkError/networkErrorCollection.js +9 -21
- package/esm/domain/logsCollection/networkError/networkErrorCollection.js.map +1 -0
- package/esm/domain/logsCollection/report/reportCollection.js +7 -7
- package/esm/domain/logsCollection/report/reportCollection.js.map +1 -0
- package/esm/domain/logsCollection/rumtimeError/runtimeErrorCollection.js +2 -5
- package/esm/domain/logsCollection/rumtimeError/runtimeErrorCollection.js.map +1 -0
- package/esm/domain/logsSessionManager.js +2 -5
- package/esm/domain/logsSessionManager.js.map +1 -0
- package/esm/entries/main.js +2 -1
- package/esm/entries/main.js.map +1 -0
- package/esm/index.js +2 -1
- package/esm/index.js.map +1 -0
- package/esm/transport/startLogsBatch.js +2 -1
- package/esm/transport/startLogsBatch.js.map +1 -0
- package/esm/transport/startLogsBridge.js +8 -0
- package/esm/transport/startLogsBridge.js.map +1 -0
- package/package.json +5 -4
- package/src/boot/logsPublicApi.js +24 -21
- package/src/boot/startLogs.js +68 -10
- package/src/domain/assembly.js +0 -4
- package/src/domain/logger.js +57 -15
- package/src/domain/logsCollection/logger/loggerCollection.js +24 -16
- package/src/domain/logsCollection/networkError/networkErrorCollection.js +6 -5
- package/src/domain/logsCollection/report/reportCollection.js +10 -8
- package/src/transport/startLogsBridge.js +11 -0
package/esm/boot/startLogs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ErrorSource, LifeCycle, LifeCycleEventType, createPageExitObservable, areCookiesAuthorized } from '@cloudcare/browser-core';
|
|
1
|
+
import { ErrorSource, LifeCycle, LifeCycleEventType, createPageExitObservable, areCookiesAuthorized, startTelemetry, startBatchWithReplica, canUseEventBridge, TelemetryService } from '@cloudcare/browser-core';
|
|
2
2
|
import { startLogsSessionManager, startLogsSessionManagerStub } from '../domain/logsSessionManager';
|
|
3
|
-
import { startLogsAssembly } from '../domain/assembly';
|
|
3
|
+
import { startLogsAssembly, getRUMInternalContext } from '../domain/assembly';
|
|
4
4
|
import { startConsoleCollection } from '../domain/logsCollection/console/consoleCollection';
|
|
5
5
|
import { startReportCollection } from '../domain/logsCollection/report/reportCollection';
|
|
6
6
|
import { startNetworkErrorCollection } from '../domain/logsCollection/networkError/networkErrorCollection';
|
|
@@ -11,7 +11,6 @@ import { StatusType } from '../domain/logger';
|
|
|
11
11
|
import { startInternalContext } from '../domain/internalContext';
|
|
12
12
|
export function startLogs(configuration, buildCommonContext, mainLogger) {
|
|
13
13
|
var lifeCycle = new LifeCycle();
|
|
14
|
-
|
|
15
14
|
var reportError = function reportError(error) {
|
|
16
15
|
lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {
|
|
17
16
|
rawLogsEvent: {
|
|
@@ -19,28 +18,56 @@ export function startLogs(configuration, buildCommonContext, mainLogger) {
|
|
|
19
18
|
date: error.startClocks.timeStamp,
|
|
20
19
|
error: {
|
|
21
20
|
origin: ErrorSource.AGENT // Todo: Remove in the next major release
|
|
22
|
-
|
|
23
21
|
},
|
|
22
|
+
|
|
24
23
|
origin: ErrorSource.AGENT,
|
|
25
24
|
status: StatusType.error
|
|
26
25
|
}
|
|
27
26
|
});
|
|
28
27
|
};
|
|
29
|
-
|
|
30
28
|
var pageExitObservable = createPageExitObservable();
|
|
31
29
|
var session = areCookiesAuthorized(configuration.cookieOptions) ? startLogsSessionManager(configuration) : startLogsSessionManagerStub(configuration);
|
|
30
|
+
var telemetry = startLogsTelemetry(configuration, reportError, pageExitObservable, session.expireObservable);
|
|
31
|
+
telemetry.setContextProvider(function () {
|
|
32
|
+
var RUMInternalContext = getRUMInternalContext();
|
|
33
|
+
return {
|
|
34
|
+
application: {
|
|
35
|
+
id: RUMInternalContext && RUMInternalContext.application && RUMInternalContext.application.id
|
|
36
|
+
},
|
|
37
|
+
session: {
|
|
38
|
+
id: session.findTrackedSession() && session.findTrackedSession().id
|
|
39
|
+
},
|
|
40
|
+
view: {
|
|
41
|
+
id: RUMInternalContext && RUMInternalContext.view && RUMInternalContext.view.id
|
|
42
|
+
},
|
|
43
|
+
action: {
|
|
44
|
+
id: RUMInternalContext && RUMInternalContext.userAction && RUMInternalContext.userAction.id
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
});
|
|
32
48
|
startNetworkErrorCollection(configuration, lifeCycle);
|
|
33
49
|
startRuntimeErrorCollection(configuration, lifeCycle);
|
|
34
50
|
startConsoleCollection(configuration, lifeCycle);
|
|
35
51
|
startReportCollection(configuration, lifeCycle);
|
|
36
|
-
|
|
37
52
|
var _startLoggerCollection = startLoggerCollection(lifeCycle);
|
|
38
|
-
|
|
39
53
|
startLogsAssembly(session, configuration, lifeCycle, buildCommonContext, mainLogger, reportError);
|
|
40
|
-
|
|
54
|
+
if (!canUseEventBridge()) {
|
|
55
|
+
startLogsBatch(configuration, lifeCycle, reportError, pageExitObservable, session.expireObservable);
|
|
56
|
+
}
|
|
41
57
|
var internalContext = startInternalContext(session);
|
|
42
58
|
return {
|
|
43
59
|
handleLog: _startLoggerCollection.handleLog,
|
|
44
60
|
getInternalContext: internalContext.get
|
|
45
61
|
};
|
|
46
|
-
}
|
|
62
|
+
}
|
|
63
|
+
function startLogsTelemetry(configuration, reportError, pageExitObservable, sessionExpireObservable) {
|
|
64
|
+
var telemetry = startTelemetry(TelemetryService.LOGS, configuration);
|
|
65
|
+
if (!canUseEventBridge()) {
|
|
66
|
+
var telemetryBatch = startBatchWithReplica(configuration, configuration.rumEndpoint, reportError, pageExitObservable, sessionExpireObservable);
|
|
67
|
+
telemetry.observable.subscribe(function (event) {
|
|
68
|
+
telemetryBatch.add(event);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return telemetry;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=startLogs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startLogs.js","names":["ErrorSource","LifeCycle","LifeCycleEventType","createPageExitObservable","areCookiesAuthorized","startTelemetry","startBatchWithReplica","canUseEventBridge","TelemetryService","startLogsSessionManager","startLogsSessionManagerStub","startLogsAssembly","getRUMInternalContext","startConsoleCollection","startReportCollection","startNetworkErrorCollection","startRuntimeErrorCollection","startLoggerCollection","startLogsBatch","StatusType","startInternalContext","startLogs","configuration","buildCommonContext","mainLogger","lifeCycle","reportError","error","notify","RAW_LOG_COLLECTED","rawLogsEvent","message","date","startClocks","timeStamp","origin","AGENT","status","pageExitObservable","session","cookieOptions","telemetry","startLogsTelemetry","expireObservable","setContextProvider","RUMInternalContext","application","id","findTrackedSession","view","action","userAction","_startLoggerCollection","internalContext","handleLog","getInternalContext","get","sessionExpireObservable","LOGS","telemetryBatch","rumEndpoint","observable","subscribe","event","add"],"sources":["../../src/boot/startLogs.js"],"sourcesContent":["import {\n ErrorSource,\n LifeCycle,\n LifeCycleEventType,\n createPageExitObservable,\n areCookiesAuthorized,\n startTelemetry,\n startBatchWithReplica,\n canUseEventBridge,\n TelemetryService\n} from '@cloudcare/browser-core'\nimport {\n startLogsSessionManager,\n startLogsSessionManagerStub\n} from '../domain/logsSessionManager'\nimport { startLogsAssembly, getRUMInternalContext } from '../domain/assembly'\nimport { startConsoleCollection } from '../domain/logsCollection/console/consoleCollection'\nimport { startReportCollection } from '../domain/logsCollection/report/reportCollection'\nimport { startNetworkErrorCollection } from '../domain/logsCollection/networkError/networkErrorCollection'\nimport { startRuntimeErrorCollection } from '../domain/logsCollection/rumtimeError/runtimeErrorCollection'\nimport { startLoggerCollection } from '../domain/logsCollection/logger/loggerCollection'\nimport { startLogsBatch } from '../transport/startLogsBatch'\nimport { StatusType } from '../domain/logger'\nimport { startInternalContext } from '../domain/internalContext'\n\nexport function startLogs(configuration, buildCommonContext, mainLogger) {\n var lifeCycle = new LifeCycle()\n\n var reportError = function (error) {\n lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {\n rawLogsEvent: {\n message: error.message,\n date: error.startClocks.timeStamp,\n error: {\n origin: ErrorSource.AGENT // Todo: Remove in the next major release\n },\n origin: ErrorSource.AGENT,\n status: StatusType.error\n }\n })\n }\n var pageExitObservable = createPageExitObservable()\n var session = areCookiesAuthorized(configuration.cookieOptions)\n ? startLogsSessionManager(configuration)\n : startLogsSessionManagerStub(configuration)\n const telemetry = startLogsTelemetry(\n configuration,\n reportError,\n pageExitObservable,\n session.expireObservable\n )\n telemetry.setContextProvider(function () {\n var RUMInternalContext = getRUMInternalContext()\n return {\n application: {\n id:\n RUMInternalContext &&\n RUMInternalContext.application &&\n RUMInternalContext.application.id\n },\n session: {\n id: session.findTrackedSession() && session.findTrackedSession().id\n },\n view: {\n id:\n RUMInternalContext &&\n RUMInternalContext.view &&\n RUMInternalContext.view.id\n },\n action: {\n id:\n RUMInternalContext &&\n RUMInternalContext.userAction &&\n RUMInternalContext.userAction.id\n }\n }\n })\n startNetworkErrorCollection(configuration, lifeCycle)\n startRuntimeErrorCollection(configuration, lifeCycle)\n startConsoleCollection(configuration, lifeCycle)\n startReportCollection(configuration, lifeCycle)\n var _startLoggerCollection = startLoggerCollection(lifeCycle)\n\n startLogsAssembly(\n session,\n configuration,\n lifeCycle,\n buildCommonContext,\n mainLogger,\n reportError\n )\n if (!canUseEventBridge()) {\n startLogsBatch(\n configuration,\n lifeCycle,\n reportError,\n pageExitObservable,\n session.expireObservable\n )\n }\n\n var internalContext = startInternalContext(session)\n\n return {\n handleLog: _startLoggerCollection.handleLog,\n getInternalContext: internalContext.get\n }\n}\nfunction startLogsTelemetry(\n configuration,\n reportError,\n pageExitObservable,\n sessionExpireObservable\n) {\n const telemetry = startTelemetry(TelemetryService.LOGS, configuration)\n if (!canUseEventBridge()) {\n var telemetryBatch = startBatchWithReplica(\n configuration,\n configuration.rumEndpoint,\n reportError,\n pageExitObservable,\n sessionExpireObservable\n )\n telemetry.observable.subscribe(function (event) {\n telemetryBatch.add(event)\n })\n }\n return telemetry\n}\n"],"mappings":"AAAA,SACEA,WAAW,EACXC,SAAS,EACTC,kBAAkB,EAClBC,wBAAwB,EACxBC,oBAAoB,EACpBC,cAAc,EACdC,qBAAqB,EACrBC,iBAAiB,EACjBC,gBAAgB,QACX,yBAAyB;AAChC,SACEC,uBAAuB,EACvBC,2BAA2B,QACtB,8BAA8B;AACrC,SAASC,iBAAiB,EAAEC,qBAAqB,QAAQ,oBAAoB;AAC7E,SAASC,sBAAsB,QAAQ,oDAAoD;AAC3F,SAASC,qBAAqB,QAAQ,kDAAkD;AACxF,SAASC,2BAA2B,QAAQ,8DAA8D;AAC1G,SAASC,2BAA2B,QAAQ,8DAA8D;AAC1G,SAASC,qBAAqB,QAAQ,kDAAkD;AACxF,SAASC,cAAc,QAAQ,6BAA6B;AAC5D,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,oBAAoB,QAAQ,2BAA2B;AAEhE,OAAO,SAASC,SAASA,CAACC,aAAa,EAAEC,kBAAkB,EAAEC,UAAU,EAAE;EACvE,IAAIC,SAAS,GAAG,IAAIxB,SAAS,CAAC,CAAC;EAE/B,IAAIyB,WAAW,GAAG,SAAdA,WAAWA,CAAaC,KAAK,EAAE;IACjCF,SAAS,CAACG,MAAM,CAAC1B,kBAAkB,CAAC2B,iBAAiB,EAAE;MACrDC,YAAY,EAAE;QACZC,OAAO,EAAEJ,KAAK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aAAa,EAAEG,SAAS,CAAC;EACrDZ,sBAAsB,CAACS,aAAa,EAAEG,SAAS,CAAC;EAChDX,qBAAqB,CAACQ,aAAa,EAAEG,SAAS,CAAC;EAC/C,IAAI2B,sBAAsB,GAAGnC,qBAAqB,CAACQ,SAAS,CAAC;EAE7Dd,iBAAiB,CACf4B,OAAO,EACPjB,aAAa,EACbG,SAAS,EACTF,kBAAkB,EAClBC,UAAU,EACVE,WACF,CAAC;EACD,IAAI,CAACnB,iBAAiB,CAAC,CAAC,EAAE;IACxBW,cAAc,CACZI,aAAa,EACbG,SAAS,EACTC,WAAW,EACXY,kBAAkB,EAClBC,OAAO,CAACI,gBACV,CAAC;EACH;EAEA,IAAIU,eAAe,GAAGjC,oBAAoB,CAACmB,OAAO,CAAC;EAEnD,OAAO;IACLe,SAAS,EAAEF,sBAAsB,CAACE,SAAS;IAC3CC,kBAAkB,EAAEF,eAAe,CAACG;EACtC,CAAC;AACH;AACA,SAASd,kBAAkBA,CACzBpB,aAAa,EACbI,WAAW,EACXY,kBAAkB,EAClBmB,uBAAuB,EACvB;EACA,IAAMhB,SAAS,GAAGpC,cAAc,CAACG,gBAAgB,CAACkD,IAAI,EAAEpC,aAAa,CAAC;EACtE,IAAI,CAACf,iBAAiB,CAAC,CAAC,EAAE;IACxB,IAAIoD,cAAc,GAAGrD,qBAAqB,CACxCgB,aAAa,EACbA,aAAa,CAACsC,WAAW,EACzBlC,WAAW,EACXY,kBAAkB,EAClBmB,uBACF,CAAC;IACDhB,SAAS,CAACoB,UAAU,CAACC,SAAS,CAAC,UAAUC,KAAK,EAAE;MAC9CJ,cAAc,CAACK,GAAG,CAACD,KAAK,CAAC;IAC3B,CAAC,CAAC;EACJ;EACA,OAAOtB,SAAS;AAClB"}
|
package/esm/domain/assembly.js
CHANGED
|
@@ -15,11 +15,9 @@ export function startLogsAssembly(sessionManager, configuration, lifeCycle, buil
|
|
|
15
15
|
var logger = data.logger || mainLogger;
|
|
16
16
|
var startTime = getRelativeTime(rawLogsEvent.date);
|
|
17
17
|
var session = sessionManager.findTrackedSession(startTime);
|
|
18
|
-
|
|
19
18
|
if (!session) {
|
|
20
19
|
return;
|
|
21
20
|
}
|
|
22
|
-
|
|
23
21
|
var commonContext = savedCommonContext || buildCommonContext();
|
|
24
22
|
var log = extend2Lev({
|
|
25
23
|
service: configuration.service || 'browser',
|
|
@@ -37,24 +35,20 @@ export function startLogsAssembly(sessionManager, configuration, lifeCycle, buil
|
|
|
37
35
|
device: deviceInfo,
|
|
38
36
|
type: RumEventType.LOGGER
|
|
39
37
|
}, commonContext.context, getRUMInternalContext(startTime), rawLogsEvent, logger.getContext(), messageContext);
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
if (
|
|
39
|
+
// Todo: [RUMF-1230] Move this check to the logger collection in the next major release
|
|
42
40
|
!isAuthorized(rawLogsEvent.status, HandlerType.http, logger) || configuration.beforeSend && configuration.beforeSend(log) === false || log.error && log.error.origin !== ErrorSource.AGENT && isNullUndefinedDefaultValue(logRateLimiters[log.status], logRateLimiters['custom']).isLimitReached()) {
|
|
43
41
|
return;
|
|
44
42
|
}
|
|
45
|
-
|
|
46
43
|
lifeCycle.notify(LifeCycleEventType.LOG_COLLECTED, withSnakeCaseKeys(log));
|
|
47
44
|
});
|
|
48
45
|
}
|
|
49
46
|
export function getRUMInternalContext(startTime) {
|
|
50
47
|
return getInternalContextFromRumGlobal(window.DATAFLUX_RUM);
|
|
51
|
-
|
|
52
48
|
function getInternalContextFromRumGlobal(rumGlobal) {
|
|
53
49
|
if (rumGlobal && rumGlobal.getInternalContext) {
|
|
54
50
|
return rumGlobal.getInternalContext(startTime);
|
|
55
51
|
}
|
|
56
52
|
}
|
|
57
53
|
}
|
|
58
|
-
|
|
59
|
-
logsSentBeforeRumInjectionTelemetryAdded = false;
|
|
60
|
-
}
|
|
54
|
+
//# sourceMappingURL=assembly.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assembly.js","names":["ErrorSource","extend2Lev","createEventRateLimiter","getRelativeTime","withSnakeCaseKeys","LifeCycleEventType","deviceInfo","each","RumEventType","isEmptyObject","isNullUndefinedDefaultValue","STATUSES","HandlerType","isAuthorized","startLogsAssembly","sessionManager","configuration","lifeCycle","buildCommonContext","mainLogger","reportError","statusWithCustom","concat","logRateLimiters","status","eventRateLimiterThreshold","subscribe","RAW_LOG_COLLECTED","data","rawLogsEvent","messageContext","undefined","savedCommonContext","logger","startTime","date","session","findTrackedSession","commonContext","log","service","env","version","_dd","sdkName","sdkVersion","id","view","user","device","type","LOGGER","context","getRUMInternalContext","getContext","http","beforeSend","error","origin","AGENT","isLimitReached","notify","LOG_COLLECTED","getInternalContextFromRumGlobal","window","DATAFLUX_RUM","rumGlobal","getInternalContext"],"sources":["../../src/domain/assembly.js"],"sourcesContent":["import {\n ErrorSource,\n extend2Lev,\n createEventRateLimiter,\n getRelativeTime,\n withSnakeCaseKeys,\n LifeCycleEventType,\n deviceInfo,\n each,\n RumEventType,\n isEmptyObject,\n isNullUndefinedDefaultValue\n} from '@cloudcare/browser-core'\n\nimport { STATUSES, HandlerType } from './logger'\nimport { isAuthorized } from './logsCollection/logger/loggerCollection'\n\nexport function startLogsAssembly(\n sessionManager,\n configuration,\n lifeCycle,\n buildCommonContext,\n mainLogger,\n reportError\n) {\n var statusWithCustom = STATUSES.concat(['custom'])\n var logRateLimiters = {}\n each(statusWithCustom, function (status) {\n logRateLimiters[status] = createEventRateLimiter(\n status,\n configuration.eventRateLimiterThreshold,\n reportError\n )\n })\n lifeCycle.subscribe(LifeCycleEventType.RAW_LOG_COLLECTED, function (data) {\n // { rawLogsEvent, messageContext = undefined, savedCommonContext = undefined, logger = mainLogger }\n var rawLogsEvent = data.rawLogsEvent\n var messageContext = data.messageContext || undefined\n var savedCommonContext = data.savedCommonContext || undefined\n var logger = data.logger || mainLogger\n var startTime = getRelativeTime(rawLogsEvent.date)\n var session = sessionManager.findTrackedSession(startTime)\n\n if (!session) {\n return\n }\n var commonContext = savedCommonContext || buildCommonContext()\n var log = extend2Lev(\n {\n service: configuration.service || 'browser',\n env: configuration.env || '',\n version: configuration.version || '',\n _dd: {\n sdkName: configuration.sdkName,\n sdkVersion: configuration.sdkVersion\n },\n session: {\n id: session.id\n },\n view: commonContext.view,\n user: !isEmptyObject(commonContext.user)\n ? commonContext.user\n : undefined,\n device: deviceInfo,\n type: RumEventType.LOGGER\n },\n commonContext.context,\n getRUMInternalContext(startTime),\n rawLogsEvent,\n logger.getContext(),\n messageContext\n )\n\n if (\n // Todo: [RUMF-1230] Move this check to the logger collection in the next major release\n !isAuthorized(rawLogsEvent.status, HandlerType.http, logger) ||\n (configuration.beforeSend && configuration.beforeSend(log) === false) ||\n (log.error &&\n log.error.origin !== ErrorSource.AGENT &&\n isNullUndefinedDefaultValue(\n logRateLimiters[log.status],\n logRateLimiters['custom']\n ).isLimitReached())\n ) {\n return\n }\n\n lifeCycle.notify(LifeCycleEventType.LOG_COLLECTED, withSnakeCaseKeys(log))\n })\n}\n\nexport function getRUMInternalContext(startTime) {\n return getInternalContextFromRumGlobal(window.DATAFLUX_RUM)\n\n function getInternalContextFromRumGlobal(rumGlobal) {\n if (rumGlobal && rumGlobal.getInternalContext) {\n return rumGlobal.getInternalContext(startTime)\n }\n }\n}\n"],"mappings":"AAAA,SACEA,WAAW,EACXC,UAAU,EACVC,sBAAsB,EACtBC,eAAe,EACfC,iBAAiB,EACjBC,kBAAkB,EAClBC,UAAU,EACVC,IAAI,EACJC,YAAY,EACZC,aAAa,EACbC,2BAA2B,QACtB,yBAAyB;AAEhC,SAASC,QAAQ,EAAEC,WAAW,QAAQ,UAAU;AAChD,SAASC,YAAY,QAAQ,0CAA0C;AAEvE,OAAO,SAASC,iBAAiBA,CAC/BC,cAAc,EACdC,aAAa,EACbC,SAAS,EACTC,kBAAkB,EAClBC,UAAU,EACVC,WAAW,EACX;EACA,IAAIC,gBAAgB,GAAGV,QAAQ,CAACW,MAAM,CAAC,CAAC,QAAQ,CAAC,CA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,CAAC,GACpCV,aAAa,CAACU,IAAI,GAClBjB,SAAS;MACbkB,MAAM,EAAE3C,UAAU;MAClB4C,IAAI,EAAE1C,YAAY,CAAC2C;IACrB,CAAC,EACDb,aAAa,CAACc,OAAO,EACrBC,qBAAqB,CAACnB,SAAS,CAAC,EAChCL,YAAY,EACZI,MAAM,CAACqB,UAAU,CAAC,CAAC,EACnBxB,cACF,CAAC;IAED;IACE;IACA,CAACjB,YAAY,CAACgB,YAAY,CAACL,MAAM,EAAEZ,WAAW,CAAC2C,IAAI,EAAEtB,MAAM,CAAC,IAC3DjB,aAAa,CAACwC,UAAU,IAAIxC,aAAa,CAACwC,UAAU,CAACjB,GAAG,CAAC,KAAK,KAAM,IACpEA,GAAG,CAACkB,KAAK,IACRlB,GAAG,CAACkB,KAAK,CAACC,MAAM,KAAK1D,WAAW,CAAC2D,KAAK,IACtCjD,2BAA2B,CACzBa,eAAe,CAACgB,GAAG,CAACf,MAAM,CAAC,EAC3BD,eAAe,CAAC,QAAQ,CAC1B,CAAC,CAACqC,cAAc,CAAC,CAAE,EACrB;MACA;IACF;IAEA3C,SAAS,CAAC4C,MAAM,CAACxD,kBAAkB,CAACyD,aAAa,EAAE1D,iBAAiB,CAACmC,GAAG,CAAC,CAAC;EAC5E,CAAC,CAAC;AACJ;AAEA,OAAO,SAASc,qBAAqBA,CAACnB,SAAS,EAAE;EAC/C,OAAO6B,+BAA+B,CAACC,MAAM,CAACC,YAAY,CAAC;EAE3D,SAASF,+BAA+BA,CAACG,SAAS,EAAE;IAClD,IAAIA,SAAS,IAAIA,SAAS,CAACC,kBAAkB,EAAE;MAC7C,OAAOD,SAAS,CAACC,kBAAkB,CAACjC,SAAS,CAAC;IAChD;EACF;AACF"}
|
|
@@ -3,21 +3,17 @@ import { buildEnv } from '../boot/buildEnv';
|
|
|
3
3
|
/**
|
|
4
4
|
* arbitrary value, byte precision not needed
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
6
|
export var DEFAULT_REQUEST_ERROR_RESPONSE_LENGTH_LIMIT = 32 * ONE_KIBI_BYTE;
|
|
8
7
|
export function validateAndBuildLogsConfiguration(initConfiguration) {
|
|
9
8
|
var baseConfiguration = validateAndBuildConfiguration(initConfiguration);
|
|
10
9
|
var forwardConsoleLogs = validateAndBuildForwardOption(initConfiguration.forwardConsoleLogs, values(ConsoleApiName), 'Forward Console Logs');
|
|
11
10
|
var forwardReports = validateAndBuildForwardOption(initConfiguration.forwardReports, values(RawReportType), 'Forward Reports');
|
|
12
|
-
|
|
13
11
|
if (!baseConfiguration || !forwardConsoleLogs || !forwardReports) {
|
|
14
12
|
return;
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
if (initConfiguration.forwardErrorsToLogs && !includes(forwardConsoleLogs, ConsoleApiName.error)) {
|
|
18
15
|
forwardConsoleLogs.push(ConsoleApiName.error);
|
|
19
16
|
}
|
|
20
|
-
|
|
21
17
|
return assign({
|
|
22
18
|
forwardErrorsToLogs: initConfiguration.forwardErrorsToLogs !== false,
|
|
23
19
|
forwardConsoleLogs: forwardConsoleLogs,
|
|
@@ -29,13 +25,12 @@ export function validateAndBuildForwardOption(option, allowedValues, label) {
|
|
|
29
25
|
if (option === undefined) {
|
|
30
26
|
return [];
|
|
31
27
|
}
|
|
32
|
-
|
|
33
28
|
if (!(option === 'all' || isArray(option) && every(option, function (api) {
|
|
34
29
|
return includes(allowedValues, api);
|
|
35
30
|
}))) {
|
|
36
31
|
display.error(label + ' should be "all" or an array with allowed values "' + allowedValues.join('", "') + '"');
|
|
37
32
|
return;
|
|
38
33
|
}
|
|
39
|
-
|
|
40
34
|
return option === 'all' ? allowedValues : unique(option);
|
|
41
|
-
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.js","names":["assign","ONE_KIBI_BYTE","validateAndBuildConfiguration","display","unique","RawReportType","isArray","every","ConsoleApiName","includes","values","buildEnv","DEFAULT_REQUEST_ERROR_RESPONSE_LENGTH_LIMIT","validateAndBuildLogsConfiguration","initConfiguration","baseConfiguration","forwardConsoleLogs","validateAndBuildForwardOption","forwardReports","forwardErrorsToLogs","error","push","requestErrorResponseLengthLimit","option","allowedValues","label","undefined","api","join"],"sources":["../../src/domain/configuration.js"],"sourcesContent":["import {\n assign,\n ONE_KIBI_BYTE,\n validateAndBuildConfiguration,\n display,\n unique,\n RawReportType,\n isArray,\n every,\n ConsoleApiName,\n includes,\n values,\n} from '@cloudcare/browser-core'\nimport { buildEnv } from '../boot/buildEnv'\n/**\n * arbitrary value, byte precision not needed\n */\nexport var DEFAULT_REQUEST_ERROR_RESPONSE_LENGTH_LIMIT = 32 * ONE_KIBI_BYTE\n\nexport function validateAndBuildLogsConfiguration(\n initConfiguration\n){\n var baseConfiguration = validateAndBuildConfiguration(initConfiguration)\n\n var forwardConsoleLogs = validateAndBuildForwardOption(\n initConfiguration.forwardConsoleLogs,\n values(ConsoleApiName),\n 'Forward Console Logs'\n )\n\n var forwardReports = validateAndBuildForwardOption(\n initConfiguration.forwardReports,\n values(RawReportType),\n 'Forward Reports'\n )\n\n if (!baseConfiguration || !forwardConsoleLogs || !forwardReports) {\n return\n }\n\n if (initConfiguration.forwardErrorsToLogs && !includes(forwardConsoleLogs, ConsoleApiName.error)) {\n forwardConsoleLogs.push(ConsoleApiName.error)\n }\n return assign(\n {\n forwardErrorsToLogs: initConfiguration.forwardErrorsToLogs !== false,\n forwardConsoleLogs: forwardConsoleLogs,\n forwardReports: forwardReports,\n requestErrorResponseLengthLimit: DEFAULT_REQUEST_ERROR_RESPONSE_LENGTH_LIMIT,\n },\n baseConfiguration,\n buildEnv\n )\n}\n\nexport function validateAndBuildForwardOption(\n option,\n allowedValues,\n label\n) {\n if (option === undefined) {\n return []\n }\n\n if (!(option === 'all' || (isArray(option) && every(option, function(api) { return includes(allowedValues, api) })))) {\n display.error(label + ' should be \"all\" or an array with allowed values \"' + allowedValues.join('\", \"') + '\"')\n return\n }\n return option === 'all' ? allowedValues : unique(option)\n}\n"],"mappings":"AAAA,SACEA,MAAM,EACNC,aAAa,EACbC,6BAA6B,EAC7BC,OAAO,EACPC,MAAM,EACNC,aAAa,EACbC,OAAO,EACPC,KAAK,EACLC,cAAc,EACdC,QAAQ,EACRC,MAAM,QACD,yBAAyB;AAChC,SAASC,QAAQ,QAAQ,kBAAkB;AAC3C;AACA;AACA;AACA,OAAO,IAAIC,2CAA2C,GAAG,EAAE,GAAGX,aAAa;AAE3E,OAAO,SAASY,iCAAiCA,CAC/CC,iBAAiB,EAClB;EACC,IAAIC,iBAAiB,GAAGb,6BAA6B,CAACY,iBAAiB,CAAC;EAExE,IAAIE,kBAAkB,GAAGC,6BAA6B,CACpDH,iBAAiB,CAACE,kBAAkB,EACpCN,MAAM,CAACF,cAAc,CAAC,EACtB,sBACF,CAAC;EAED,IAAIU,cAAc,GAAGD,6BAA6B,CAChDH,iBAAiB,CAACI,cAAc,EAChCR,MAAM,CAACL,aAAa,CAAC,EACrB,iBACF,CAAC;EAED,IAAI,CAACU,iBAAiB,IAAI,CAACC,kBAAkB,IAAI,CAACE,cAAc,EAAE;IAChE;EACF;EAEA,IAAIJ,iBAAiB,CAACK,mBAAmB,IAAI,CAACV,QAAQ,CAACO,kBAAkB,EAAER,cAAc,CAACY,KAAK,CAAC,EAAE;IAChGJ,kBAAkB,CAACK,IAAI,CAACb,cAAc,CAACY,KAAK,CAAC;EAC/C;EACA,OAAOpB,MAAM,CACX;IACEmB,mBAAmB,EAAEL,iBAAiB,CAACK,mBAAmB,KAAK,KAAK;IACpEH,kBAAkB,EAAEA,kBAAkB;IACtCE,cAAc,EAAEA,cAAc;IAC9BI,+BAA+B,EAAEV;EACnC,CAAC,EACDG,iBAAiB,EACjBJ,QACF,CAAC;AACH;AAEA,OAAO,SAASM,6BAA6BA,CAC3CM,MAAM,EACNC,aAAa,EACbC,KAAK,EACL;EACA,IAAIF,MAAM,KAAKG,SAAS,EAAE;IACxB,OAAO,EAAE;EACX;EAEA,IAAI,EAAEH,MAAM,KAAK,KAAK,IAAKjB,OAAO,CAACiB,MAAM,CAAC,IAAIhB,KAAK,CAACgB,MAAM,EAAE,UAASI,GAAG,EAAE;IAAE,OAAOlB,QAAQ,CAACe,aAAa,EAAEG,GAAG,CAAC;EAAC,CAAC,CAAE,CAAC,EAAE;IACpHxB,OAAO,CAACiB,KAAK,CAACK,KAAK,GAAG,oDAAoD,GAAGD,aAAa,CAACI,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC;IAC9G;EACF;EACA,OAAOL,MAAM,KAAK,KAAK,GAAGC,aAAa,GAAGpB,MAAM,CAACmB,MAAM,CAAC;AAC1D"}
|
|
@@ -2,7 +2,6 @@ export function startInternalContext(sessionManager) {
|
|
|
2
2
|
return {
|
|
3
3
|
get: function get(startTime) {
|
|
4
4
|
var trackedSession = sessionManager.findTrackedSession(startTime);
|
|
5
|
-
|
|
6
5
|
if (trackedSession) {
|
|
7
6
|
return {
|
|
8
7
|
session: {
|
|
@@ -12,4 +11,5 @@ export function startInternalContext(sessionManager) {
|
|
|
12
11
|
}
|
|
13
12
|
}
|
|
14
13
|
};
|
|
15
|
-
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=internalContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internalContext.js","names":["startInternalContext","sessionManager","get","startTime","trackedSession","findTrackedSession","session","id"],"sources":["../../src/domain/internalContext.js"],"sourcesContent":["\nexport function startInternalContext(sessionManager) {\n return {\n get: function(startTime) {\n var trackedSession = sessionManager.findTrackedSession(startTime)\n if (trackedSession) {\n return {\n session: {\n id: trackedSession.id\n },\n }\n }\n },\n }\n}\n"],"mappings":"AACA,OAAO,SAASA,oBAAoBA,CAACC,cAAc,EAAE;EACnD,OAAO;IACLC,GAAG,EAAE,SAAAA,IAASC,SAAS,EAAE;MACvB,IAAIC,cAAc,GAAGH,cAAc,CAACI,kBAAkB,CAACF,SAAS,CAAC;MACjE,IAAIC,cAAc,EAAE;QAClB,OAAO;UACLE,OAAO,EAAE;YACPC,EAAE,EAAEH,cAAc,CAACG;UACrB;QACF,CAAC;MACH;IACF;EACF,CAAC;AACH"}
|
package/esm/domain/logger.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { assign, extend2Lev, createContextManager, ErrorSource, keys, CustomerDataType, sanitize, computeStackTrace, computeRawError, clocksNow, ErrorHandling, monitor, NonErrorPrefix } from '@cloudcare/browser-core';
|
|
2
2
|
export var StatusType = {
|
|
3
3
|
debug: 'debug',
|
|
4
4
|
error: 'error',
|
|
@@ -11,23 +11,19 @@ export var HandlerType = {
|
|
|
11
11
|
http: 'http',
|
|
12
12
|
silent: 'silent'
|
|
13
13
|
};
|
|
14
|
-
export var STATUSES = keys(StatusType);
|
|
15
|
-
|
|
14
|
+
export var STATUSES = keys(StatusType);
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
16
16
|
export function Logger(handleLogStrategy, name, handlerType, level, loggerContext) {
|
|
17
17
|
this.contextManager = createContextManager(CustomerDataType.LoggerContext);
|
|
18
|
-
|
|
19
18
|
if (typeof handlerType === 'undefined') {
|
|
20
19
|
handlerType = HandlerType.http;
|
|
21
20
|
}
|
|
22
|
-
|
|
23
21
|
if (typeof level === 'undefined') {
|
|
24
22
|
level = StatusType.debug;
|
|
25
23
|
}
|
|
26
|
-
|
|
27
24
|
if (typeof loggerContext === 'undefined') {
|
|
28
25
|
loggerContext = {};
|
|
29
26
|
}
|
|
30
|
-
|
|
31
27
|
this.handleLogStrategy = handleLogStrategy;
|
|
32
28
|
this.handlerType = handlerType;
|
|
33
29
|
this.level = level;
|
|
@@ -38,36 +34,64 @@ export function Logger(handleLogStrategy, name, handlerType, level, loggerContex
|
|
|
38
34
|
} : undefined));
|
|
39
35
|
}
|
|
40
36
|
Logger.prototype = {
|
|
41
|
-
log: function
|
|
37
|
+
log: monitor(function (message, messageContext, status, error) {
|
|
42
38
|
if (typeof status === 'undefined') {
|
|
43
39
|
status = StatusType.info;
|
|
44
40
|
}
|
|
45
|
-
|
|
41
|
+
var errorContext;
|
|
42
|
+
if (status === StatusType.error) {
|
|
43
|
+
// Always add origin if status is error (backward compatibility - Remove in next major)
|
|
44
|
+
errorContext = {
|
|
45
|
+
origin: ErrorSource.LOGGER
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
if (error !== undefined && error !== null) {
|
|
49
|
+
var stackTrace = error instanceof Error ? computeStackTrace(error) : undefined;
|
|
50
|
+
var rawError = computeRawError({
|
|
51
|
+
stackTrace: stackTrace,
|
|
52
|
+
originalError: error,
|
|
53
|
+
nonErrorPrefix: NonErrorPrefix.PROVIDED,
|
|
54
|
+
source: ErrorSource.LOGGER,
|
|
55
|
+
handling: ErrorHandling.HANDLED,
|
|
56
|
+
startClocks: clocksNow()
|
|
57
|
+
});
|
|
58
|
+
errorContext = {
|
|
59
|
+
origin: ErrorSource.LOGGER,
|
|
60
|
+
// Remove in next major
|
|
61
|
+
stack: rawError.stack,
|
|
62
|
+
kind: rawError.type,
|
|
63
|
+
message: rawError.message
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
var sanitizedMessageContext = sanitize(messageContext);
|
|
67
|
+
var context = errorContext ? extend2Lev({
|
|
68
|
+
error: errorContext
|
|
69
|
+
}, sanitizedMessageContext) : sanitizedMessageContext;
|
|
46
70
|
this.handleLogStrategy({
|
|
47
71
|
message: message,
|
|
48
|
-
context:
|
|
72
|
+
context: context,
|
|
49
73
|
status: status
|
|
50
74
|
}, this);
|
|
75
|
+
}),
|
|
76
|
+
debug: function debug(message, messageContext, error) {
|
|
77
|
+
this.log(message, messageContext, StatusType.debug, error);
|
|
51
78
|
},
|
|
52
|
-
|
|
53
|
-
this.log(message, messageContext, StatusType.
|
|
79
|
+
info: function info(message, messageContext, error) {
|
|
80
|
+
this.log(message, messageContext, StatusType.info, error);
|
|
54
81
|
},
|
|
55
|
-
|
|
56
|
-
this.log(message, messageContext, StatusType.
|
|
82
|
+
warn: function warn(message, messageContext, error) {
|
|
83
|
+
this.log(message, messageContext, StatusType.warn, error);
|
|
57
84
|
},
|
|
58
|
-
|
|
59
|
-
this.log(message, messageContext, StatusType.
|
|
85
|
+
critical: function critical(message, messageContext, error) {
|
|
86
|
+
this.log(message, messageContext, StatusType.critical, error);
|
|
60
87
|
},
|
|
61
|
-
|
|
62
|
-
this.log(message, messageContext, StatusType.critical);
|
|
63
|
-
},
|
|
64
|
-
error: function error(message, messageContext) {
|
|
88
|
+
error: function error(message, messageContext, _error) {
|
|
65
89
|
var errorOrigin = {
|
|
66
90
|
error: {
|
|
67
91
|
origin: ErrorSource.LOGGER
|
|
68
92
|
}
|
|
69
93
|
};
|
|
70
|
-
this.log(message, extend2Lev(errorOrigin, messageContext), StatusType.error);
|
|
94
|
+
this.log(message, extend2Lev(errorOrigin, messageContext), StatusType.error, _error);
|
|
71
95
|
},
|
|
72
96
|
setContext: function setContext(context) {
|
|
73
97
|
this.contextManager.set(context);
|
|
@@ -93,4 +117,5 @@ Logger.prototype = {
|
|
|
93
117
|
getLevel: function getLevel() {
|
|
94
118
|
return this.level;
|
|
95
119
|
}
|
|
96
|
-
};
|
|
120
|
+
};
|
|
121
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","names":["assign","extend2Lev","createContextManager","ErrorSource","keys","CustomerDataType","sanitize","computeStackTrace","computeRawError","clocksNow","ErrorHandling","monitor","NonErrorPrefix","StatusType","debug","error","info","warn","critical","HandlerType","console","http","silent","STATUSES","Logger","handleLogStrategy","name","handlerType","level","loggerContext","contextManager","LoggerContext","set","logger","undefined","prototype","log","message","messageContext","status","errorContext","origin","LOGGER","stackTrace","Error","rawError","originalError","nonErrorPrefix","PROVIDED","source","handling","HANDLED","startClocks","stack","kind","type","sanitizedMessageContext","context","errorOrigin","setContext","getContext","get","addContext","key","value","add","removeContext","remove","setHandler","handler","getHandler","setLevel","getLevel"],"sources":["../../src/domain/logger.js"],"sourcesContent":["import {\n assign,\n extend2Lev,\n createContextManager,\n ErrorSource,\n keys,\n CustomerDataType,\n sanitize,\n computeStackTrace,\n computeRawError,\n clocksNow,\n ErrorHandling,\n monitor,\n NonErrorPrefix\n} from '@cloudcare/browser-core'\n\nexport var StatusType = {\n debug: 'debug',\n error: 'error',\n info: 'info',\n warn: 'warn',\n critical: 'critical'\n}\n\nexport var HandlerType = {\n console: 'console',\n http: 'http',\n silent: 'silent'\n}\n\nexport var STATUSES = keys(StatusType)\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport function Logger(\n handleLogStrategy,\n name,\n handlerType,\n level,\n loggerContext\n) {\n this.contextManager = createContextManager(CustomerDataType.LoggerContext)\n if (typeof handlerType === 'undefined') {\n handlerType = HandlerType.http\n }\n if (typeof level === 'undefined') {\n level = StatusType.debug\n }\n if (typeof loggerContext === 'undefined') {\n loggerContext = {}\n }\n this.handleLogStrategy = handleLogStrategy\n this.handlerType = handlerType\n this.level = level\n this.contextManager.set(\n assign({}, loggerContext, name ? { logger: { name: name } } : undefined)\n )\n}\nLogger.prototype = {\n log: monitor(function (message, messageContext, status, error) {\n if (typeof status === 'undefined') {\n status = StatusType.info\n }\n var errorContext\n if (status === StatusType.error) {\n // Always add origin if status is error (backward compatibility - Remove in next major)\n errorContext = { origin: ErrorSource.LOGGER }\n }\n if (error !== undefined && error !== null) {\n var stackTrace =\n error instanceof Error ? computeStackTrace(error) : undefined\n var rawError = computeRawError({\n stackTrace: stackTrace,\n originalError: error,\n nonErrorPrefix: NonErrorPrefix.PROVIDED,\n source: ErrorSource.LOGGER,\n handling: ErrorHandling.HANDLED,\n startClocks: clocksNow()\n })\n\n errorContext = {\n origin: ErrorSource.LOGGER, // Remove in next major\n stack: rawError.stack,\n kind: rawError.type,\n message: rawError.message\n }\n }\n\n var sanitizedMessageContext = sanitize(messageContext)\n\n var context = errorContext\n ? extend2Lev({ error: errorContext }, sanitizedMessageContext)\n : sanitizedMessageContext\n\n this.handleLogStrategy(\n { message: message, context: context, status: status },\n this\n )\n }),\n\n debug: function (message, messageContext, error) {\n this.log(message, messageContext, StatusType.debug, error)\n },\n\n info: function (message, messageContext, error) {\n this.log(message, messageContext, StatusType.info, error)\n },\n\n warn: function (message, messageContext, error) {\n this.log(message, messageContext, StatusType.warn, error)\n },\n critical: function (message, messageContext, error) {\n this.log(message, messageContext, StatusType.critical, error)\n },\n error: function (message, messageContext, error) {\n var errorOrigin = {\n error: {\n origin: ErrorSource.LOGGER\n }\n }\n this.log(\n message,\n extend2Lev(errorOrigin, messageContext),\n StatusType.error,\n error\n )\n },\n\n setContext: function (context) {\n this.contextManager.set(context)\n },\n\n getContext: function () {\n return this.contextManager.get()\n },\n\n addContext: function (key, value) {\n this.contextManager.add(key, value)\n },\n\n removeContext: function (key) {\n this.contextManager.remove(key)\n },\n\n setHandler: function (handler) {\n this.handlerType = handler\n },\n\n getHandler: function () {\n return this.handlerType\n },\n setLevel: function (level) {\n this.level = level\n },\n getLevel: function () {\n return this.level\n }\n}\n"],"mappings":"AAAA,SACEA,MAAM,EACNC,UAAU,EACVC,oBAAoB,EACpBC,WAAW,EACXC,IAAI,EACJC,gBAAgB,EAChBC,QAAQ,EACRC,iBAAiB,EACjBC,eAAe,EACfC,SAAS,EACTC,aAAa,EACbC,OAAO,EACPC,cAAc,QACT,yBAAyB;AAEhC,OAAO,IAAIC,UAAU,GAAG;EACtBC,KAAK,EAAE,OAAO;EACdC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,QAAQ,EAAE;AACZ,CAAC;AAED,OAAO,IAAIC,WAAW,GAAG;EACvBC,OAAO,EAAE,SAAS;EAClBC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE;AACV,CAAC;AAED,OAAO,IAAIC,QAAQ,GAAGnB,IAAI,CAACS,UAAU,CAAC;AACtC;AACA,OAAO,SAASW,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C5B,CAAC;EAEDC,UAAU,EAAE,SAAAA,WAAA,EAAY;IACtB,OAAO,IAAI,CAAC3C,WAAW;EACzB,CAAC;EACD4C,QAAQ,EAAE,SAAAA,SAAU3C,KAAK,EAAE;IACzB,IAAI,CAACA,KAAK,GAAGA,KAAK;EACpB,CAAC;EACD4C,QAAQ,EAAE,SAAAA,SAAA,EAAY;IACpB,OAAO,IAAI,CAAC5C,KAAK;EACnB;AACF,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
var _LogStatusForApi;
|
|
2
|
-
|
|
3
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
|
|
2
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
5
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
5
6
|
import { timeStampNow, ConsoleApiName, ErrorSource, initConsoleObservable, LifeCycleEventType } from '@cloudcare/browser-core';
|
|
6
7
|
import { StatusType } from '../../logger';
|
|
7
8
|
var LogStatusForApi = (_LogStatusForApi = {}, _defineProperty(_LogStatusForApi, ConsoleApiName.log, StatusType.info), _defineProperty(_LogStatusForApi, ConsoleApiName.debug, StatusType.debug), _defineProperty(_LogStatusForApi, ConsoleApiName.info, StatusType.info), _defineProperty(_LogStatusForApi, ConsoleApiName.warn, StatusType.warn), _defineProperty(_LogStatusForApi, ConsoleApiName.error, StatusType.error), _LogStatusForApi);
|
|
@@ -26,4 +27,5 @@ export function startConsoleCollection(configuration, lifeCycle) {
|
|
|
26
27
|
consoleSubscription.unsubscribe();
|
|
27
28
|
}
|
|
28
29
|
};
|
|
29
|
-
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=consoleCollection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consoleCollection.js","names":["timeStampNow","ConsoleApiName","ErrorSource","initConsoleObservable","LifeCycleEventType","StatusType","LogStatusForApi","_LogStatusForApi","_defineProperty","log","info","debug","warn","error","startConsoleCollection","configuration","lifeCycle","consoleSubscription","forwardConsoleLogs","subscribe","notify","RAW_LOG_COLLECTED","rawLogsEvent","date","message","origin","CONSOLE","api","stack","undefined","status","stop","unsubscribe"],"sources":["../../../../src/domain/logsCollection/console/consoleCollection.js"],"sourcesContent":["import { timeStampNow, ConsoleApiName, ErrorSource, initConsoleObservable, LifeCycleEventType } from '@cloudcare/browser-core'\nimport { StatusType } from '../../logger'\n\n\nvar LogStatusForApi = {\n [ConsoleApiName.log]: StatusType.info,\n [ConsoleApiName.debug]: StatusType.debug,\n [ConsoleApiName.info]: StatusType.info,\n [ConsoleApiName.warn]: StatusType.warn,\n [ConsoleApiName.error]: StatusType.error,\n}\nexport function startConsoleCollection(configuration, lifeCycle) {\n var consoleSubscription = initConsoleObservable(configuration.forwardConsoleLogs).subscribe(function(log) {\n lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {\n rawLogsEvent: {\n date: timeStampNow(),\n message: log.message,\n origin: ErrorSource.CONSOLE,\n error:\n log.api === ConsoleApiName.error\n ? {\n origin: ErrorSource.CONSOLE, // Todo: Remove in the next major release\n stack: log.stack,\n }\n : undefined,\n status: LogStatusForApi[log.api],\n },\n })\n })\n\n return {\n stop: function(){\n consoleSubscription.unsubscribe()\n },\n }\n}\n"],"mappings":";;;;;AAAA,SAASA,YAAY,EAAEC,cAAc,EAAEC,WAAW,EAAEC,qBAAqB,EAAEC,kBAAkB,QAAQ,yBAAyB;AAC9H,SAASC,UAAU,QAAQ,cAAc;AAGzC,IAAIC,eAAe,IAAAC,gBAAA,OAAAC,eAAA,CAAAD,gBAAA,EAChBN,cAAc,CAACQ,GAAG,EAAGJ,UAAU,CAACK,IAAI,GAAAF,eAAA,CAAAD,gBAAA,EACpCN,cAAc,CAACU,KAAK,EAAGN,UAAU,CAACM,KAAK,GAAAH,eAAA,CAAAD,gBAAA,EACvCN,cAAc,CAACS,IAAI,EAAGL,UAAU,CAACK,IAAI,GAAAF,eAAA,CAAAD,gBAAA,EACrCN,cAAc,CAACW,IAAI,EAAGP,UAAU,CAACO,IAAI,GAAAJ,eAAA,CAAAD,gBAAA,EACrCN,cAAc,CAACY,KAAK,EAAGR,UAAU,CAACQ,KAAK,GAAAN,gBAAA,CACzC;AACD,OAAO,SAASO,sBAAsBA,CAACC,aAAa,EAAEC,SAAS,EAAE;EAC/D,IAAIC,mBAAmB,GAAGd,qBAAqB,CAACY,aAAa,CAACG,kBAAkB,CAAC,CAACC,SAAS,CAAC,UAASV,GAAG,EAAE;IACxGO,SAAS,CAACI,MAAM,CAAChB,kBAAkB,CAACiB,iBAAiB,EAAE;MACrDC,YAAY,EAAE;QACZC,IAAI,EAAEvB,YAAY,CAAC,CAAC;QACpBwB,OAAO,EAAEf,GAAG,CAACe,OAAO;QACpBC,MAAM,EAAEvB,WAAW,CAACwB,OAAO;QAC3Bb,KAAK,EACHJ,GAAG,CAACkB,GAAG,KAAK1B,cAAc,CAACY,KAAK,GAC5B;UACEY,MAAM,EAAEvB,WAAW,CAACwB,OAAO;UAAE;UAC7BE,KAAK,EAAEnB,GAAG,CAACmB;QACb,CAAC,GACDC,SAAS;QACfC,MAAM,EAAExB,eAAe,CAACG,GAAG,CAACkB,GAAG;MACjC;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAO;IACLI,IAAI,EAAE,SAAAA,KAAA,EAAU;MACdd,mBAAmB,CAACe,WAAW,CAAC,CAAC;IACnC;EACF,CAAC;AACH"}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
var _STATUS_PRIORITIES;
|
|
2
|
-
|
|
3
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
|
|
2
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
5
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
5
6
|
import { includes, display, extend2Lev, ErrorSource, timeStampNow, LifeCycleEventType, isArray } from '@cloudcare/browser-core';
|
|
6
7
|
import { StatusType, HandlerType } from '../../logger';
|
|
7
8
|
export var STATUS_PRIORITIES = (_STATUS_PRIORITIES = {}, _defineProperty(_STATUS_PRIORITIES, StatusType.debug, 0), _defineProperty(_STATUS_PRIORITIES, StatusType.info, 1), _defineProperty(_STATUS_PRIORITIES, StatusType.warn, 2), _defineProperty(_STATUS_PRIORITIES, StatusType.error, 3), _STATUS_PRIORITIES);
|
|
8
9
|
export function startLoggerCollection(lifeCycle) {
|
|
9
10
|
function handleLog(logsMessage, logger, savedCommonContext, savedDate) {
|
|
10
11
|
var messageContext = logsMessage.context;
|
|
11
|
-
|
|
12
12
|
if (isAuthorized(logsMessage.status, HandlerType.console, logger)) {
|
|
13
13
|
display(logsMessage.status, logsMessage.message, extend2Lev(logger.getContext(), messageContext));
|
|
14
14
|
}
|
|
15
|
-
|
|
16
15
|
lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {
|
|
17
16
|
rawLogsEvent: {
|
|
18
17
|
date: savedDate || timeStampNow(),
|
|
@@ -25,7 +24,6 @@ export function startLoggerCollection(lifeCycle) {
|
|
|
25
24
|
logger: logger
|
|
26
25
|
});
|
|
27
26
|
}
|
|
28
|
-
|
|
29
27
|
return {
|
|
30
28
|
handleLog: handleLog
|
|
31
29
|
};
|
|
@@ -34,4 +32,5 @@ export function isAuthorized(status, handlerType, logger) {
|
|
|
34
32
|
var loggerHandler = logger.getHandler();
|
|
35
33
|
var sanitizedHandlerType = isArray(loggerHandler) ? loggerHandler : [loggerHandler];
|
|
36
34
|
return STATUS_PRIORITIES[status] >= STATUS_PRIORITIES[logger.getLevel()] && includes(sanitizedHandlerType, handlerType);
|
|
37
|
-
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=loggerCollection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loggerCollection.js","names":["includes","display","extend2Lev","ErrorSource","timeStampNow","LifeCycleEventType","isArray","StatusType","HandlerType","STATUS_PRIORITIES","_STATUS_PRIORITIES","_defineProperty","debug","info","warn","error","startLoggerCollection","lifeCycle","handleLog","logsMessage","logger","savedCommonContext","savedDate","messageContext","context","isAuthorized","status","console","message","getContext","notify","RAW_LOG_COLLECTED","rawLogsEvent","date","origin","LOGGER","handlerType","loggerHandler","getHandler","sanitizedHandlerType","getLevel"],"sources":["../../../../src/domain/logsCollection/logger/loggerCollection.js"],"sourcesContent":["import {\n includes,\n display,\n extend2Lev,\n ErrorSource,\n timeStampNow,\n LifeCycleEventType,\n isArray\n} from '@cloudcare/browser-core'\nimport { StatusType, HandlerType } from '../../logger'\n\nexport var STATUS_PRIORITIES = {\n [StatusType.debug]: 0,\n [StatusType.info]: 1,\n [StatusType.warn]: 2,\n [StatusType.error]: 3\n}\n\nexport function startLoggerCollection(lifeCycle) {\n function handleLog(logsMessage, logger, savedCommonContext, savedDate) {\n var messageContext = logsMessage.context\n if (isAuthorized(logsMessage.status, HandlerType.console, logger)) {\n display(\n logsMessage.status,\n logsMessage.message,\n extend2Lev(logger.getContext(), messageContext)\n )\n }\n lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {\n rawLogsEvent: {\n date: savedDate || timeStampNow(),\n message: logsMessage.message,\n status: logsMessage.status,\n origin: ErrorSource.LOGGER\n },\n messageContext: messageContext,\n savedCommonContext: savedCommonContext,\n logger: logger\n })\n }\n\n return {\n handleLog: handleLog\n }\n}\n\nexport function isAuthorized(status, handlerType, logger) {\n var loggerHandler = logger.getHandler()\n var sanitizedHandlerType = isArray(loggerHandler)\n ? loggerHandler\n : [loggerHandler]\n return (\n STATUS_PRIORITIES[status] >= STATUS_PRIORITIES[logger.getLevel()] &&\n includes(sanitizedHandlerType, handlerType)\n )\n}\n"],"mappings":";;;;;AAAA,SACEA,QAAQ,EACRC,OAAO,EACPC,UAAU,EACVC,WAAW,EACXC,YAAY,EACZC,kBAAkB,EAClBC,OAAO,QACF,yBAAyB;AAChC,SAASC,UAAU,EAAEC,WAAW,QAAQ,cAAc;AAEtD,OAAO,IAAIC,iBAAiB,IAAAC,kBAAA,OAAAC,eAAA,CAAAD,kBAAA,EACzBH,UAAU,CAACK,KAAK,EAAG,CAAC,GAAAD,eAAA,CAAAD,kBAAA,EACpBH,UAAU,CAACM,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AAiB,CAACiB,MAAM,CAAC,IAAIjB,iBAAiB,CAACW,MAAM,CAACoB,QAAQ,CAAC,CAAC,CAAC,IACjExC,QAAQ,CAACuC,oBAAoB,EAAEH,WAAW,CAAC;AAE/C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ErrorSource, initXhrObservable, RequestType, initFetchObservable, computeStackTrace, toStackTraceString, noop, each, LifeCycleEventType, getStatusGroup, urlParse, replaceNumberCharByPath, tryToClone, readBytesFromStream } from '@cloudcare/browser-core';
|
|
1
|
+
import { ErrorSource, initXhrObservable, RequestType, initFetchObservable, computeStackTrace, toStackTraceString, noop, each, LifeCycleEventType, getStatusGroup, urlParse, replaceNumberCharByPath, tryToClone, readBytesFromStream, monitor } from '@cloudcare/browser-core';
|
|
2
2
|
import { StatusType } from '../../logger';
|
|
3
3
|
export function startNetworkErrorCollection(configuration, lifeCycle) {
|
|
4
4
|
if (!configuration.forwardErrorsToLogs) {
|
|
@@ -6,7 +6,6 @@ export function startNetworkErrorCollection(configuration, lifeCycle) {
|
|
|
6
6
|
stop: noop
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
|
-
|
|
10
9
|
var xhrSubscription = initXhrObservable().subscribe(function (context) {
|
|
11
10
|
if (context.state === 'complete') {
|
|
12
11
|
handleCompleteRequest(RequestType.XHR, context);
|
|
@@ -17,7 +16,6 @@ export function startNetworkErrorCollection(configuration, lifeCycle) {
|
|
|
17
16
|
handleCompleteRequest(RequestType.FETCH, context);
|
|
18
17
|
}
|
|
19
18
|
});
|
|
20
|
-
|
|
21
19
|
function handleCompleteRequest(type, request) {
|
|
22
20
|
if (!configuration.isIntakeUrl(request.url) && (isRejected(request) || isServerError(request) || configuration.isServerError(request))) {
|
|
23
21
|
if ('xhr' in request) {
|
|
@@ -28,7 +26,6 @@ export function startNetworkErrorCollection(configuration, lifeCycle) {
|
|
|
28
26
|
computeFetchErrorText(request.error, configuration, onResponseDataAvailable);
|
|
29
27
|
}
|
|
30
28
|
}
|
|
31
|
-
|
|
32
29
|
function onResponseDataAvailable(responseData) {
|
|
33
30
|
var urlObj = urlParse(request.url).getParse();
|
|
34
31
|
lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {
|
|
@@ -56,19 +53,19 @@ export function startNetworkErrorCollection(configuration, lifeCycle) {
|
|
|
56
53
|
});
|
|
57
54
|
}
|
|
58
55
|
}
|
|
59
|
-
|
|
60
56
|
return {
|
|
61
57
|
stop: function stop() {
|
|
62
58
|
xhrSubscription.unsubscribe();
|
|
63
59
|
fetchSubscription.unsubscribe();
|
|
64
60
|
}
|
|
65
61
|
};
|
|
66
|
-
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// TODO: ideally, computeXhrResponseData should always call the callback with a string instead of
|
|
67
65
|
// `unknown`. But to keep backward compatibility, in the case of XHR with a `responseType` different
|
|
68
66
|
// than "text", the response data should be whatever `xhr.response` is. This is a bit confusing as
|
|
69
67
|
// Logs event 'stack' is expected to be a string. This should be changed in a future major version
|
|
70
68
|
// as it could be a breaking change.
|
|
71
|
-
|
|
72
69
|
export function computeXhrResponseData(xhr, configuration, callback) {
|
|
73
70
|
if (typeof xhr.response === 'string') {
|
|
74
71
|
callback(truncateResponseText(xhr.response, configuration));
|
|
@@ -81,7 +78,6 @@ export function computeFetchErrorText(error, configuration, callback) {
|
|
|
81
78
|
}
|
|
82
79
|
export function computeFetchResponseText(response, configuration, callback) {
|
|
83
80
|
var clonedResponse = tryToClone(response);
|
|
84
|
-
|
|
85
81
|
if (!clonedResponse || !clonedResponse.body) {
|
|
86
82
|
// if the clone failed or if the body is null, let's not try to read it.
|
|
87
83
|
callback();
|
|
@@ -113,11 +109,11 @@ export function computeFetchResponseText(response, configuration, callback) {
|
|
|
113
109
|
// }
|
|
114
110
|
// response.body.getReader().cancel()
|
|
115
111
|
// })
|
|
116
|
-
clonedResponse.text().then(function (text) {
|
|
112
|
+
clonedResponse.text().then(monitor(function (text) {
|
|
117
113
|
return callback(truncateResponseText(text, configuration));
|
|
118
|
-
}, function (error) {
|
|
114
|
+
}), monitor(function (error) {
|
|
119
115
|
return callback('Unable to retrieve response: ' + error);
|
|
120
|
-
});
|
|
116
|
+
}));
|
|
121
117
|
} else {
|
|
122
118
|
truncateResponseStream(clonedResponse.body, configuration.requestErrorResponseLengthLimit, function (error, responseText) {
|
|
123
119
|
if (error) {
|
|
@@ -128,46 +124,38 @@ export function computeFetchResponseText(response, configuration, callback) {
|
|
|
128
124
|
});
|
|
129
125
|
}
|
|
130
126
|
}
|
|
131
|
-
|
|
132
127
|
function isRejected(request) {
|
|
133
128
|
return request.status === 0 && request.responseType !== 'opaque';
|
|
134
129
|
}
|
|
135
|
-
|
|
136
130
|
function isServerError(request) {
|
|
137
131
|
return request.status >= 500;
|
|
138
132
|
}
|
|
139
|
-
|
|
140
133
|
function truncateResponseText(responseText, configuration) {
|
|
141
134
|
if (responseText.length > configuration.requestErrorResponseLengthLimit) {
|
|
142
135
|
return responseText.substring(0, configuration.requestErrorResponseLengthLimit) + '...';
|
|
143
136
|
}
|
|
144
|
-
|
|
145
137
|
return responseText;
|
|
146
138
|
}
|
|
147
|
-
|
|
148
139
|
function format(type) {
|
|
149
140
|
if (RequestType.XHR === type) {
|
|
150
141
|
return 'XHR';
|
|
151
142
|
}
|
|
152
|
-
|
|
153
143
|
return 'Fetch';
|
|
154
144
|
}
|
|
155
|
-
|
|
156
145
|
function truncateResponseStream(stream, bytesLimit, callback) {
|
|
157
146
|
readBytesFromStream(stream, function (error, bytes, limitExceeded) {
|
|
158
147
|
if (error) {
|
|
159
148
|
callback(error);
|
|
160
149
|
} else {
|
|
161
150
|
var responseText = new TextDecoder().decode(bytes);
|
|
162
|
-
|
|
163
151
|
if (limitExceeded) {
|
|
164
152
|
responseText += '...';
|
|
165
153
|
}
|
|
166
|
-
|
|
167
154
|
callback(undefined, responseText);
|
|
168
155
|
}
|
|
169
156
|
}, {
|
|
170
157
|
bytesLimit: bytesLimit,
|
|
171
158
|
collectStreamBody: true
|
|
172
159
|
});
|
|
173
|
-
}
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=networkErrorCollection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"networkErrorCollection.js","names":["ErrorSource","initXhrObservable","RequestType","initFetchObservable","computeStackTrace","toStackTraceString","noop","each","LifeCycleEventType","getStatusGroup","urlParse","replaceNumberCharByPath","tryToClone","readBytesFromStream","monitor","StatusType","startNetworkErrorCollection","configuration","lifeCycle","forwardErrorsToLogs","stop","xhrSubscription","subscribe","context","state","handleCompleteRequest","XHR","fetchSubscription","FETCH","type","request","isIntakeUrl","url","isRejected","isServerError","computeXhrResponseData","xhr","onResponseDataAvailable","response","computeFetchResponseText","error","computeFetchErrorText","responseData","urlObj","getParse","notify","RAW_LOG_COLLECTED","rawLogsEvent","message","format","method","date","startClocks","timeStamp","origin","NETWORK","stack","http","status_code","status","statusGroup","urlHost","Host","urlPath","Path","urlPathGroup","unsubscribe","callback","truncateResponseText","clonedResponse","body","window","TextDecoder","text","then","truncateResponseStream","requestErrorResponseLengthLimit","responseText","responseType","length","substring","stream","bytesLimit","bytes","limitExceeded","decode","undefined","collectStreamBody"],"sources":["../../../../src/domain/logsCollection/networkError/networkErrorCollection.js"],"sourcesContent":["import {\n ErrorSource,\n initXhrObservable,\n RequestType,\n initFetchObservable,\n computeStackTrace,\n toStackTraceString,\n noop,\n each,\n LifeCycleEventType,\n getStatusGroup,\n urlParse,\n replaceNumberCharByPath,\n tryToClone,\n readBytesFromStream,\n monitor\n} from '@cloudcare/browser-core'\nimport { StatusType } from '../../logger'\n\nexport function startNetworkErrorCollection(configuration, lifeCycle) {\n if (!configuration.forwardErrorsToLogs) {\n return { stop: noop }\n }\n\n var xhrSubscription = initXhrObservable().subscribe(function (context) {\n if (context.state === 'complete') {\n handleCompleteRequest(RequestType.XHR, context)\n }\n })\n var fetchSubscription = initFetchObservable().subscribe(function (context) {\n if (context.state === 'resolve') {\n handleCompleteRequest(RequestType.FETCH, context)\n }\n })\n\n function handleCompleteRequest(type, request) {\n if (\n !configuration.isIntakeUrl(request.url) &&\n (isRejected(request) ||\n isServerError(request) ||\n configuration.isServerError(request))\n ) {\n if ('xhr' in request) {\n computeXhrResponseData(\n request.xhr,\n configuration,\n onResponseDataAvailable\n )\n } else if (request.response) {\n computeFetchResponseText(\n request.response,\n configuration,\n onResponseDataAvailable\n )\n } else if (request.error) {\n computeFetchErrorText(\n request.error,\n configuration,\n onResponseDataAvailable\n )\n }\n }\n\n function onResponseDataAvailable(responseData) {\n var urlObj = urlParse(request.url).getParse()\n lifeCycle.notify(LifeCycleEventType.RAW_LOG_COLLECTED, {\n rawLogsEvent: {\n message:\n format(type) + ' error ' + request.method + ' ' + request.url,\n date: request.startClocks.timeStamp,\n error: {\n origin: ErrorSource.NETWORK, // Todo: Remove in the next major release\n stack: responseData || 'Failed to load'\n },\n http: {\n method: request.method, // Cast resource method because of case mismatch cf issue RUMF-1152\n status_code: request.status,\n url: request.url,\n statusGroup: getStatusGroup(request.status),\n urlHost: urlObj.Host,\n urlPath: urlObj.Path,\n urlPathGroup: replaceNumberCharByPath(urlObj.Path)\n },\n status: StatusType.error,\n origin: ErrorSource.NETWORK\n }\n })\n }\n }\n\n return {\n stop: function () {\n xhrSubscription.unsubscribe()\n fetchSubscription.unsubscribe()\n }\n }\n}\n\n// TODO: ideally, computeXhrResponseData should always call the callback with a string instead of\n// `unknown`. But to keep backward compatibility, in the case of XHR with a `responseType` different\n// than \"text\", the response data should be whatever `xhr.response` is. This is a bit confusing as\n// Logs event 'stack' is expected to be a string. This should be changed in a future major version\n// as it could be a breaking change.\nexport function computeXhrResponseData(xhr, configuration, callback) {\n if (typeof xhr.response === 'string') {\n callback(truncateResponseText(xhr.response, configuration))\n } else {\n callback(xhr.response)\n }\n}\n\nexport function computeFetchErrorText(error, configuration, callback) {\n callback(\n truncateResponseText(\n toStackTraceString(computeStackTrace(error)),\n configuration\n )\n )\n}\n\nexport function computeFetchResponseText(response, configuration, callback) {\n var clonedResponse = tryToClone(response)\n if (!clonedResponse || !clonedResponse.body) {\n // if the clone failed or if the body is null, let's not try to read it.\n callback()\n } else if (!window.TextDecoder) {\n // If the browser doesn't support TextDecoder, let's read the whole response then truncate it.\n //\n // This should only be the case on early versions of Edge (before they migrated to Chromium).\n // Even if it could be possible to implement a workaround for the missing TextDecoder API (using\n // a Blob and FileReader), we found another issue preventing us from reading only the first\n // bytes from the response: contrary to other browsers, when reading from the cloned response,\n // if the original response gets canceled, the cloned response is also canceled and we can't\n // know about it. In the following illustration, the promise returned by `reader.read()` may\n // never be fulfilled:\n //\n // fetch('/').then((response) => {\n // const reader = response.clone().body.getReader()\n // readMore()\n // function readMore() {\n // reader.read().then(\n // (result) => {\n // if (result.done) {\n // console.log('done')\n // } else {\n // readMore()\n // }\n // },\n // () => console.log('error')\n // )\n // }\n // response.body.getReader().cancel()\n // })\n clonedResponse.text().then(\n monitor(function (text) {\n return callback(truncateResponseText(text, configuration))\n }),\n monitor(function (error) {\n return callback('Unable to retrieve response: ' + error)\n })\n )\n } else {\n truncateResponseStream(\n clonedResponse.body,\n configuration.requestErrorResponseLengthLimit,\n function (error, responseText) {\n if (error) {\n callback('Unable to retrieve response: ' + error)\n } else {\n callback(responseText)\n }\n }\n )\n }\n}\n\nfunction isRejected(request) {\n return request.status === 0 && request.responseType !== 'opaque'\n}\n\nfunction isServerError(request) {\n return request.status >= 500\n}\n\nfunction truncateResponseText(responseText, configuration) {\n if (responseText.length > configuration.requestErrorResponseLengthLimit) {\n return (\n responseText.substring(0, configuration.requestErrorResponseLengthLimit) +\n '...'\n )\n }\n return responseText\n}\n\nfunction format(type) {\n if (RequestType.XHR === type) {\n return 'XHR'\n }\n return 'Fetch'\n}\n\nfunction truncateResponseStream(stream, bytesLimit, callback) {\n readBytesFromStream(\n stream,\n function (error, bytes, limitExceeded) {\n if (error) {\n callback(error)\n } else {\n var responseText = new TextDecoder().decode(bytes)\n if (limitExceeded) {\n responseText += '...'\n }\n callback(undefined, responseText)\n }\n },\n {\n bytesLimit: bytesLimit,\n collectStreamBody: true\n }\n )\n}\n"],"mappings":"AAAA,SACEA,WAAW,EACXC,iBAAiB,EACjBC,WAAW,EACXC,mBAAmB,EACnBC,iBAAiB,EACjBC,kBAAkB,EAClBC,IAAI,EACJC,IAAI,EACJC,kBAAkB,EAClBC,cAAc,EACdC,QAAQ,EACRC,uBAAuB,EACvBC,UAAU,EACVC,mBAAmB,EACnBC,OAAO,QACF,yBAAyB;AAChC,SAASC,UAAU,QAAQ,cAAc;AAEzC,OAAO,SAASC,2BAA2BA,CAACC,aAAa,EAAEC,SAAS,EAAE;EACpE,IAAI,CAACD,aAAa,CAACE,mBAAmB,EAAE;IACtC,OAAO;MAAEC,IAAI,EAAEd;IAAK,CAAC;EACvB;EAEA,IAAIe,eAAe,GAAGpB,iBAAiB,CAAC,CAAC,CAACqB,SAAS,CAAC,UAAUC,OAAO,EAAE;IACrE,IAAIA,OAAO,CAACC,KAAK,KAAK,UAAU,EAAE;MAChCC,qBAAqB,CAACvB,WAAW,CAACwB,GAAG,EAAEH,OAAO,CAAC;IACjD;EACF,CAAC,CAAC;EACF,IAAII,iBAAiB,GAAGxB,mBAAmB,CAAC,CAAC,CAACmB,SAAS,CAAC,UAAUC,OAAO,EAAE;IACzE,IAAIA,OAAO,CAACC,KAAK,KAAK,SAAS,EAAE;MAC/BC,qBAAqB,CAACvB,WAAW,CAAC0B,KAAK,EAAEL,OAAO,CAAC;IACnD;EACF,CAAC,CAAC;EAEF,SAASE,qBAAqBA,CAACI,IAAI,EAAEC,OAAO,EAAE;IAC5C,IACE,CAACb,aAAa,CAACc,WAAW,CAACD,OAAO,CAACE,GAAG,CAAC,KACtCC,UAAU,CAACH,OAAO,CAAC,IAClBI,aAAa,CAACJ,OAAO,CAAC,IACtBb,aAAa,CAACiB,aAAa,CAACJ,OAAO,CAAC,CAAC,EACvC;MACA,IAAI,KAAK,IAAIA,OAAO,EAAE;QACpBK,sBAAs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