@workleap/logrocket 1.0.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @workleap/logrocket
2
2
 
3
+ ## 1.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#54](https://github.com/workleap/wl-telemetry/pull/54) [`79ce028`](https://github.com/workleap/wl-telemetry/commit/79ce028f2418cc43ed18017e82ce9599e97d0e40) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Added support for line change segments to the LogRocket logger.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`79ce028`](https://github.com/workleap/wl-telemetry/commit/79ce028f2418cc43ed18017e82ce9599e97d0e40)]:
12
+ - @workleap/telemetry@1.1.1
13
+
14
+ ## 1.1.0
15
+
16
+ ### Minor Changes
17
+
18
+ - [#52](https://github.com/workleap/wl-telemetry/pull/52) [`4affd67`](https://github.com/workleap/wl-telemetry/commit/4affd670d7c5c0495eb41a700e6fe9af1f9f4e0f) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Added a `loggers` option and removed the peerDependency to `@workleap/telemetry`.
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [[`4affd67`](https://github.com/workleap/wl-telemetry/commit/4affd670d7c5c0495eb41a700e6fe9af1f9f4e0f)]:
23
+ - @workleap/telemetry@1.1.0
24
+
3
25
  ## 1.0.1
4
26
 
5
27
  ### Patch Changes
@@ -0,0 +1,118 @@
1
+ import { type Logger, type LoggerOptions, type LoggerScope, type LoggerScopeEndOptions, LogLevel, type LogOptions } from "@workleap/logging";
2
+ /**
3
+ * An scope implementation for the LogRocket logger.
4
+ * @see {@link https://workleap.github.io/wl-telemetry}
5
+ */
6
+ export declare class LogRocketLoggerScope implements LoggerScope {
7
+ #private;
8
+ /**
9
+ * @see {@link https://workleap.github.io/wl-logging}
10
+ */
11
+ constructor(label: string, logLevel: LogLevel);
12
+ /**
13
+ * @see {@link https://workleap.github.io/wl-logging}
14
+ */
15
+ withText(text: string, options?: LogOptions): this;
16
+ /**
17
+ * @see {@link https://workleap.github.io/wl-logging}
18
+ */
19
+ withError(error: Error): this;
20
+ /**
21
+ * @see {@link https://workleap.github.io/wl-logging}
22
+ */
23
+ withObject(obj: object): this;
24
+ /**
25
+ * @see {@link https://workleap.github.io/wl-logging}
26
+ */
27
+ withLineChange(): this;
28
+ /**
29
+ * Write a debug log. The log will be processed only if the logger LogLevel is >= debug.
30
+ * @see {@link https://workleap.github.io/wl-logging}
31
+ */
32
+ debug(log?: string, options?: LogOptions): void;
33
+ /**
34
+ * Write an information log. The log will be processed only if the logger LogLevel is >= information.
35
+ * @see {@link https://workleap.github.io/wl-logging}
36
+ */
37
+ information(log?: string, options?: LogOptions): void;
38
+ /**
39
+ * Write a warning log. The log will be processed only if the logger LogLevel is >= warning.
40
+ * @see {@link https://workleap.github.io/wl-logging}
41
+ */
42
+ warning(log?: string, options?: LogOptions): void;
43
+ /**
44
+ * Write an error log. The log will be processed only if the logger LogLevel is >= error.
45
+ * @see {@link https://workleap.github.io/wl-logging}
46
+ */
47
+ error(log?: string, options?: LogOptions): void;
48
+ /**
49
+ * Write a critical log. The log will be processed only if the logger LogLevel is >= critical.
50
+ * @see {@link https://workleap.github.io/wl-logging}
51
+ */
52
+ critical(log?: string, options?: LogOptions): void;
53
+ /**
54
+ * @see {@link https://workleap.github.io/wl-logging}
55
+ */
56
+ end(options?: LoggerScopeEndOptions): void;
57
+ }
58
+ /**
59
+ * A logger implementation for LogRocket.
60
+ * @see {@link https://workleap.github.io/wl-telemetry}
61
+ */
62
+ export declare class LogRocketLogger implements Logger {
63
+ #private;
64
+ /**
65
+ * @see {@link https://workleap.github.io/wl-logging}
66
+ */
67
+ constructor(options?: LoggerOptions);
68
+ /**
69
+ * @see {@link https://workleap.github.io/wl-logging}
70
+ */
71
+ getName(): string;
72
+ /**
73
+ * @see {@link https://workleap.github.io/wl-logging}
74
+ */
75
+ withText(text: string, options?: LogOptions): this;
76
+ /**
77
+ * @see {@link https://workleap.github.io/wl-logging}
78
+ */
79
+ withError(error: Error): this;
80
+ /**
81
+ * @see {@link https://workleap.github.io/wl-logging}
82
+ */
83
+ withObject(obj: object): this;
84
+ /**
85
+ * @see {@link https://workleap.github.io/wl-logging}
86
+ */
87
+ withLineChange(): this;
88
+ /**
89
+ * Write a debug log. The log will be processed only if the logger LogLevel is >= debug.
90
+ * @see {@link https://workleap.github.io/wl-logging}
91
+ */
92
+ debug(log?: string, options?: LogOptions): void;
93
+ /**
94
+ * Write an information log. The log will be processed only if the logger LogLevel is >= information.
95
+ * @see {@link https://workleap.github.io/wl-logging}
96
+ */
97
+ information(log?: string, options?: LogOptions): void;
98
+ /**
99
+ * Write a warning log. The log will be processed only if the logger LogLevel is >= warning.
100
+ * @see {@link https://workleap.github.io/wl-logging}
101
+ */
102
+ warning(log?: string, options?: LogOptions): void;
103
+ /**
104
+ * Write an error log. The log will be processed only if the logger LogLevel is >= error.
105
+ * @see {@link https://workleap.github.io/wl-logging}
106
+ */
107
+ error(log?: string, options?: LogOptions): void;
108
+ /**
109
+ * Write a critical log. The log will be processed only if the logger LogLevel is >= critical.
110
+ * @see {@link https://workleap.github.io/wl-logging}
111
+ */
112
+ critical(log?: string, options?: LogOptions): void;
113
+ /**
114
+ * Start a new logging scope. The scope will inherit the LogLevel of the root logger.
115
+ * @see {@link https://workleap.github.io/wl-logging}
116
+ */
117
+ startScope(label: string): LogRocketLoggerScope;
118
+ }
@@ -0,0 +1,299 @@
1
+ import { LogLevel } from "@workleap/logging";
2
+ import logrocket from "logrocket";
3
+
4
+ ;// CONCATENATED MODULE: external "@workleap/logging"
5
+
6
+ ;// CONCATENATED MODULE: external "logrocket"
7
+
8
+ ;// CONCATENATED MODULE: ./src/LogRocketLogger.ts
9
+
10
+
11
+ function parseSegments(segments) {
12
+ return segments.reduce((acc, x)=>{
13
+ if (x.text) {
14
+ acc.push(x.text);
15
+ } else if (x.obj) {
16
+ acc.push(x.obj);
17
+ } else if (x.error) {
18
+ acc.push(x.error);
19
+ } else if (x.lineChange) {
20
+ acc.push("\r\n");
21
+ }
22
+ return acc;
23
+ }, []);
24
+ }
25
+ /**
26
+ * An scope implementation for the LogRocket logger.
27
+ * @see {@link https://workleap.github.io/wl-telemetry}
28
+ */ class LogRocketLoggerScope {
29
+ #logLevel;
30
+ #label;
31
+ #segments = [];
32
+ #pendingLogs = [];
33
+ #hasEnded = false;
34
+ /**
35
+ * @see {@link https://workleap.github.io/wl-logging}
36
+ */ constructor(label, logLevel){
37
+ this.#logLevel = logLevel;
38
+ this.#label = label;
39
+ }
40
+ #resetSegments() {
41
+ this.#segments = [];
42
+ }
43
+ #log(fct, threshold) {
44
+ if (this.#segments.length > 0) {
45
+ if (this.#logLevel <= threshold) {
46
+ // Required closure to preserved the current log items for when they will be formatted when the scope is ended.
47
+ const segments = this.#segments;
48
+ this.#pendingLogs.push(()=>{
49
+ const parsedSegments = parseSegments(segments);
50
+ parsedSegments.unshift(`(${this.#label})`);
51
+ fct(...parsedSegments);
52
+ });
53
+ }
54
+ this.#resetSegments();
55
+ }
56
+ }
57
+ /**
58
+ * @see {@link https://workleap.github.io/wl-logging}
59
+ */ withText(text, options = {}) {
60
+ this.#segments.push({
61
+ text,
62
+ options
63
+ });
64
+ return this;
65
+ }
66
+ /**
67
+ * @see {@link https://workleap.github.io/wl-logging}
68
+ */ withError(error) {
69
+ this.#segments.push({
70
+ error
71
+ });
72
+ return this;
73
+ }
74
+ /**
75
+ * @see {@link https://workleap.github.io/wl-logging}
76
+ */ withObject(obj) {
77
+ this.#segments.push({
78
+ obj
79
+ });
80
+ return this;
81
+ }
82
+ /**
83
+ * @see {@link https://workleap.github.io/wl-logging}
84
+ */ withLineChange() {
85
+ this.#segments.push({
86
+ lineChange: true
87
+ });
88
+ return this;
89
+ }
90
+ /**
91
+ * Write a debug log. The log will be processed only if the logger LogLevel is >= debug.
92
+ * @see {@link https://workleap.github.io/wl-logging}
93
+ */ debug(log, options) {
94
+ if (log) {
95
+ this.#segments.push({
96
+ text: log,
97
+ options
98
+ });
99
+ }
100
+ this.#log(logrocket.log, LogLevel.debug);
101
+ }
102
+ /**
103
+ * Write an information log. The log will be processed only if the logger LogLevel is >= information.
104
+ * @see {@link https://workleap.github.io/wl-logging}
105
+ */ information(log, options) {
106
+ if (log) {
107
+ this.#segments.push({
108
+ text: log,
109
+ options
110
+ });
111
+ }
112
+ this.#log(logrocket.log, LogLevel.information);
113
+ }
114
+ /**
115
+ * Write a warning log. The log will be processed only if the logger LogLevel is >= warning.
116
+ * @see {@link https://workleap.github.io/wl-logging}
117
+ */ warning(log, options) {
118
+ if (log) {
119
+ this.#segments.push({
120
+ text: log,
121
+ options
122
+ });
123
+ }
124
+ this.#log(logrocket.warn, LogLevel.warning);
125
+ }
126
+ /**
127
+ * Write an error log. The log will be processed only if the logger LogLevel is >= error.
128
+ * @see {@link https://workleap.github.io/wl-logging}
129
+ */ error(log, options) {
130
+ if (log) {
131
+ this.#segments.push({
132
+ text: log,
133
+ options
134
+ });
135
+ }
136
+ this.#log(logrocket.error, LogLevel.error);
137
+ }
138
+ /**
139
+ * Write a critical log. The log will be processed only if the logger LogLevel is >= critical.
140
+ * @see {@link https://workleap.github.io/wl-logging}
141
+ */ critical(log, options) {
142
+ if (log) {
143
+ this.#segments.push({
144
+ text: log,
145
+ options
146
+ });
147
+ }
148
+ this.#log(logrocket.error, LogLevel.critical);
149
+ }
150
+ /**
151
+ * @see {@link https://workleap.github.io/wl-logging}
152
+ */ end(options = {}) {
153
+ const { dismiss = false } = options;
154
+ if (!this.#hasEnded) {
155
+ this.#hasEnded = true;
156
+ if (!dismiss) {
157
+ if (this.#pendingLogs.length > 0) {
158
+ this.#pendingLogs.forEach((x)=>{
159
+ x();
160
+ });
161
+ this.#pendingLogs = [];
162
+ }
163
+ }
164
+ }
165
+ }
166
+ }
167
+ /**
168
+ * A logger implementation for LogRocket.
169
+ * @see {@link https://workleap.github.io/wl-telemetry}
170
+ */ class LogRocketLogger {
171
+ #logLevel;
172
+ #segments = [];
173
+ /**
174
+ * @see {@link https://workleap.github.io/wl-logging}
175
+ */ constructor(options = {}){
176
+ const { logLevel = LogLevel.debug } = options;
177
+ this.#logLevel = logLevel;
178
+ }
179
+ #resetSegments() {
180
+ this.#segments = [];
181
+ }
182
+ #log(fct, threshold) {
183
+ if (this.#segments.length > 0) {
184
+ if (this.#logLevel <= threshold) {
185
+ const parsedSegments = parseSegments(this.#segments);
186
+ fct(...parsedSegments);
187
+ }
188
+ this.#resetSegments();
189
+ }
190
+ }
191
+ /**
192
+ * @see {@link https://workleap.github.io/wl-logging}
193
+ */ getName() {
194
+ return LogRocketLogger.name;
195
+ }
196
+ /**
197
+ * @see {@link https://workleap.github.io/wl-logging}
198
+ */ withText(text, options = {}) {
199
+ this.#segments.push({
200
+ text,
201
+ options
202
+ });
203
+ return this;
204
+ }
205
+ /**
206
+ * @see {@link https://workleap.github.io/wl-logging}
207
+ */ withError(error) {
208
+ this.#segments.push({
209
+ error
210
+ });
211
+ return this;
212
+ }
213
+ /**
214
+ * @see {@link https://workleap.github.io/wl-logging}
215
+ */ withObject(obj) {
216
+ this.#segments.push({
217
+ obj
218
+ });
219
+ return this;
220
+ }
221
+ /**
222
+ * @see {@link https://workleap.github.io/wl-logging}
223
+ */ withLineChange() {
224
+ this.#segments.push({
225
+ lineChange: true
226
+ });
227
+ return this;
228
+ }
229
+ /**
230
+ * Write a debug log. The log will be processed only if the logger LogLevel is >= debug.
231
+ * @see {@link https://workleap.github.io/wl-logging}
232
+ */ debug(log, options) {
233
+ if (log) {
234
+ this.#segments.push({
235
+ text: log,
236
+ options
237
+ });
238
+ }
239
+ this.#log(logrocket.log, LogLevel.debug);
240
+ }
241
+ /**
242
+ * Write an information log. The log will be processed only if the logger LogLevel is >= information.
243
+ * @see {@link https://workleap.github.io/wl-logging}
244
+ */ information(log, options) {
245
+ if (log) {
246
+ this.#segments.push({
247
+ text: log,
248
+ options
249
+ });
250
+ }
251
+ this.#log(logrocket.log, LogLevel.information);
252
+ }
253
+ /**
254
+ * Write a warning log. The log will be processed only if the logger LogLevel is >= warning.
255
+ * @see {@link https://workleap.github.io/wl-logging}
256
+ */ warning(log, options) {
257
+ if (log) {
258
+ this.#segments.push({
259
+ text: log,
260
+ options
261
+ });
262
+ }
263
+ this.#log(logrocket.warn, LogLevel.warning);
264
+ }
265
+ /**
266
+ * Write an error log. The log will be processed only if the logger LogLevel is >= error.
267
+ * @see {@link https://workleap.github.io/wl-logging}
268
+ */ error(log, options) {
269
+ if (log) {
270
+ this.#segments.push({
271
+ text: log,
272
+ options
273
+ });
274
+ }
275
+ this.#log(logrocket.error, LogLevel.error);
276
+ }
277
+ /**
278
+ * Write a critical log. The log will be processed only if the logger LogLevel is >= critical.
279
+ * @see {@link https://workleap.github.io/wl-logging}
280
+ */ critical(log, options) {
281
+ if (log) {
282
+ this.#segments.push({
283
+ text: log,
284
+ options
285
+ });
286
+ }
287
+ this.#log(logrocket.error, LogLevel.critical);
288
+ }
289
+ /**
290
+ * Start a new logging scope. The scope will inherit the LogLevel of the root logger.
291
+ * @see {@link https://workleap.github.io/wl-logging}
292
+ */ startScope(label) {
293
+ return new LogRocketLoggerScope(label, this.#logLevel);
294
+ }
295
+ }
296
+
297
+ export { LogRocketLogger, LogRocketLoggerScope };
298
+
299
+ //# sourceMappingURL=LogRocketLogger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LogRocketLogger.js","sources":["webpack://@workleap/logrocket/./src/LogRocketLogger.ts"],"sourcesContent":["import { type Logger, type LoggerOptions, type LoggerScope, type LoggerScopeEndOptions, LogLevel, type LogOptions, type Segment } from \"@workleap/logging\";\nimport LogRocket from \"logrocket\";\n\ntype LogFunction = (...rest: unknown[]) => void;\ntype PendingLog = () => void;\n\nfunction parseSegments(segments: Segment[]) {\n return segments.reduce<unknown[]>((acc, x) => {\n if (x.text) {\n acc.push(x.text);\n } else if (x.obj) {\n acc.push(x.obj);\n } else if (x.error) {\n acc.push(x.error);\n } else if (x.lineChange) {\n acc.push(\"\\r\\n\");\n }\n\n return acc;\n }, []);\n}\n\n/**\n * An scope implementation for the LogRocket logger.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport class LogRocketLoggerScope implements LoggerScope {\n readonly #logLevel: LogLevel;\n readonly #label: string;\n\n #segments: Segment[] = [];\n #pendingLogs: PendingLog[] = [];\n #hasEnded: boolean = false;\n\n /**\n * @see {@link https://workleap.github.io/wl-logging}\n */\n constructor(label: string, logLevel: LogLevel) {\n this.#logLevel = logLevel;\n this.#label = label;\n }\n\n #resetSegments() {\n this.#segments = [];\n }\n\n #log(fct: LogFunction, threshold: LogLevel) {\n if (this.#segments.length > 0) {\n if (this.#logLevel <= threshold) {\n // Required closure to preserved the current log items for when they will be formatted when the scope is ended.\n const segments = this.#segments;\n\n this.#pendingLogs.push(() => {\n const parsedSegments = parseSegments(segments);\n parsedSegments.unshift(`(${this.#label})`);\n\n fct(...parsedSegments);\n });\n }\n\n this.#resetSegments();\n }\n }\n\n /**\n * @see {@link https://workleap.github.io/wl-logging}\n */\n withText(text: string, options: LogOptions = {}) {\n this.#segments.push({\n text,\n options\n });\n\n return this;\n }\n\n /**\n * @see {@link https://workleap.github.io/wl-logging}\n */\n withError(error: Error) {\n this.#segments.push({\n error\n });\n\n return this;\n }\n\n /**\n * @see {@link https://workleap.github.io/wl-logging}\n */\n withObject(obj: object) {\n this.#segments.push({\n obj\n });\n\n return this;\n }\n\n /**\n * @see {@link https://workleap.github.io/wl-logging}\n */\n withLineChange() {\n this.#segments.push({\n lineChange: true\n });\n\n return this;\n }\n\n /**\n * Write a debug log. The log will be processed only if the logger LogLevel is >= debug.\n * @see {@link https://workleap.github.io/wl-logging}\n */\n debug(log?: string, options?: LogOptions) {\n if (log) {\n this.#segments.push({\n text: log,\n options\n });\n }\n\n this.#log(LogRocket.log, LogLevel.debug);\n }\n\n /**\n * Write an information log. The log will be processed only if the logger LogLevel is >= information.\n * @see {@link https://workleap.github.io/wl-logging}\n */\n information(log?: string, options?: LogOptions) {\n if (log) {\n this.#segments.push({\n text: log,\n options\n });\n }\n\n this.#log(LogRocket.log, LogLevel.information);\n }\n\n /**\n * Write a warning log. The log will be processed only if the logger LogLevel is >= warning.\n * @see {@link https://workleap.github.io/wl-logging}\n */\n warning(log?: string, options?: LogOptions) {\n if (log) {\n this.#segments.push({\n text: log,\n options\n });\n }\n\n this.#log(LogRocket.warn, LogLevel.warning);\n }\n\n /**\n * Write an error log. The log will be processed only if the logger LogLevel is >= error.\n * @see {@link https://workleap.github.io/wl-logging}\n */\n error(log?: string, options?: LogOptions) {\n if (log) {\n this.#segments.push({\n text: log,\n options\n });\n }\n\n this.#log(LogRocket.error, LogLevel.error);\n }\n\n /**\n * Write a critical log. The log will be processed only if the logger LogLevel is >= critical.\n * @see {@link https://workleap.github.io/wl-logging}\n */\n critical(log?: string, options?: LogOptions) {\n if (log) {\n this.#segments.push({\n text: log,\n options\n });\n }\n\n this.#log(LogRocket.error, LogLevel.critical);\n }\n\n /**\n * @see {@link https://workleap.github.io/wl-logging}\n */\n end(options: LoggerScopeEndOptions = {}) {\n const {\n dismiss = false\n } = options;\n\n if (!this.#hasEnded) {\n this.#hasEnded = true;\n\n if (!dismiss) {\n if (this.#pendingLogs.length > 0) {\n this.#pendingLogs.forEach(x => {\n x();\n });\n\n this.#pendingLogs = [];\n }\n }\n }\n }\n}\n\n/**\n * A logger implementation for LogRocket.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport class LogRocketLogger implements Logger {\n readonly #logLevel: LogLevel;\n #segments: Segment[] = [];\n\n /**\n * @see {@link https://workleap.github.io/wl-logging}\n */\n constructor(options: LoggerOptions = {}) {\n const {\n logLevel = LogLevel.debug\n } = options;\n\n this.#logLevel = logLevel;\n }\n\n #resetSegments() {\n this.#segments = [];\n }\n\n #log(fct: LogFunction, threshold: LogLevel) {\n if (this.#segments.length > 0) {\n if (this.#logLevel <= threshold) {\n const parsedSegments = parseSegments(this.#segments);\n\n fct(...parsedSegments);\n }\n\n this.#resetSegments();\n }\n }\n\n /**\n * @see {@link https://workleap.github.io/wl-logging}\n */\n getName() {\n return LogRocketLogger.name;\n }\n\n /**\n * @see {@link https://workleap.github.io/wl-logging}\n */\n withText(text: string, options: LogOptions = {}) {\n this.#segments.push({\n text,\n options\n });\n\n return this;\n }\n\n /**\n * @see {@link https://workleap.github.io/wl-logging}\n */\n withError(error: Error) {\n this.#segments.push({\n error\n });\n\n return this;\n }\n\n /**\n * @see {@link https://workleap.github.io/wl-logging}\n */\n withObject(obj: object) {\n this.#segments.push({\n obj\n });\n\n return this;\n }\n\n /**\n * @see {@link https://workleap.github.io/wl-logging}\n */\n withLineChange() {\n this.#segments.push({\n lineChange: true\n });\n\n return this;\n }\n\n /**\n * Write a debug log. The log will be processed only if the logger LogLevel is >= debug.\n * @see {@link https://workleap.github.io/wl-logging}\n */\n debug(log?: string, options?: LogOptions) {\n if (log) {\n this.#segments.push({\n text: log,\n options\n });\n }\n\n this.#log(LogRocket.log, LogLevel.debug);\n }\n\n /**\n * Write an information log. The log will be processed only if the logger LogLevel is >= information.\n * @see {@link https://workleap.github.io/wl-logging}\n */\n information(log?: string, options?: LogOptions) {\n if (log) {\n this.#segments.push({\n text: log,\n options\n });\n }\n\n this.#log(LogRocket.log, LogLevel.information);\n }\n\n /**\n * Write a warning log. The log will be processed only if the logger LogLevel is >= warning.\n * @see {@link https://workleap.github.io/wl-logging}\n */\n warning(log?: string, options?: LogOptions) {\n if (log) {\n this.#segments.push({\n text: log,\n options\n });\n }\n\n this.#log(LogRocket.warn, LogLevel.warning);\n }\n\n /**\n * Write an error log. The log will be processed only if the logger LogLevel is >= error.\n * @see {@link https://workleap.github.io/wl-logging}\n */\n error(log?: string, options?: LogOptions) {\n if (log) {\n this.#segments.push({\n text: log,\n options\n });\n }\n\n this.#log(LogRocket.error, LogLevel.error);\n }\n\n /**\n * Write a critical log. The log will be processed only if the logger LogLevel is >= critical.\n * @see {@link https://workleap.github.io/wl-logging}\n */\n critical(log?: string, options?: LogOptions) {\n if (log) {\n this.#segments.push({\n text: log,\n options\n });\n }\n\n this.#log(LogRocket.error, LogLevel.critical);\n }\n\n /**\n * Start a new logging scope. The scope will inherit the LogLevel of the root logger.\n * @see {@link https://workleap.github.io/wl-logging}\n */\n startScope(label: string) {\n return new LogRocketLoggerScope(label, this.#logLevel);\n }\n}\n"],"names":["LogLevel","LogRocket","parseSegments","segments","acc","x","LogRocketLoggerScope","label","logLevel","fct","threshold","parsedSegments","text","options","error","obj","log","dismiss","LogRocketLogger"],"mappings":";;;;;;;;AAA2J;AACzH;AAKlC,SAASE,cAAcC,QAAmB;IACtC,OAAOA,SAAS,MAAM,CAAY,CAACC,KAAKC;QACpC,IAAIA,EAAE,IAAI,EAAE;YACRD,IAAI,IAAI,CAACC,EAAE,IAAI;QACnB,OAAO,IAAIA,EAAE,GAAG,EAAE;YACdD,IAAI,IAAI,CAACC,EAAE,GAAG;QAClB,OAAO,IAAIA,EAAE,KAAK,EAAE;YAChBD,IAAI,IAAI,CAACC,EAAE,KAAK;QACpB,OAAO,IAAIA,EAAE,UAAU,EAAE;YACrBD,IAAI,IAAI,CAAC;QACb;QAEA,OAAOA;IACX,GAAG,EAAE;AACT;AAEA;;;CAGC,GACM,MAAME;IACA,SAAS,CAAW;IACpB,MAAM,CAAS;IAExB,SAAS,GAAc,EAAE,CAAC;IAC1B,YAAY,GAAiB,EAAE,CAAC;IAChC,SAAS,GAAY,MAAM;IAE3B;;KAEC,GACD,YAAYC,KAAa,EAAEC,QAAkB,CAAE;QAC3C,IAAI,CAAC,SAAS,GAAGA;QACjB,IAAI,CAAC,MAAM,GAAGD;IAClB;IAEA,cAAc;QACV,IAAI,CAAC,SAAS,GAAG,EAAE;IACvB;IAEA,IAAI,CAACE,GAAgB,EAAEC,SAAmB;QACtC,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,GAAG;YAC3B,IAAI,IA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QgB,GAAY,EAAEH,OAAoB,EAAE;QACxC,IAAIG,KAAK;YACL,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;gBAChB,MAAMA;gBACNH;YACJ;QACJ;QAEA,IAAI,CAAC,IAAI,CAACZ,cAAc,EAAED,gBAAgB;IAC9C;IAEA;;;KAGC,GACD,MAAMgB,GAAY,EAAEH,OAAoB,EAAE;QACtC,IAAIG,KAAK;YACL,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;gBAChB,MAAMA;gBACNH;YACJ;QACJ;QAEA,IAAI,CAAC,IAAI,CAACZ,eAAe,EAAED,cAAc;IAC7C;IAEA;;;KAGC,GACD,SAASgB,GAAY,EAAEH,OAAoB,EAAE;QACzC,IAAIG,KAAK;YACL,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;gBAChB,MAAMA;gBACNH;YACJ;QACJ;QAEA,IAAI,CAAC,IAAI,CAACZ,eAAe,EAAED,iBAAiB;IAChD;IAEA;;;KAGC,GACD,WAAWO,KAAa,EAAE;QACtB,OAAO,IAAID,qBAAqBC,OAAO,IAAI,CAAC,SAAS;IACzD;AACJ"}
@@ -1,9 +1,15 @@
1
+ import type { RootLogger } from "@workleap/logging";
1
2
  import type { LogRocketSdkOptions } from "./logRocketTypes.ts";
