@posthog/browser-common 0.9.2 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +4 -2
- package/dist/config.js +1 -1
- package/dist/config.mjs +1 -1
- package/dist/console-logs.d.ts +15 -0
- package/dist/console-logs.js +317 -0
- package/dist/console-logs.mjs +276 -0
- package/dist/constants.d.ts +16 -0
- package/dist/constants.js +64 -0
- package/dist/constants.mjs +17 -1
- package/dist/extension-tokens.d.ts +4 -0
- package/dist/extension-tokens.js +40 -0
- package/dist/extension-tokens.mjs +2 -0
- package/dist/extension.d.ts +4 -0
- package/dist/feature-flags-config.d.ts +23 -0
- package/dist/feature-flags-config.js +18 -0
- package/dist/feature-flags-config.mjs +1 -0
- package/dist/feature-flags.d.ts +329 -0
- package/dist/feature-flags.js +1222 -0
- package/dist/feature-flags.mjs +1172 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +15 -7
- package/dist/index.mjs +1 -0
- package/dist/logs-config.d.ts +24 -0
- package/dist/logs-config.js +80 -0
- package/dist/logs-config.mjs +42 -0
- package/dist/logs-types.d.ts +31 -0
- package/dist/logs-types.js +46 -0
- package/dist/logs-types.mjs +8 -0
- package/dist/logs.d.ts +85 -0
- package/dist/logs.js +469 -0
- package/dist/logs.mjs +428 -0
- package/dist/token.d.ts +1 -1
- package/dist/types/feature-flags.d.ts +18 -0
- package/dist/types/feature-flags.js +18 -0
- package/dist/types/feature-flags.mjs +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +7 -0
- package/dist/types/index.mjs +1 -0
- package/dist/utils/console-original.d.ts +6 -0
- package/dist/utils/console-original.js +43 -0
- package/dist/utils/console-original.mjs +5 -0
- package/dist/utils/event-utils.d.ts +1 -1
- package/dist/utils/event-utils.js +3 -9
- package/dist/utils/event-utils.mjs +1 -7
- package/dist/utils/logger.js +8 -3
- package/dist/utils/logger.mjs +8 -3
- package/dist/utils/patch.d.ts +3 -0
- package/dist/utils/patch.js +90 -0
- package/dist/utils/patch.mjs +52 -0
- package/dist/utils/request-reachability.d.ts +2 -0
- package/dist/utils/request-reachability.js +61 -0
- package/dist/utils/request-reachability.mjs +20 -0
- package/dist/utils/request-utils.d.ts +1 -2
- package/dist/utils/request-utils.js +3 -14
- package/dist/utils/request-utils.mjs +3 -14
- package/dist/utils/sanitize-url.d.ts +11 -0
- package/dist/utils/sanitize-url.js +55 -0
- package/dist/utils/sanitize-url.mjs +17 -0
- package/dist/utils/timezone.d.ts +1 -0
- package/dist/utils/timezone.js +46 -0
- package/dist/utils/timezone.mjs +8 -0
- package/package.json +59 -3
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export type { Extension } from './extension';
|
|
6
6
|
export type { ExtensionToken } from './token';
|
|
7
|
+
export { FeatureFlagsCommonExtension } from './extension-tokens';
|
|
7
8
|
export * from './types';
|
|
8
9
|
export { createDisposable, type Disposable } from './disposable';
|
|
9
10
|
export type { Listener } from './pubsub';
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,9 @@ var __webpack_modules__ = {
|
|
|
3
3
|
"./disposable" (module) {
|
|
4
4
|
module.exports = require("./disposable.js");
|
|
5
5
|
},
|
|
6
|
+
"./extension-tokens" (module) {
|
|
7
|
+
module.exports = require("./extension-tokens.js");
|
|
8
|
+
},
|
|
6
9
|
"./pubsub" (module) {
|
|
7
10
|
module.exports = require("./pubsub.js");
|
|
8
11
|
},
|
|
@@ -57,24 +60,29 @@ function __webpack_require__(moduleId) {
|
|
|
57
60
|
var __webpack_exports__ = {};
|
|
58
61
|
(()=>{
|
|
59
62
|
__webpack_require__.r(__webpack_exports__);
|
|
60
|
-
var
|
|
63
|
+
var _extension_tokens__rspack_import_0 = __webpack_require__("./extension-tokens");
|
|
64
|
+
var _types__rspack_import_1 = __webpack_require__("./types");
|
|
61
65
|
var __rspack_reexport = {};
|
|
62
|
-
for(const __rspack_import_key in
|
|
66
|
+
for(const __rspack_import_key in _types__rspack_import_1)if ([
|
|
63
67
|
"Publisher",
|
|
64
68
|
"createDisposable",
|
|
69
|
+
"FeatureFlagsCommonExtension",
|
|
65
70
|
"default"
|
|
66
|
-
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>
|
|
71
|
+
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_types__rspack_import_1[__rspack_import_key];
|
|
67
72
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
68
|
-
var
|
|
69
|
-
var
|
|
73
|
+
var _disposable__rspack_import_2 = __webpack_require__("./disposable");
|
|
74
|
+
var _pubsub__rspack_import_3 = __webpack_require__("./pubsub");
|
|
70
75
|
__webpack_require__.d(__webpack_exports__, {
|
|
71
|
-
|
|
72
|
-
|
|
76
|
+
FeatureFlagsCommonExtension: ()=>_extension_tokens__rspack_import_0.FeatureFlagsCommonExtension,
|
|
77
|
+
Publisher: ()=>_pubsub__rspack_import_3.Publisher,
|
|
78
|
+
createDisposable: ()=>_disposable__rspack_import_2.createDisposable
|
|
73
79
|
});
|
|
74
80
|
})();
|
|
81
|
+
exports.FeatureFlagsCommonExtension = __webpack_exports__.FeatureFlagsCommonExtension;
|
|
75
82
|
exports.Publisher = __webpack_exports__.Publisher;
|
|
76
83
|
exports.createDisposable = __webpack_exports__.createDisposable;
|
|
77
84
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
85
|
+
"FeatureFlagsCommonExtension",
|
|
78
86
|
"Publisher",
|
|
79
87
|
"createDisposable"
|
|
80
88
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
package/dist/index.mjs
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { LogCaptureOptions } from '@posthog/types';
|
|
2
|
+
import type { ResolvedPostHogLogsConfig } from '@posthog/core';
|
|
3
|
+
export interface BrowserLogsConfig extends LogCaptureOptions {
|
|
4
|
+
captureConsoleLogs?: boolean;
|
|
5
|
+
}
|
|
6
|
+
/** SDK configuration mapping; values are read again when configuration changes. */
|
|
7
|
+
export interface LogsConfigSource {
|
|
8
|
+
get(): BrowserLogsConfig | undefined;
|
|
9
|
+
readonly captureHintKey: string;
|
|
10
|
+
readonly remoteConfigWillArrive: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Resolves the public `logs` config into the shape core `PostHogLogs` consumes.
|
|
14
|
+
*
|
|
15
|
+
* `serviceNameDefault` is the console instance's `service.name` fallback
|
|
16
|
+
* (`posthog-browser-logs`); the programmatic instance falls back to core's
|
|
17
|
+
* `unknown_service`. `consoleCapture` disables the per-interval rate cap entirely
|
|
18
|
+
* (even when the user set `maxLogsPerInterval`), so console capture is never
|
|
19
|
+
* rate-dropped — the deep buffer is its only bound.
|
|
20
|
+
*/
|
|
21
|
+
export declare function resolveLogsConfig(config: LogCaptureOptions | undefined, opts?: {
|
|
22
|
+
serviceNameDefault?: string;
|
|
23
|
+
consoleCapture?: boolean;
|
|
24
|
+
}): ResolvedPostHogLogsConfig;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
resolveLogsConfig: ()=>resolveLogsConfig
|
|
32
|
+
});
|
|
33
|
+
const core_namespaceObject = require("@posthog/core");
|
|
34
|
+
const DEFAULT_FLUSH_INTERVAL_MS = 3000;
|
|
35
|
+
const DEFAULT_MAX_BUFFER_SIZE = 100;
|
|
36
|
+
const DEFAULT_MAX_LOGS_PER_INTERVAL = 1000;
|
|
37
|
+
const DEFAULT_CONSOLE_MAX_QUEUE_SIZE = 2048;
|
|
38
|
+
const DEFAULT_MAX_BATCH_RECORDS_PER_POST = 100;
|
|
39
|
+
function defaultResourceAttributes() {
|
|
40
|
+
let osName = '';
|
|
41
|
+
let osVersion = '';
|
|
42
|
+
try {
|
|
43
|
+
const browserGlobal = "u" > typeof globalThis ? globalThis : "u" > typeof window ? window : void 0;
|
|
44
|
+
const userAgent = browserGlobal?.navigator?.userAgent;
|
|
45
|
+
if (userAgent) [osName, osVersion] = (0, core_namespaceObject.detectOS)(userAgent);
|
|
46
|
+
} catch {}
|
|
47
|
+
return (0, core_namespaceObject.osResourceAttributes)(osName, osVersion);
|
|
48
|
+
}
|
|
49
|
+
function resolveLogsConfig(config, opts) {
|
|
50
|
+
const flushIntervalMs = config?.flushIntervalMs ?? DEFAULT_FLUSH_INTERVAL_MS;
|
|
51
|
+
const maxBufferSize = config?.maxBufferSize ?? DEFAULT_MAX_BUFFER_SIZE;
|
|
52
|
+
const maxLogsPerInterval = opts?.consoleCapture ? void 0 : config?.maxLogsPerInterval ?? DEFAULT_MAX_LOGS_PER_INTERVAL;
|
|
53
|
+
const maxQueueSize = (0, core_namespaceObject.isUndefined)(maxLogsPerInterval) ? Math.max(maxBufferSize, DEFAULT_CONSOLE_MAX_QUEUE_SIZE) : Math.max(maxBufferSize, maxLogsPerInterval);
|
|
54
|
+
const resourceAttributes = {
|
|
55
|
+
...defaultResourceAttributes(),
|
|
56
|
+
...config?.resourceAttributes
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
serviceName: resourceAttributes?.['service.name'] ?? config?.serviceName ?? opts?.serviceNameDefault,
|
|
60
|
+
serviceVersion: resourceAttributes?.['service.version'] ?? config?.serviceVersion,
|
|
61
|
+
environment: resourceAttributes?.['deployment.environment'] ?? config?.environment,
|
|
62
|
+
resourceAttributes,
|
|
63
|
+
beforeSend: config?.beforeSend,
|
|
64
|
+
flushIntervalMs,
|
|
65
|
+
maxBufferSize,
|
|
66
|
+
maxQueueSize,
|
|
67
|
+
maxBatchRecordsPerPost: DEFAULT_MAX_BATCH_RECORDS_PER_POST,
|
|
68
|
+
rateCapWindowMs: flushIntervalMs,
|
|
69
|
+
maxLogsPerInterval,
|
|
70
|
+
backgroundFlushBudgetMs: 0,
|
|
71
|
+
terminationFlushBudgetMs: 0
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
exports.resolveLogsConfig = __webpack_exports__.resolveLogsConfig;
|
|
75
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
76
|
+
"resolveLogsConfig"
|
|
77
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
78
|
+
Object.defineProperty(exports, '__esModule', {
|
|
79
|
+
value: true
|
|
80
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { detectOS, isUndefined, osResourceAttributes } from "@posthog/core";
|
|
2
|
+
const DEFAULT_FLUSH_INTERVAL_MS = 3000;
|
|
3
|
+
const DEFAULT_MAX_BUFFER_SIZE = 100;
|
|
4
|
+
const DEFAULT_MAX_LOGS_PER_INTERVAL = 1000;
|
|
5
|
+
const DEFAULT_CONSOLE_MAX_QUEUE_SIZE = 2048;
|
|
6
|
+
const DEFAULT_MAX_BATCH_RECORDS_PER_POST = 100;
|
|
7
|
+
function defaultResourceAttributes() {
|
|
8
|
+
let osName = '';
|
|
9
|
+
let osVersion = '';
|
|
10
|
+
try {
|
|
11
|
+
const browserGlobal = "u" > typeof globalThis ? globalThis : "u" > typeof window ? window : void 0;
|
|
12
|
+
const userAgent = browserGlobal?.navigator?.userAgent;
|
|
13
|
+
if (userAgent) [osName, osVersion] = detectOS(userAgent);
|
|
14
|
+
} catch {}
|
|
15
|
+
return osResourceAttributes(osName, osVersion);
|
|
16
|
+
}
|
|
17
|
+
function resolveLogsConfig(config, opts) {
|
|
18
|
+
const flushIntervalMs = config?.flushIntervalMs ?? DEFAULT_FLUSH_INTERVAL_MS;
|
|
19
|
+
const maxBufferSize = config?.maxBufferSize ?? DEFAULT_MAX_BUFFER_SIZE;
|
|
20
|
+
const maxLogsPerInterval = opts?.consoleCapture ? void 0 : config?.maxLogsPerInterval ?? DEFAULT_MAX_LOGS_PER_INTERVAL;
|
|
21
|
+
const maxQueueSize = isUndefined(maxLogsPerInterval) ? Math.max(maxBufferSize, DEFAULT_CONSOLE_MAX_QUEUE_SIZE) : Math.max(maxBufferSize, maxLogsPerInterval);
|
|
22
|
+
const resourceAttributes = {
|
|
23
|
+
...defaultResourceAttributes(),
|
|
24
|
+
...config?.resourceAttributes
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
serviceName: resourceAttributes?.['service.name'] ?? config?.serviceName ?? opts?.serviceNameDefault,
|
|
28
|
+
serviceVersion: resourceAttributes?.['service.version'] ?? config?.serviceVersion,
|
|
29
|
+
environment: resourceAttributes?.['deployment.environment'] ?? config?.environment,
|
|
30
|
+
resourceAttributes,
|
|
31
|
+
beforeSend: config?.beforeSend,
|
|
32
|
+
flushIntervalMs,
|
|
33
|
+
maxBufferSize,
|
|
34
|
+
maxQueueSize,
|
|
35
|
+
maxBatchRecordsPerPost: DEFAULT_MAX_BATCH_RECORDS_PER_POST,
|
|
36
|
+
rateCapWindowMs: flushIntervalMs,
|
|
37
|
+
maxLogsPerInterval,
|
|
38
|
+
backgroundFlushBudgetMs: 0,
|
|
39
|
+
terminationFlushBudgetMs: 0
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export { resolveLogsConfig };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Client } from './client';
|
|
2
|
+
import type { LogSdkContext } from '@posthog/core';
|
|
3
|
+
/**
|
|
4
|
+
* The console methods both bundles agree on: the main bundle records these, the
|
|
5
|
+
* entrypoint maps and serializes them. Deriving both sides from this tuple makes
|
|
6
|
+
* a missing level a compile error rather than a silently unbuffered one.
|
|
7
|
+
*/
|
|
8
|
+
export declare const BUFFERED_CONSOLE_LEVELS: readonly ['debug', 'log', 'warn', 'error', 'info'];
|
|
9
|
+
export type BufferedConsoleLevel = (typeof BUFFERED_CONSOLE_LEVELS)[number];
|
|
10
|
+
/**
|
|
11
|
+
* A `console.*` call the main bundle recorded before the logs entrypoint was available.
|
|
12
|
+
*
|
|
13
|
+
* `args` stay raw so the entrypoint's `stringifyArgsSafely` is the single serializer.
|
|
14
|
+
* They are also held by reference: an object mutated between the console call and the
|
|
15
|
+
* replay is serialized in its later state, unlike the live path which serializes inline.
|
|
16
|
+
*
|
|
17
|
+
* `context` and `occurredAtMs` are snapshotted at the console call, because identity,
|
|
18
|
+
* session and feature flags can all change before the replay.
|
|
19
|
+
*/
|
|
20
|
+
export interface BufferedConsoleEntry {
|
|
21
|
+
level: BufferedConsoleLevel;
|
|
22
|
+
args: any[];
|
|
23
|
+
occurredAtMs: number;
|
|
24
|
+
context: LogSdkContext;
|
|
25
|
+
}
|
|
26
|
+
export interface ConsoleLogsCapture {
|
|
27
|
+
initialize(client: Client): (() => void) | undefined;
|
|
28
|
+
replay(client: Client, entries: BufferedConsoleEntry[]): void;
|
|
29
|
+
}
|
|
30
|
+
/** A loader may report its result synchronously. */
|
|
31
|
+
export type ConsoleLogsLoader = (callback: (error: unknown, capture?: ConsoleLogsCapture) => void) => void;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
const BUFFERED_CONSOLE_LEVELS = [
|
|
31
|
+
'debug',
|
|
32
|
+
'log',
|
|
33
|
+
'warn',
|
|
34
|
+
'error',
|
|
35
|
+
'info'
|
|
36
|
+
];
|
|
37
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
38
|
+
BUFFERED_CONSOLE_LEVELS: BUFFERED_CONSOLE_LEVELS
|
|
39
|
+
});
|
|
40
|
+
exports.BUFFERED_CONSOLE_LEVELS = __webpack_exports__.BUFFERED_CONSOLE_LEVELS;
|
|
41
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
42
|
+
"BUFFERED_CONSOLE_LEVELS"
|
|
43
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
44
|
+
Object.defineProperty(exports, '__esModule', {
|
|
45
|
+
value: true
|
|
46
|
+
});
|
package/dist/logs.d.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { CaptureLogOptions, Logger } from '@posthog/types';
|
|
2
|
+
import type { RemoteConfigResult } from './types/remote-config';
|
|
3
|
+
import type { LogSdkContext } from '@posthog/core';
|
|
4
|
+
import type { Client, DeepReadonly } from './client';
|
|
5
|
+
import type { Extension } from './extension';
|
|
6
|
+
import type { ConsoleLogsLoader } from './logs-types';
|
|
7
|
+
import { type LogsConfigSource } from './logs-config';
|
|
8
|
+
export declare const RECORDER_MAX_AGE_MS = 30000;
|
|
9
|
+
export declare class PostHogLogs implements Extension {
|
|
10
|
+
private readonly _configSource;
|
|
11
|
+
/** Reads host SDK metadata at capture time, including while console calls are buffered. */
|
|
12
|
+
private readonly _getSdkContext;
|
|
13
|
+
readonly name: string;
|
|
14
|
+
private _isLogsEnabled;
|
|
15
|
+
private _isLoaded;
|
|
16
|
+
private _isLoading;
|
|
17
|
+
private _logger;
|
|
18
|
+
private get _coreLogger();
|
|
19
|
+
private _queue;
|
|
20
|
+
private _core;
|
|
21
|
+
private _resolvedConfig;
|
|
22
|
+
private _resolvedFrom;
|
|
23
|
+
private _capture_logger;
|
|
24
|
+
private _consoleQueue;
|
|
25
|
+
private _consoleCore;
|
|
26
|
+
private _consoleLogsDispose;
|
|
27
|
+
private _consoleResolvedConfig;
|
|
28
|
+
private _consoleResolvedFrom;
|
|
29
|
+
private _consecutiveStatusZeroFailures;
|
|
30
|
+
private _client;
|
|
31
|
+
private _setupStarted;
|
|
32
|
+
private _remoteConfigSubscription;
|
|
33
|
+
private _disposed;
|
|
34
|
+
private _consoleBuffer;
|
|
35
|
+
private _consoleRecorderUnpatchers;
|
|
36
|
+
private _isRecordingConsole;
|
|
37
|
+
private _consoleRecorderTimeout;
|
|
38
|
+
private _isRecordingConsoleEntry;
|
|
39
|
+
private _window;
|
|
40
|
+
private _listeningForReconnect;
|
|
41
|
+
constructor(_configSource: LogsConfigSource,
|
|
42
|
+
/** Reads host SDK metadata at capture time, including while console calls are buffered. */
|
|
43
|
+
_getSdkContext: () => LogSdkContext);
|
|
44
|
+
protected get _isRequestReady(): boolean;
|
|
45
|
+
protected _getConsoleLoader(): ConsoleLogsLoader | undefined;
|
|
46
|
+
protected _listenForReconnect(): void;
|
|
47
|
+
private _onReconnect;
|
|
48
|
+
private _buildCore;
|
|
49
|
+
private _getCore;
|
|
50
|
+
private _getConsoleCore;
|
|
51
|
+
setup(client: Client): void | Promise<void>;
|
|
52
|
+
private _finishSetup;
|
|
53
|
+
dispose(): void;
|
|
54
|
+
onRemoteConfig(result: DeepReadonly<RemoteConfigResult>): void;
|
|
55
|
+
reset(): void;
|
|
56
|
+
captureLog(options: CaptureLogOptions): void;
|
|
57
|
+
/** @internal */
|
|
58
|
+
captureConsoleLog(options: CaptureLogOptions): void;
|
|
59
|
+
/** @internal */
|
|
60
|
+
captureBufferedConsoleLog(options: CaptureLogOptions, context: LogSdkContext, occurredAtMs: number): void;
|
|
61
|
+
/**
|
|
62
|
+
* Releases everything console capture is holding when capturing is turned off: the
|
|
63
|
+
* pre-load buffer, the `console` patches, and console records already queued — at
|
|
64
|
+
* that moment rather than whenever the page next writes to the console.
|
|
65
|
+
*
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
_onOptOut(): void;
|
|
69
|
+
private _stopRecorderStartedByPersistedHint;
|
|
70
|
+
private _startConsoleRecorder;
|
|
71
|
+
private _recordConsoleEntry;
|
|
72
|
+
private _stopConsoleRecorder;
|
|
73
|
+
private _takeConsoleBuffer;
|
|
74
|
+
get logger(): Logger;
|
|
75
|
+
flushLogs(transport?: 'XHR' | 'fetch' | 'sendBeacon'): void;
|
|
76
|
+
/** Await both product queues without changing the legacy fire-and-forget flush API. */
|
|
77
|
+
flush(): Promise<void>;
|
|
78
|
+
private _logFlushError;
|
|
79
|
+
loadIfEnabled(): void;
|
|
80
|
+
private _createHost;
|
|
81
|
+
private _sendLogsBatch;
|
|
82
|
+
private _trackEndpointReachability;
|
|
83
|
+
private _flushViaTransport;
|
|
84
|
+
private _drainQueueViaTransport;
|
|
85
|
+
}
|