2
3
  /**
3
- * @see https://workleap.github.io/wl-telemetry
4
+ * @see {@link https://workleap.github.io/wl-telemetry}
4
5
  */
5
6
  export interface LogRocketSdkOptionsTransformerContext {
6
7
  verbose: boolean;
8
+ logger: RootLogger;
7
9
  }
10
+ /**
11
+ * Hook to transform the resulting LogRocket SDK options.
12
+ * @see {@link https://workleap.github.io/wl-telemetry}
13
+ */
8
14
  export type LogRocketSdkOptionsTransformer = (options: LogRocketSdkOptions, context: LogRocketSdkOptionsTransformerContext) => LogRocketSdkOptions;
9
15
  export declare function applyTransformers(options: LogRocketSdkOptions, transformers: LogRocketSdkOptionsTransformer[], context: LogRocketSdkOptionsTransformerContext): LogRocketSdkOptions;
@@ -1 +1 @@
1
- {"version":3,"file":"applyTransformers.js","sources":["webpack://@workleap/logrocket/./src/applyTransformers.ts"],"sourcesContent":["import type { LogRocketSdkOptions } from \"./logRocketTypes.ts\";\n\n/**\n * @see https://workleap.github.io/wl-telemetry\n */\nexport interface LogRocketSdkOptionsTransformerContext {\n verbose: boolean;\n}\n\nexport type LogRocketSdkOptionsTransformer = (options: LogRocketSdkOptions, context: LogRocketSdkOptionsTransformerContext) => LogRocketSdkOptions;\n\n// The function return type is mandatory, otherwise we got an error TS4058.\nexport function applyTransformers(options: LogRocketSdkOptions, transformers: LogRocketSdkOptionsTransformer[], context: LogRocketSdkOptionsTransformerContext): LogRocketSdkOptions {\n return transformers.reduce((acc, transformer) => transformer(acc, context), options);\n}\n\n\n"],"names":["applyTransformers","options","transformers","context","acc","transformer"],"mappings":";;AAWA,2EAA2E;AACpE,SAASA,kBAAkBC,OAA4B,EAAEC,YAA8C,EAAEC,OAA8C;IAC1J,OAAOD,aAAa,MAAM,CAAC,CAACE,KAAKC,cAAgBA,YAAYD,KAAKD,UAAUF;AAChF"}
1
+ {"version":3,"file":"applyTransformers.js","sources":["webpack://@workleap/logrocket/./src/applyTransformers.ts"],"sourcesContent":["import type { RootLogger } from \"@workleap/logging\";\nimport type { LogRocketSdkOptions } from \"./logRocketTypes.ts\";\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport interface LogRocketSdkOptionsTransformerContext {\n verbose: boolean;\n logger: RootLogger;\n}\n\n/**\n * Hook to transform the resulting LogRocket SDK options.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport type LogRocketSdkOptionsTransformer = (options: LogRocketSdkOptions, context: LogRocketSdkOptionsTransformerContext) => LogRocketSdkOptions;\n\n// The function return type is mandatory, otherwise we got an error TS4058.\nexport function applyTransformers(options: LogRocketSdkOptions, transformers: LogRocketSdkOptionsTransformer[], context: LogRocketSdkOptionsTransformerContext): LogRocketSdkOptions {\n return transformers.reduce((acc, transformer) => transformer(acc, context), options);\n}\n\n\n"],"names":["applyTransformers","options","transformers","context","acc","transformer"],"mappings":";;AAiBA,2EAA2E;AACpE,SAASA,kBAAkBC,OAA4B,EAAEC,YAA8C,EAAEC,OAA8C;IAC1J,OAAOD,aAAa,MAAM,CAAC,CAACE,KAAKC,cAAgBA,YAAYD,KAAKD,UAAUF;AAChF"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @see https://workleap.github.io/wl-telemetry
2
+ * @see {@link https://workleap.github.io/wl-telemetry}
3
3
  */
4
4
  export interface LogRocketIdentification {
5
5
  userId: string;
@@ -36,7 +36,7 @@ export interface LogRocketIdentification {
36
36
  };
37
37
  }
38
38
  /**
39
- * @see https://workleap.github.io/wl-telemetry
39
+ * @see {@link https://workleap.github.io/wl-telemetry}
40
40
  */
41
41
  export interface LogRocketUserTraits extends Record<string, unknown> {
42
42
  "User Id": string;
@@ -73,7 +73,8 @@ export interface LogRocketUserTraits extends Record<string, unknown> {
73
73
  export declare const DeviceIdTrait = "Device Id";
74
74
  export declare const TelemetryIdTrait = "Telemetry Id";
75
75
  /**
76
- * @see https://workleap.github.io/wl-telemetry
76
+ * Create the default user traits for a WLP user.
77
+ * @see {@link https://workleap.github.io/wl-telemetry}
77
78
  */
78
79
  export declare function createDefaultUserTraits(identification: LogRocketIdentification): {
79
80
  "Plan Code - Pingboard"?: string | undefined;
@@ -11,7 +11,8 @@ import { isDefined } from "./assertions.js";
11
11
  const DeviceIdTrait = "Device Id";
12
12
  const TelemetryIdTrait = "Telemetry Id";
13
13
  /**
14
- * @see https://workleap.github.io/wl-telemetry
14
+ * Create the default user traits for a WLP user.
15
+ * @see {@link https://workleap.github.io/wl-telemetry}
15
16
  */ function createDefaultUserTraits(identification) {
16
17
  const { userId, organizationId, organizationName, isMigratedToWorkleap, isOrganizationCreator, isAdmin, isExecutive, isCollaborator, isReportingManager, isTeamManager, planCode } = identification;
17
18
  const isExecutiveInAnyProduct = Boolean(isExecutive?.wov || isExecutive?.lms || isExecutive?.onb || isExecutive?.sks || isExecutive?.wpm || isExecutive?.pbd);
@@ -1 +1 @@
1
- {"version":3,"file":"createDefaultUserTraits.js","sources":["webpack://@workleap/logrocket/./src/createDefaultUserTraits.ts"],"sourcesContent":["import { getTelemetryContext } from \"@workleap/telemetry\";\nimport { isDefined } from \"./assertions.ts\";\n\n/**\n * @see https://workleap.github.io/wl-telemetry\n */\nexport interface LogRocketIdentification {\n userId: string;\n organizationId: string;\n organizationName: string;\n isMigratedToWorkleap: boolean;\n isAdmin: boolean;\n isOrganizationCreator?: boolean;\n isExecutive?: {\n wov?: boolean;\n lms?: boolean;\n onb?: boolean;\n sks?: boolean;\n wpm?: boolean;\n pbd?: boolean;\n };\n isCollaborator?: {\n wov?: boolean;\n lms?: boolean;\n onb?: boolean;\n sks?: boolean;\n wpm?: boolean;\n pbd?: boolean;\n };\n isReportingManager?: boolean;\n isTeamManager?: boolean;\n planCode?: {\n wov?: string;\n lms?: string;\n onb?: string;\n sks?: string;\n wpm?: string;\n pbd?: string;\n };\n}\n\n/**\n * @see https://workleap.github.io/wl-telemetry\n */\nexport interface LogRocketUserTraits extends Record<string, unknown> {\n \"User Id\": string;\n \"Organization Id\": string;\n \"Organization Name\": string;\n \"Is Migrated To Workleap\": boolean;\n \"Is Admin\": boolean;\n \"Device Id\": string;\n \"Telemetry Id\": string;\n \"Is Organization Creator\"?: boolean;\n \"Is Executive\"?: boolean;\n \"Is Executive - Officevibe\"?: boolean;\n \"Is Executive - LMS\"?: boolean;\n \"Is Executive - Onboarding\"?: boolean;\n \"Is Executive - Skills\"?: boolean;\n \"Is Executive - Performance\"?: boolean;\n \"Is Executive - Pingboard\"?: boolean;\n \"Is Collaborator\"?: boolean;\n \"Is Collaborator - Officevibe\"?: boolean;\n \"Is Collaborator - LMS\"?: boolean;\n \"Is Collaborator - Onboarding\"?: boolean;\n \"Is Collaborator - Skills\"?: boolean;\n \"Is Collaborator - Performance\"?: boolean;\n \"Is Collaborator - Pingboard\"?: boolean;\n \"Is Reporting Manager\"?: boolean;\n \"Is Team Manager\"?: boolean;\n \"Plan Code - Officevibe\"?: string;\n \"Plan Code - LMS\"?: string;\n \"Plan Code - Onboarding\"?: string;\n \"Plan Code - Skills\"?: string;\n \"Plan Code - Performance\"?: string;\n \"Plan Code - Pingboard\"?: string;\n}\n\nexport const DeviceIdTrait = \"Device Id\";\nexport const TelemetryIdTrait = \"Telemetry Id\";\n\n/**\n * @see https://workleap.github.io/wl-telemetry\n */\nexport function createDefaultUserTraits(identification: LogRocketIdentification) {\n const {\n userId,\n organizationId,\n organizationName,\n isMigratedToWorkleap,\n isOrganizationCreator,\n isAdmin,\n isExecutive,\n isCollaborator,\n isReportingManager,\n isTeamManager,\n planCode\n } = identification;\n\n const isExecutiveInAnyProduct = Boolean(\n isExecutive?.wov ||\n isExecutive?.lms ||\n isExecutive?.onb ||\n isExecutive?.sks ||\n isExecutive?.wpm ||\n isExecutive?.pbd\n );\n\n const isCollaboratorInAnyProduct = Boolean(\n isCollaborator?.wov ||\n isCollaborator?.lms ||\n isCollaborator?.onb ||\n isCollaborator?.sks ||\n isCollaborator?.wpm ||\n isCollaborator?.pbd\n );\n\n const telemetryContext = getTelemetryContext();\n\n return {\n \"User Id\": userId,\n \"Organization Id\": organizationId,\n \"Organization Name\": organizationName,\n \"Is Migrated To Workleap\": isMigratedToWorkleap,\n \"Is Admin\": isAdmin,\n [DeviceIdTrait]: telemetryContext ? telemetryContext.deviceId : \"N/A\",\n [TelemetryIdTrait]: telemetryContext ? telemetryContext.telemetryId : \"N/A\",\n ...(isDefined(isOrganizationCreator) && { \"Is Organization Creator\": isOrganizationCreator }),\n ...(isExecutiveInAnyProduct && { \"Is Executive\": true }),\n ...(isDefined(isExecutive?.wov) && { \"Is Executive - Officevibe\": isExecutive.wov }),\n ...(isDefined(isExecutive?.lms) && { \"Is Executive - LMS\": isExecutive.lms }),\n ...(isDefined(isExecutive?.onb) && { \"Is Executive - Onboarding\": isExecutive.onb }),\n ...(isDefined(isExecutive?.sks) && { \"Is Executive - Skills\": isExecutive.sks }),\n ...(isDefined(isExecutive?.wpm) && { \"Is Executive - Performance\": isExecutive.wpm }),\n ...(isDefined(isExecutive?.pbd) && { \"Is Executive - Pingboard\": isExecutive.pbd }),\n ...(isCollaboratorInAnyProduct && { \"Is Collaborator\": isCollaboratorInAnyProduct }),\n ...(isDefined(isCollaborator?.wov) && { \"Is Collaborator - Officevibe\": isCollaborator.wov }),\n ...(isDefined(isCollaborator?.lms) && { \"Is Collaborator - LMS\": isCollaborator.lms }),\n ...(isDefined(isCollaborator?.onb) && { \"Is Collaborator - Onboarding\": isCollaborator.onb }),\n ...(isDefined(isCollaborator?.sks) && { \"Is Collaborator - Skills\": isCollaborator.sks }),\n ...(isDefined(isCollaborator?.wpm) && { \"Is Collaborator - Performance\": isCollaborator.wpm }),\n ...(isDefined(isCollaborator?.pbd) && { \"Is Collaborator - Pingboard\": isCollaborator.pbd }),\n ...(isDefined(isReportingManager) && { \"Is Reporting Manager\": isReportingManager }),\n ...(isDefined(isTeamManager) && { \"Is Team Manager\": isTeamManager }),\n ...(isDefined(planCode?.wov) && { \"Plan Code - Officevibe\": planCode.wov }),\n ...(isDefined(planCode?.lms) && { \"Plan Code - LMS\": planCode.lms }),\n ...(isDefined(planCode?.onb) && { \"Plan Code - Onboarding\": planCode.onb }),\n ...(isDefined(planCode?.sks) && { \"Plan Code - Skills\": planCode.sks }),\n ...(isDefined(planCode?.wpm) && { \"Plan Code - Performance\": planCode.wpm }),\n ...(isDefined(planCode?.pbd) && { \"Plan Code - Pingboard\": planCode.pbd })\n } satisfies LogRocketUserTraits;\n}\n"],"names":["getTelemetryContext","isDefined","DeviceIdTrait","TelemetryIdTrait","createDefaultUserTraits","identification","userId","organizationId","organizationName","isMigratedToWorkleap","isOrganizationCreator","isAdmin","isExecutive","isCollaborator","isReportingManager","isTeamManager","planCode","isExecutiveInAnyProduct","Boolean","isCollaboratorInAnyProduct","telemetryContext"],"mappings":";;;;;;;;AAA0D;AACd;AA4Er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
1
+ {"version":3,"file":"createDefaultUserTraits.js","sources":["webpack://@workleap/logrocket/./src/createDefaultUserTraits.ts"],"sourcesContent":["import { getTelemetryContext } from \"@workleap/telemetry\";\nimport { isDefined } from \"./assertions.ts\";\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport interface LogRocketIdentification {\n userId: string;\n organizationId: string;\n organizationName: string;\n isMigratedToWorkleap: boolean;\n isAdmin: boolean;\n isOrganizationCreator?: boolean;\n isExecutive?: {\n wov?: boolean;\n lms?: boolean;\n onb?: boolean;\n sks?: boolean;\n wpm?: boolean;\n pbd?: boolean;\n };\n isCollaborator?: {\n wov?: boolean;\n lms?: boolean;\n onb?: boolean;\n sks?: boolean;\n wpm?: boolean;\n pbd?: boolean;\n };\n isReportingManager?: boolean;\n isTeamManager?: boolean;\n planCode?: {\n wov?: string;\n lms?: string;\n onb?: string;\n sks?: string;\n wpm?: string;\n pbd?: string;\n };\n}\n\n/**\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport interface LogRocketUserTraits extends Record<string, unknown> {\n \"User Id\": string;\n \"Organization Id\": string;\n \"Organization Name\": string;\n \"Is Migrated To Workleap\": boolean;\n \"Is Admin\": boolean;\n \"Device Id\": string;\n \"Telemetry Id\": string;\n \"Is Organization Creator\"?: boolean;\n \"Is Executive\"?: boolean;\n \"Is Executive - Officevibe\"?: boolean;\n \"Is Executive - LMS\"?: boolean;\n \"Is Executive - Onboarding\"?: boolean;\n \"Is Executive - Skills\"?: boolean;\n \"Is Executive - Performance\"?: boolean;\n \"Is Executive - Pingboard\"?: boolean;\n \"Is Collaborator\"?: boolean;\n \"Is Collaborator - Officevibe\"?: boolean;\n \"Is Collaborator - LMS\"?: boolean;\n \"Is Collaborator - Onboarding\"?: boolean;\n \"Is Collaborator - Skills\"?: boolean;\n \"Is Collaborator - Performance\"?: boolean;\n \"Is Collaborator - Pingboard\"?: boolean;\n \"Is Reporting Manager\"?: boolean;\n \"Is Team Manager\"?: boolean;\n \"Plan Code - Officevibe\"?: string;\n \"Plan Code - LMS\"?: string;\n \"Plan Code - Onboarding\"?: string;\n \"Plan Code - Skills\"?: string;\n \"Plan Code - Performance\"?: string;\n \"Plan Code - Pingboard\"?: string;\n}\n\nexport const DeviceIdTrait = \"Device Id\";\nexport const TelemetryIdTrait = \"Telemetry Id\";\n\n/**\n * Create the default user traits for a WLP user.\n * @see {@link https://workleap.github.io/wl-telemetry}\n */\nexport function createDefaultUserTraits(identification: LogRocketIdentification) {\n const {\n userId,\n organizationId,\n organizationName,\n isMigratedToWorkleap,\n isOrganizationCreator,\n isAdmin,\n isExecutive,\n isCollaborator,\n isReportingManager,\n isTeamManager,\n planCode\n } = identification;\n\n const isExecutiveInAnyProduct = Boolean(\n isExecutive?.wov ||\n isExecutive?.lms ||\n isExecutive?.onb ||\n isExecutive?.sks ||\n isExecutive?.wpm ||\n isExecutive?.pbd\n );\n\n const isCollaboratorInAnyProduct = Boolean(\n isCollaborator?.wov ||\n isCollaborator?.lms ||\n isCollaborator?.onb ||\n isCollaborator?.sks ||\n isCollaborator?.wpm ||\n isCollaborator?.pbd\n );\n\n const telemetryContext = getTelemetryContext();\n\n return {\n \"User Id\": userId,\n \"Organization Id\": organizationId,\n \"Organization Name\": organizationName,\n \"Is Migrated To Workleap\": isMigratedToWorkleap,\n \"Is Admin\": isAdmin,\n [DeviceIdTrait]: telemetryContext ? telemetryContext.deviceId : \"N/A\",\n [TelemetryIdTrait]: telemetryContext ? telemetryContext.telemetryId : \"N/A\",\n ...(isDefined(isOrganizationCreator) && { \"Is Organization Creator\": isOrganizationCreator }),\n ...(isExecutiveInAnyProduct && { \"Is Executive\": true }),\n ...(isDefined(isExecutive?.wov) && { \"Is Executive - Officevibe\": isExecutive.wov }),\n ...(isDefined(isExecutive?.lms) && { \"Is Executive - LMS\": isExecutive.lms }),\n ...(isDefined(isExecutive?.onb) && { \"Is Executive - Onboarding\": isExecutive.onb }),\n ...(isDefined(isExecutive?.sks) && { \"Is Executive - Skills\": isExecutive.sks }),\n ...(isDefined(isExecutive?.wpm) && { \"Is Executive - Performance\": isExecutive.wpm }),\n ...(isDefined(isExecutive?.pbd) && { \"Is Executive - Pingboard\": isExecutive.pbd }),\n ...(isCollaboratorInAnyProduct && { \"Is Collaborator\": isCollaboratorInAnyProduct }),\n ...(isDefined(isCollaborator?.wov) && { \"Is Collaborator - Officevibe\": isCollaborator.wov }),\n ...(isDefined(isCollaborator?.lms) && { \"Is Collaborator - LMS\": isCollaborator.lms }),\n ...(isDefined(isCollaborator?.onb) && { \"Is Collaborator - Onboarding\": isCollaborator.onb }),\n ...(isDefined(isCollaborator?.sks) && { \"Is Collaborator - Skills\": isCollaborator.sks }),\n ...(isDefined(isCollaborator?.wpm) && { \"Is Collaborator - Performance\": isCollaborator.wpm }),\n ...(isDefined(isCollaborator?.pbd) && { \"Is Collaborator - Pingboard\": isCollaborator.pbd }),\n ...(isDefined(isReportingManager) && { \"Is Reporting Manager\": isReportingManager }),\n ...(isDefined(isTeamManager) && { \"Is Team Manager\": isTeamManager }),\n ...(isDefined(planCode?.wov) && { \"Plan Code - Officevibe\": planCode.wov }),\n ...(isDefined(planCode?.lms) && { \"Plan Code - LMS\": planCode.lms }),\n ...(isDefined(planCode?.onb) && { \"Plan Code - Onboarding\": planCode.onb }),\n ...(isDefined(planCode?.sks) && { \"Plan Code - Skills\": planCode.sks }),\n ...(isDefined(planCode?.wpm) && { \"Plan Code - Performance\": planCode.wpm }),\n ...(isDefined(planCode?.pbd) && { \"Plan Code - Pingboard\": planCode.pbd })\n } satisfies LogRocketUserTraits;\n}\n"],"names":["getTelemetryContext","isDefined","DeviceIdTrait","TelemetryIdTrait","createDefaultUserTraits","identification","userId","organizationId","organizationName","isMigratedToWorkleap","isOrganizationCreator","isAdmin","isExecutive","isCollaborator","isReportingManager","isTeamManager","planCode","isExecutiveInAnyProduct","Boolean","isCollaboratorInAnyProduct","telemetryContext"],"mappings":";;;;;;;;AAA0D;AACd;AA4ErC,MAAME,gBA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.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export type { LogRocketSdkOptionsTransformer } from "./applyTransformers.ts";
2
2
  export { createDefaultUserTraits, type LogRocketIdentification, type LogRocketUserTraits } from "./createDefaultUserTraits.ts";
3
+ export { LogRocketLogger, LogRocketLoggerScope } from "./LogRocketLogger.ts";
3
4
  export type * from "./logRocketTypes.ts";
4
5
  export { registerLogRocketInstrumentation } from "./registerLogRocketInstrumentation.ts";
package/dist/index.js CHANGED
@@ -1,14 +1,18 @@
1
1
  import { createDefaultUserTraits } from "./createDefaultUserTraits.js";
2
+ import { LogRocketLogger, LogRocketLoggerScope } from "./LogRocketLogger.js";
2
3
  import { registerLogRocketInstrumentation } from "./registerLogRocketInstrumentation.js";
3
4
 
4
5
  ;// CONCATENATED MODULE: external "./createDefaultUserTraits.js"
5
6
 
7
+ ;// CONCATENATED MODULE: external "./LogRocketLogger.js"
8
+
6
9
  ;// CONCATENATED MODULE: external "./registerLogRocketInstrumentation.js"
7
10
 
8
11
  ;// CONCATENATED MODULE: ./src/index.ts
9
12
 
10
13
 
11
14
 
12
- export { createDefaultUserTraits, registerLogRocketInstrumentation };
15
+
16
+ export { LogRocketLogger, LogRocketLoggerScope, createDefaultUserTraits, registerLogRocketInstrumentation };
13
17
 
14
18
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["webpack://@workleap/logrocket/./src/index.ts"],"sourcesContent":["export type { LogRocketSdkOptionsTransformer } from \"./applyTransformers.ts\";\nexport { createDefaultUserTraits, type LogRocketIdentification, type LogRocketUserTraits } from \"./createDefaultUserTraits.ts\";\nexport type * from \"./logRocketTypes.ts\";\nexport { registerLogRocketInstrumentation } from \"./registerLogRocketInstrumentation.ts\";\n\n"],"names":["createDefaultUserTraits","registerLogRocketInstrumentation"],"mappings":";;;;;;;;AAC+H;AAEtC"}
1
+ {"version":3,"file":"index.js","sources":["webpack://@workleap/logrocket/./src/index.ts"],"sourcesContent":["export type { LogRocketSdkOptionsTransformer } from \"./applyTransformers.ts\";\nexport { createDefaultUserTraits, type LogRocketIdentification, type LogRocketUserTraits } from \"./createDefaultUserTraits.ts\";\nexport { LogRocketLogger, LogRocketLoggerScope } from \"./LogRocketLogger.ts\";\nexport type * from \"./logRocketTypes.ts\";\nexport { registerLogRocketInstrumentation } from \"./registerLogRocketInstrumentation.ts\";\n\n"],"names":["createDefaultUserTraits","LogRocketLogger","LogRocketLoggerScope","registerLogRocketInstrumentation"],"mappings":";;;;;;;;;;;AAC+H;AAClD;AAEY"}